OFA-Sys / Chinese-CLIP

Chinese version of CLIP which achieves Chinese cross-modal retrieval and representation generation.
MIT License
4.21k stars 439 forks source link

基于模型微调后得到epoch_latest.pt,但是为什么训练完推理不了,我试了好几个服务器跑完都不行 #245

Closed Luhuanz closed 7 months ago

Luhuanz commented 7 months ago

RuntimeError Traceback (most recent call last) /tmp/ipykernel_25611/2218594588.py in 13 model_state_dic = torch.load(model_path)

---> 15 model.load_state_dict(model_state_dict) 16 model.eval() 17

~/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict) 1480 1481 if len(error_msgs) > 0: -> 1482 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( 1483 self.class.name, "\n\t".join(error_msgs))) 1484 return _IncompatibleKeys(missing_keys, unexpected_keys)

Luhuanz commented 7 months ago

解决了,训练完的权重static 顺序需要重新排序

dl-sdu commented 7 months ago

解决了,训练完的权重static 顺序需要重新排序

请问具体怎么操作的