zhangfaen / finetune-Qwen2-VL

MIT License
208 stars 20 forks source link

apply_chat_template raise ValueError( ValueError: No chat template is set for this processor. Please either set the `chat_template` attribute, or provide a chat template as an argument. #3

Closed lonngxiang closed 2 months ago

lonngxiang commented 2 months ago

python test_on_trained_model_by_us.py transformers 4.45.0.dev0 image

zhangfaen commented 2 months ago

On 2024/09/05, I think a commit introduced a bug to "huggingface/transformers" lib, which caused the chat_template.json file not to be saved.

See the commit, src/transformers/processing_utils.py line 393, this commit avoided chat_template.json to be saved. https://github.com/huggingface/transformers/commit/43df47d8e78238021a4273746fc469336f948314#diff-6505546ec5a9ab74b2ce6511681dd31194eb91e9fa3ce26282e487a5e61f9356

To walk around that bug, we need manually save the chat_template.json file.

I just made a commit in my repo. You may sync the latest repo, retrain your model, and then test your model.

This issue should be fixed. I am closing it. If you still have issue, please feel free to re-open it.