一 bug错误
最近使用千问大模型有一个bug,报错信息如下
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ChartParser:
Unexpected key(s) in state_dict: "pretrained_model.embeddings.position_ids
感觉是加载模型出现了错误。
二解决方案
设置参数strict=False,即可。
vim ~/anaconda3/envs/llm_eval/lib/python3.12/site-packages/benepar/parse_chart.py +86
parser.load_state_dict(state_dict, strict=False)