king-yyf/CMeKG_tools

这种报错是因为模型文件的问题吗?

beyondme121 opened this issue · 7 comments

您好:
请帮忙看看如下的报错是因为pkl文件的问题?还是因为啥? 多谢。
model4s.load_state_dict(checkpoint['model4s_state_dict'])

image

修改 load_state_dict 加个False

model4s = Model4s()
model4s.load_state_dict(checkpoint['model4s_state_dict'],False)

model4po = Model4po()
model4po.load_state_dict(checkpoint['model4po_state_dict'],False)

load_state_dict参数说明

strict=False,加载的时候可以不严格显示参数一样

strict ([bool], optional) – whether to strictly enforce that the keys in [state_dict] match the keys returned by this module’s [state_dict()] function. Default: True

我将strict修改为False,仍然没有解决报错

修改 load_state_dict 加个False

model4s = Model4s() model4s.load_state_dict(checkpoint['model4s_state_dict'],False)

model4po = Model4po() model4po.load_state_dict(checkpoint['model4po_state_dict'],False)

load_state_dict参数说明

strict=False,加载的时候可以不严格显示参数一样

strict ([bool], optional) – whether to strictly enforce that the keys in [state_dict] match the keys returned by this module’s [state_dict()] function. Default: True

兄弟感谢

感谢大佬,改了就跑通了!

我目前就只尝试了model_re,剩下两个还没有试过

谢谢

那个medical_re.pkl在哪啊? @gouyulang 还有.bin和vocab.txt这些具体是哪个哦?求求了🙏