MiniCPM-V icon indicating copy to clipboard operation
MiniCPM-V copied to clipboard

Fine-tuning results are not satisfactory

Open Alxemade opened this issue 1 year ago • 2 comments

起始日期 | Start Date

No response

实现PR | Implementation PR

By using this script: finetune_ds.shfinetune_ds.sh

--llm_type "llama3"
--tune_vision false
--per_device_train_batch_size 2
--per_device_eval_batch_size 1
--gradient_accumulation_steps 8
--learning_rate 1e-6
--weight_decay 0
--max_grad_norm 0.1 \

Used 56K ours SFT data, but the infer results are not satisfactory.

Also, i notice "Specially, Llama3 has a different chat_template for training and inference, we modified the chat_template for training, so please take care to restore the chat_template when inference on the training ckpt." What is that meaning?

相关Issues | Reference Issues

摘要 | Summary

基本示例 | Basic Example

缺陷 | Drawbacks

未解决问题 | Unresolved questions

Alxemade avatar May 24 '24 02:05 Alxemade

It means you should modify the chat_template to inference chat_template, because we don't need the extra <|start_header_id|>assistant<|end_header_id|>\n\n during training. You can replace the chat_template in the file tokenizer_config.json manually.

YuzaChongyi avatar May 24 '24 05:05 YuzaChongyi

This is the chat_template for inference.

"chat_template": "{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}"

YuzaChongyi avatar May 24 '24 05:05 YuzaChongyi

Thank you for your quick reply, it works.

Alxemade avatar May 25 '24 06:05 Alxemade