dwq370
dwq370
使用原模型,进程会加载checkpoint  使用微调模型,会提示有些参数无法从checkpoint中加载。  应该问题出在这里,但不知道该如何解决
参考https://www.heywhale.com/mw/project/6436d82948f7da1fee2be59e中的做法  执行出现新的错误  AttributeError: 'ChatGLMModel' object has no attribute 'prefix_encoder'
问题已解决  添加 config = AutoConfig.from_pretrained("./ptuning/THUDM/chatglm-6b", trust_remote_code=True) config.pre_seq_len = 64 model = AutoModel.from_pretrained("./ptuning/THUDM/chatglm-6b", config=config, trust_remote_code=True) pre_seq_len和训练设置的一致,就可以运行
第3行 model = AutoModel.from_pretrained(CheckPoint_Path, config=config, trust_remote_code=True) 改成 model = AutoModel.from_pretrained(“/root/autodl-tmp/modal/chatglm-6b”, config=config, trust_remote_code=True) 就可以了
估计用prefixEncoder的训练方式,需要先加载源模型再加载prefixEncoder。如果直接加载微调的checkpoint,训练时将参数pre_seq_len去掉试试,如果计算资源不足,可能需要使用deepspeed来微调。  我的机器上跑deepspeed总是失败,所以只能用prefixEncoder的方式。
问题已解决,requesments.txt中的torch版本是1.10.1,卸载到1.10.1,重新安装torch就可以了,不过执行速度太慢 pip uninstall torch pip install torch