ymcui / Chinese-LLaMA-Alpaca-2

中文LLaMA-2 & Alpaca-2大模型二期项目 + 64K超长上下文模型 (Chinese LLaMA-2 & Alpaca-2 LLMs with 64K long context models)
Apache License 2.0
7.05k stars 577 forks source link

词表扩充后的模型合并 #360

Closed lyq080700 closed 10 months ago

lyq080700 commented 10 months ago

提交前必须检查以下项目

问题类型

None

基础模型

None

操作系统

None

详细描述问题

您好,我自己基于chinese_llama2进行了词表扩充,然后进行了预训练,预训练出来后对话能力不强的,所以需要指令微调,但我想合并现有的chinese_alpaca_lora_7B这个权重再去指令微调,再合并自己微调后的权重,这样可以吗,但我试过之后因为词表扩充的步骤,词表大小不一致所以合并不成功,到SFT的话就会报这个错误: RuntimeError: Error(s) in loading state_dict for PeftModelForCausalLM: size mismatch for base_model.model.model.embed_tokens.weight: copying a param with shape torch.Size([49954, 4096]) from checkpoint, the shape in current model is torch.Size([58353, 4096]). 请问一下这个问题要怎么解决呢,感谢回答!!!

依赖情况(代码类问题务必提供)

# 请在此处粘贴依赖情况(请粘贴在本代码块里)

谢谢

运行日志或截图

# 请在此处粘贴运行日志(请粘贴在本代码块里)

谢谢

clclclaiggg commented 10 months ago

我也出现这个问题,好像需要resize-embedding-size步骤,但是不知道具体怎么解决

ymcui commented 10 months ago
我想合并现有的chinese_alpaca_lora_7B这个权重再去指令微调,再合并自己微调后的权重,这样可以吗,

不可以。lora和对应的基模型是有绑定关系的。 不能理解为像积木一样把这个lora加到你的模型就能得到对话能力了。

lyq080700 commented 10 months ago
我想合并现有的chinese_alpaca_lora_7B这个权重再去指令微调,再合并自己微调后的权重,这样可以吗,

不可以。lora和对应的基模型是有绑定关系的。 不能理解为像积木一样把这个lora加到你的模型就能得到对话能力了。

好的,非常感谢,这里还有两个问题:

  1. 如果要训练自己领域的指令微调模型,再预训练完后,就得找新的指令数据重新训练一个全新的指令精调模型是吗?
  2. 是否可以把已经合并权重的模型做为基模型,在词表扩充后,去预训练和指令微调一个自己领域的模型呢?

感谢回答!

github-actions[bot] commented 10 months ago

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.

github-actions[bot] commented 10 months ago

Closing the issue, since no updates observed. Feel free to re-open if you need any further assistance.