Alpha-VLLM / LLaMA2-Accessory

An Open-source Toolkit for LLM Development
https://llama2-accessory.readthedocs.io/
Other
2.68k stars 170 forks source link

Failed to fine-tune #54

Closed qkrtnskfk23 closed 1 year ago

qkrtnskfk23 commented 1 year ago

Hi,

I conducted fine-tuning of lamma2 on my own dataset.

However, the results of fine-tuned model is really weird.

Response: triggertriggertriggertriggertriggertriggertriggertriggertriggertriggertriggertriggertrigger.....

Do you know any solution or any causation of this issue?

Additionally, the closs is monotonically decreased from 1.5 to 0.3 for 4 epochs.

Thanks

ChrisLiu6 commented 1 year ago

Could you please provide you fine-tuning command and host-demo command?

qkrtnskfk23 commented 1 year ago

I use --quant and --only_save_trainable for multi-turn training based on shared_gpt format.

For fine-tuning,

python demos/multi_turn.py \ --llama_config llama/llama-2-7b/params.json --tokenizer_path /llama/tokenizer.model --pretrained_path /llama/llama-2-7b

For demo, python demos/multi_turn.py \ --llama_config llama/llama-2-7b/params.json --tokenizer_path /llama/tokenizer.model \ --pretrained_path /llama2/output_dir/finetune/sg/dialog_sharegpt/epoch3

Thanks.

kriskrisliu commented 1 year ago

For demo, it is required to pass both base weights and trainable weights to --pretrained_path. In your case, it should be like:

python demos/multi_turn.py \
--llama_config llama/llama-2-7b/params.json \
--tokenizer_path /llama/tokenizer.model \
--pretrained_path <path/to/llama-2-7b> /llama2/output_dir/finetune/sg/dialog_sharegpt/epoch3 \
--quant \
--llama_type <choose llama type>

It is important to choose the correct --llama_type: (1) if the model is finetuned under normBias setting, please use --llama_type llama_peft (2) if the model is finetuned under normBiasLora setting, please use --llama_type llama_peft and --llama_config llama/llama-2-7b/params.json configs/model/finetune/sg/llamaPeft_normBiasLora.json

qkrtnskfk23 commented 1 year ago

It works! Thank you!!