mymusise / ChatGLM-Tuning

基于ChatGLM-6B + LoRA的Fintune方案
MIT License
3.73k stars 440 forks source link

加载训练好保存的lora模型, 得到"Can't find 'adapter_config.json'" 错误,好像并没有按huggingface的预训练模型格式保存 #198

Closed huashiyiqike closed 1 year ago

huashiyiqike commented 1 year ago

Cannot find this file which is required by PeftModel.from_pretrained

I have chatglm-lora.pt, and checkpoint files including the following files:

total 6597248 drwxr-xr-x 2 lqwsl lqwsl 4096 Apr 25 11:09 ./ drwxr-xr-x 6 lqwsl lqwsl 4096 Apr 25 11:14 ../ -rw-r--r-- 1 lqwsl lqwsl 29393221 Apr 25 17:07 optimizer.pt -rw-r--r-- 1 lqwsl lqwsl 6726139677 Apr 25 17:07 pytorch_model.bin -rw-r--r-- 1 lqwsl lqwsl 14511 Apr 25 17:07 rng_state.pth -rw-r--r-- 1 lqwsl lqwsl 557 Apr 25 17:07 scaler.pt -rw-r--r-- 1 lqwsl lqwsl 627 Apr 25 17:07 scheduler.pt -rw-r--r-- 1 lqwsl lqwsl 3796 Apr 25 17:07 trainer_state.json -rw-r--r-- 1 lqwsl lqwsl 3579 Apr 25 17:07 training_args.bin

suc16 commented 1 year ago

自己加一个adapter_config.json就好了,参考 #184

huashiyiqike commented 1 year ago

Cannot find this file which is required by PeftModel.from_pretrained

I have chatglm-lora.pt, and checkpoint files including the following files:

total 6597248 drwxr-xr-x 2 lqwsl lqwsl 4096 Apr 25 11:09 ./ drwxr-xr-x 6 lqwsl lqwsl 4096 Apr 25 11:14 ../ -rw-r--r-- 1 lqwsl lqwsl 29393221 Apr 25 17:07 optimizer.pt -rw-r--r-- 1 lqwsl lqwsl 6726139677 Apr 25 17:07 pytorch_model.bin -rw-r--r-- 1 lqwsl lqwsl 14511 Apr 25 17:07 rng_state.pth -rw-r--r-- 1 lqwsl lqwsl 557 Apr 25 17:07 scaler.pt -rw-r--r-- 1 lqwsl lqwsl 627 Apr 25 17:07 scheduler.pt -rw-r--r-- 1 lqwsl lqwsl 3796 Apr 25 17:07 trainer_state.json -rw-r--r-- 1 lqwsl lqwsl 3579 Apr 25 17:07 training_args.bin

我看了#184,并没有adapter_model.bin这个文件。

倒是有pytorch_model.bin这个文件,可是我训练的是lora,应该是加载原模型以及lora模型两个模型文件吧

suc16 commented 1 year ago

Cannot find this file which is required by PeftModel.from_pretrained I have chatglm-lora.pt, and checkpoint files including the following files: total 6597248 drwxr-xr-x 2 lqwsl lqwsl 4096 Apr 25 11:09 ./ drwxr-xr-x 6 lqwsl lqwsl 4096 Apr 25 11:14 ../ -rw-r--r-- 1 lqwsl lqwsl 29393221 Apr 25 17:07 optimizer.pt -rw-r--r-- 1 lqwsl lqwsl 6726139677 Apr 25 17:07 pytorch_model.bin -rw-r--r-- 1 lqwsl lqwsl 14511 Apr 25 17:07 rng_state.pth -rw-r--r-- 1 lqwsl lqwsl 557 Apr 25 17:07 scaler.pt -rw-r--r-- 1 lqwsl lqwsl 627 Apr 25 17:07 scheduler.pt -rw-r--r-- 1 lqwsl lqwsl 3796 Apr 25 17:07 trainer_state.json -rw-r--r-- 1 lqwsl lqwsl 3579 Apr 25 17:07 training_args.bin

我看了#184,并没有adapter_model.bin这个文件。

倒是有pytorch_model.bin这个文件,可是我训练的是lora,应该是加载原模型以及lora模型两个模型文件吧

应该有一些checkpoint吧,里面是有adapter_model.bin的吧? 或者你应该把chatglm-lora.pt重命名成adapter_model.bin,rank 8的话应该是一个15M大小的文件。