Phi-3CookBook
Phi-3CookBook copied to clipboard
Wrong LoRA Fine-tuning Code
This issue is for the phi3 LoRA fine-tuning code you share.
- I follow the fine-tuning code you share to test the saved fine-tuned lora model. But the model won't output anything on the test set and the rouge scores are always zero.
<img width="631" alt="image" src="https://github.com/user-attachments/assets/588870b1-de12-4f63-b014-f20d385704d3">
The reason is the tokenizer appends EOS token to every sentence/word it encodes, which leads to early termination of the answer generation process.
To fix this problem, we may set add_eos_token=False during the test.
tokenizer = AutoTokenizer.from_pretrained(merged_model, add_eos_token=False)