mirror of
https://github.com/wassname/alignment-handbook.git
synced 2026-06-27 16:14:07 +08:00
Fix the logic that causes an issue with philschmid/gemma-tokenizer-chatml tokenizer (#146)
The `setup_chat_format()` logic should not be applied to philschmid/gemma-tokenizer-chatml tokenizer, otherwise gemma models are trained w/o proper bos, eos tokens.
This commit is contained in:
+1
-1
@@ -122,7 +122,7 @@ def main():
|
||||
|
||||
model = model_args.model_name_or_path
|
||||
# For ChatML we need to add special tokens and resize the embedding layer
|
||||
if "<|im_start|>" in tokenizer.chat_template:
|
||||
if "<|im_start|>" in tokenizer.chat_template and "gemma-tokenizer-chatml" not in tokenizer.name_or_path:
|
||||
model = AutoModelForCausalLM.from_pretrained(model_args.model_name_or_path, **model_kwargs)
|
||||
model, tokenizer = setup_chat_format(model, tokenizer)
|
||||
model_kwargs = None
|
||||
|
||||
Reference in New Issue
Block a user