Phi-3CookBook icon indicating copy to clipboard operation
Phi-3CookBook copied to clipboard

Wrong LoRA Fine-tuning Code

Open MaginaDai opened this issue 5 months ago • 0 comments

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)

MaginaDai avatar Sep 25 '24 07:09 MaginaDai