Skip to content

Commit

Permalink
Also update when chat_template is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Mar 16, 2024
1 parent 1ec55b3 commit 926fbf5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tokenizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3038,10 +3038,10 @@ export class PreTrainedTokenizer extends Callable {
`template names are ${Object.keys(template_dict).sort()}.`
)
}
} else if (chat_template === null) {
} else {
// These are the cases when the model has a single template
// priority: `chat_template` argument > `tokenizer.chat_template` > `tokenizer.default_chat_template
chat_template = this.chat_template ?? this.default_chat_template;
chat_template ??= this.chat_template ?? this.default_chat_template;
}

// Compilation function uses a cache to avoid recompiling the same template
Expand Down

0 comments on commit 926fbf5

Please sign in to comment.