问题:

解决:

model.load_state_dict(state_dict)
# 改为:
model.load_state_dict(state_dict, strict=False)
from collections import OrderedDict
new_state_dict = OrderedDict()
for k, v in params.items():
if not k.endswith('position_ids'):
new_state_dict[k] = v
model.load_state_dict(new_state_dict)