Skip to content

Commit

Permalink
Remove redundant error check
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Mar 20, 2024
1 parent 20ff0fa commit a6aa726
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/tokenizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a6aa726

Please sign in to comment.