ymcui / Chinese-LLaMA-Alpaca

中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)
https://github.com/ymcui/Chinese-LLaMA-Alpaca/wiki
Apache License 2.0
18.23k stars 1.86k forks source link

添加词表 #859

Closed clclclaiggg closed 10 months ago

clclclaiggg commented 11 months ago

提交前必须检查以下项目

问题类型

None

基础模型

None

操作系统

None

详细描述问题

你好,我使用llama2的词表为32000,扩充后自己的词表为49013,但是微调的时候报错ValueError: Trying to set a tensor of shape torch.Size([32000, 4096]) in "weight" (which has shape torch.Size([49013, 4096])), this look incorrect. 请问这个怎么解决

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

No response

运行日志或截图

No response

ymcui commented 11 months ago

不清楚你用的什么脚本和命令,看起来是embedding没有resize。

Mxoder commented 11 months ago

合并词表以后还要 model.resize_token_embeddings(new_length) 吧,不然 embedding 层对不上,可以 print model 看看

clclclaiggg commented 11 months ago

谢谢,我改过了

合并词表以后还要 model.resize_token_embeddings(new_length) 吧,不然 embedding 层对不上,可以 print model 看看

谢谢,我找到问题就是这个

clclclaiggg commented 11 months ago

合并词表以后还要model.resize_token_embeddings(new_length)吧,否则嵌入层对不上,可以打印模型看看 请问我改了以后,,训练保存得模型依然是32000而不是更新之后的新层数,请问这是什么情况呀

github-actions[bot] commented 11 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.