-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
模型预测问题 #96
Comments
后面我更新一下预测代码吧,感觉不少人需要 |
可以看我的PR #99 |
from transformers import AutoConfig, AutoModel, AutoTokenizer 载入Tokenizertokenizer = AutoTokenizer.from_pretrained("/sdc/pre_trained_model/chatglm2-6b/", trust_remote_code=True) #加载pt2 finetune模型 for key in ["transformer.prefix_encoder.trans.0.weight", "transformer.prefix_encoder.trans.0.bias", "transformer.prefix_encoder.trans.2.weight", "transformer.prefix_encoder.trans.2.bias"]: 我用这个方法加载成功了,但是我不知道为啥"transformer.prefix_encoder.trans.0.weight这些需要重参数中移除,这样是否正确,能否提供一下你在使用deepspeed训练后的预测文件吗 |
我也比较关注,目前ft完了之后不知道怎么实际测试推理效果 |
我试了一下,跑的时候找不到pytorch_model这个文件,哪里可以找到这个文件?我生成的都是pytorch_model-00001-of-00002.bin之类的 |
我改了train.py里模型的存储和载入方式,只存储prefix部分的权重,chatglm本身的权重可以拿原始的权重 |
按照步骤使用p-tuning v2微调chatglm2-6b,微调之后切换v0.1,并在predict_pt中使用微调模型路径,运行后报如下错误:
raise RuntimeError(f"Error(s) in loading state_dict for {model.class.name}:\n\t{error_msg}")
RuntimeError: Error(s) in loading state_dict for ChatGLMForConditionalGeneration:
size mismatch for transformer.prefix_encoder.embedding.weight: copying a param with shape torch.Size([16, 14336]) from checkpoint, the shape in current model is torch.Size([16, 4096]).
size mismatch for transformer.prefix_encoder.trans.0.weight: copying a param with shape torch.Size([4096, 14336]) from checkpoint, the shape in current model is torch.Size([4096, 4096]).
size mismatch for transformer.prefix_encoder.trans.2.weight: copying a param with shape torch.Size([14336, 4096]) from checkpoint, the shape in current model is torch.Size([229376, 4096]).
size mismatch for transformer.prefix_encoder.trans.2.bias: copying a param with shape torch.Size([14336]) from checkpoint, the shape in current model is torch.Size([229376]).
You may consider adding
ignore_mismatched_sizes=True
in the modelfrom_pretrained
method.Process finished with exit code 1
希望作者能更新一下预测步骤。
The text was updated successfully, but these errors were encountered: