无法合并由alpaca-lora训练的权重,tokenizer使用llama-7b-hf和使用chinese_llama_plus_lora_7b中复制过去的
详细描述问题
无法合并由alpaca-lora训练的权重,tokenizer使用llama-7b-hf和使用chinese_llama_plus_lora_7b中复制过去的。
运行截图或log
必查项目
- [ ] 哪个模型的问题:LLaMA
- [ ] 问题类型:
- 模型转换和合并
基模型是什么,以及要合并的模型是什么? 请列一下LoRA的配置
基模型是,基于llama-7b-hf合并了chinese_alpaca_plus_lora_7b和chinese_llama_plus_lora_7b的模型llama-7b-hf-chinese。

要合并的模型是,使用alpaca-lora基于上面的llama-7b-hf-chinese为基础模型,搭配一个自己整理的中文数据集alpaca_data_chinese.json用Lora模式训练的权重。
python finetune.py \
--base_model '/srv/hdd/datasets/llama-7b-hf-chinese' \
--data_path './alpaca_data_chinese.json' \
--num_epochs 3 \
--val_set_size 2000 \
--output_dir './lora-alpaca'
最后的合并命令是
python /srv/ssd/github/Chinese-LLaMA-Alpaca/scripts/merge_llama_with_chinese_lora.py \
--base_model /srv/hdd/datasets/llama-7b-hf-chinese \
--lora_model ./lora-alpaca \
--output_type huggingface \
--output_dir /srv/hdd/datasets/llama-7b-hf-chinese-1
adapter_config.json的内容可以发出来看一下吗
报错的内容是检测到合并前后模型的权重相同,因此很有可能进行了无效合并,或LoRA权重等效为0。 目前我也没看出来问题,你可以尝试把报错的那一行assert注释掉再合并,然后手动比较合并前后模型的权重是否相同。
好的,我明天再试试,另外有一个疑问请教一下,新训练出来的Lora权重是没有tokenizer的,我是该复制llama-7b-hf中的tokenizer.model,还是复制复制llama-7b-hf-chinese中的呢?
你是基于合并后的chinese-alpaca继续训的,所以用alpaca的tokenizer(vocab size = 49954),应该就是你的llama-7b-hf-chinese中的tokenizer
降peft版本到0.2.0试试
降peft版本到0.2.0试试,也会报错:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your consideration.
Closing the issue, since no updates observed. Feel free to re-open if you need any further assistance.