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.01k stars 571 forks source link

为啥run_clm_sft_with_peft.py可以run不能debug,debug会报错AttributeError: 'PeftModelForCausalLM' object has no attribute 'save_checkpoint'? #477

Closed feifei05 closed 6 months ago

feifei05 commented 7 months ago

提交前必须检查以下项目

问题类型

模型训练与精调

基础模型

Chinese-Alpaca-2 (7B/13B)

操作系统

Linux

详细描述问题

# 为什么sft lora微调能执行不报错,但是debug这个代码就报错,报AttributeError: 'PeftModelForCausalLM' object has no attribute 'save_checkpoint'

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

# peft=0.5.0
torch==2.0.1
transformers==4.31.0
sentencepiece==0.1.97
bitsandbytes==0.41.0

运行日志或截图

#
![image](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/assets/69673314/6e0c93c0-a912-4f35-b84c-1692e625326f)
![微信图片_20231219175050](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/assets/69673314/a763924f-d876-4d85-a710-06808c6f9346)
feifei05 commented 7 months ago

38c6bb58202d63c8736b999c7227e83

iMountTai commented 7 months ago

本地的peft版本和你安装的peft版本冲突?

feifei05 commented 7 months ago

本地的peft版本和你安装的peft版本冲突?

大佬,你意思是项目中training路径下的peft可以删掉是吗?

feifei05 commented 7 months ago

本地的peft版本和你安装的peft版本冲突?

是不是只需要pip install 一个版本就行,项目中的可以删掉哈

iMountTai commented 7 months ago

如果你要微调embed_tokenslm_head,不建议删除项目中的peft,因为它没有复制要全量训的参数,有效减少显存占用。而且当前代码是强绑定repo中的peft的,你安装新版本可能出现其它未知的问题。你就按照requirements安装peft版本没什么问题啊

feifei05 commented 7 months ago

如果你要微调embed_tokenslm_head,不建议删除项目中的peft,因为它没有复制要全量训的参数,有效减少显存占用。而且当前代码是强绑定repo中的peft的,你安装新版本可能出现其它未知的问题。你就按照requirements安装peft版本没什么问题啊

大佬吖,我pip install peft==0.3.0后,debug还是报AttributeError: 'LlamaForCausalLM' object has no attribute 'save_checkpoint',只是想debug看整个训练过程都不行,但run不会报错

iMountTai commented 7 months ago

既然跑起来了,为什么还要debug?一定要debug的话就用小一点的数据集,随机生成一个几层的小llama,然后在某个断点打印一下log好了

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