chat template fix

This commit is contained in:
wassname
2025-06-02 07:27:46 +00:00
parent 2819dd46d0
commit 880d4eda1e
5 changed files with 30 additions and 5 deletions
+1
View File
@@ -124,6 +124,7 @@ def main():
# For ChatML we need to add special tokens and resize the embedding layer
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)
tokenizer.chat_template = None # Not quite sure why I have to do this, but if we end up with chatml for all models, and it's saved in the output tokeniser, that's fine
model, tokenizer = setup_chat_format(model, tokenizer)
model_kwargs = None