Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
beyondme121 opened this issue Nov 3, 2022 · 7 comments
Open

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

beyondme121 opened this issue Nov 3, 2022 · 7 comments

Comments

@beyondme121
Copy link

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

image

@gladdduck
Copy link

gladdduck commented Nov 23, 2022

修改 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

@BOSS-zsw
Copy link

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

@richardzhangy26
Copy link

修改 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

兄弟感谢

@gouyulang
Copy link

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

@gouyulang
Copy link

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

@jiangxinke
Copy link

谢谢

@jiebaui
Copy link

jiebaui commented Jan 31, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants