You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
two_new_prefix_state_dict = {}
for k, v in two_prefix_state_dict.items():
if k.startswith("transformer.prefix_encoder."):
two_new_prefix_state_dict[k[len("transformer.prefix_encoder."):]] = v
two_model.transformer.prefix_encoder.load_state_dict(two_new_prefix_state_dict)
Comment out the following line if you don't use quantization
Is there an existing issue for this?
Current Behavior
加载代码如下
tokenizer = AutoTokenizer.from_pretrained("THUDM\chatglm-6b", trust_remote_code=True)
two_model = AutoModel.from_pretrained("THUDM\chatglm-6b", trust_remote_code=True)
two_prefix_state_dict = torch.load(os.path.join("ptuning/output/adgen-pt-128-2e-2-405sql_train/checkpoint-500", "pytorch_model.bin"))
two_new_prefix_state_dict = {}
for k, v in two_prefix_state_dict.items():
if k.startswith("transformer.prefix_encoder."):
two_new_prefix_state_dict[k[len("transformer.prefix_encoder."):]] = v
two_model.transformer.prefix_encoder.load_state_dict(two_new_prefix_state_dict)
Comment out the following line if you don't use quantization
two_model = two_model.quantize(4)
two_model = two_model.half().cuda()
two_model.transformer.prefix_encoder.float()
two_model = two_model.eval()
Expected Behavior
No response
Steps To Reproduce
训练完成后加载模型(训练的权重也加上)
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: