Skip to content

Commit

Permalink
template_dict can be a null-prototype object
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Mar 20, 2024
1 parent a6aa726 commit d26f986
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tokenizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3029,7 +3029,7 @@ export class PreTrainedTokenizer extends Callable {
) {
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)) {
if (chat_template !== null && Object.hasOwn(template_dict, chat_template)) {
// The user can pass the name of a template to the chat template argument instead of an entire template
chat_template = template_dict[chat_template];
} else if (chat_template === null && 'default' in template_dict) {
Expand Down

0 comments on commit d26f986

Please sign in to comment.