diff --git a/src/tokenizers.js b/src/tokenizers.js index 755a0c80a..dc0351bc4 100644 --- a/src/tokenizers.js +++ b/src/tokenizers.js @@ -3027,10 +3027,7 @@ export class PreTrainedTokenizer extends Callable { (this.chat_template && typeof this.chat_template === 'object') || (this.chat_template === null && this.default_chat_template && typeof this.default_chat_template === 'object') ) { - const template_dict = this.chat_template ?? this.default_chat_template; - if (typeof template_dict !== 'object') { - throw Error(`Expected chat_template to be an object, but got ${typeof template_dict}`); - } + const template_dict = this.chat_template ?? this.default_chat_template; // Guaranteed to be a non-null object if (chat_template !== null && template_dict.hasOwnProperty(chat_template)) { // The user can pass the name of a template to the chat template argument instead of an entire template