模型合并
将 base model 与训练好的 LoRA Adapter 合并成一个新的模型。注意:不要使用量化后的模型或
quantization_bit参数进行合并。
我们可以在llamafactory界面上讲模型进行合并,或者是使用命令行对模型进行合并
1、使用界面对模型进行合并
2、使用命令行对模型进行合并
首先这里你需要新建一个配置文件merge_llama3_lora_sft.yaml(名字可以自定义)
以下是 merge_llama3_lora_sft.yaml 的内容:
### Note: DO NOT use quantized model or quantization_bit when merging lora
adapters
### model
model_name_or_path: /root/autodl-tmp/models/Llama3-8B-Chinese-Chat/
adapter_name_or_path: /root/code/LLaMA-Factory/saves/LLaMA3-8B-Chinese
Chat/lora/train_2024-05-25-20-27-47
template: llama3
finetuning_type: lora
### export
export_dir: /root/autodl-tmp/models/LLaMA3-8B-C