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

gpus > 1 #35

Open
hosseinfani opened this issue May 15, 2021 · 1 comment
Open

gpus > 1 #35

hosseinfani opened this issue May 15, 2021 · 1 comment

Comments

@hosseinfani
Copy link

Seems allRank suffers from what has been raised in this link

https://discuss.pytorch.org/t/solved-keyerror-unexpected-key-module-encoder-embedding-weight-in-state-dict/1686/3

So, instead of directly load the save model by:
model.load_state_dict(load_state_dict_from_file('model.pkl', dev))

We have to do the following:

state_dict = load_state_dict_from_file('model.pkl', dev)
new_state_dict = OrderedDict()
for k, v in state_dict.items():
name = k[7:] if 'module.' in k else k
new_state_dict[name] = v
model.load_state_dict(new_state_dict)

@mhsyno
Copy link

mhsyno commented May 24, 2021

Hello, thank you for pointing that out. We will use this fix in the next coming PR.

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

2 participants