fix qwen eos token

This commit is contained in:
hiyouga 2023-08-06 13:31:17 +08:00
parent 7f18d2a335
commit e21ae01356
1 changed files with 3 additions and 1 deletions

View File

@ -68,7 +68,9 @@ def load_model_and_tokenizer(
padding_side=model_args.padding_side,
**config_kwargs
)
if tokenizer.pad_token_id is None or tokenizer.pad_token_id == 64000: # 64000 for baichuan model (older version)
if tokenizer.eos_token_id is None: # fix qwen tokenizer
tokenizer.eos_token = "<|endoftext|>"
if tokenizer.pad_token_id is None: # add pad token
tokenizer.pad_token = tokenizer.eos_token
config = AutoConfig.from_pretrained(model_args.model_name_or_path, **config_kwargs)