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

Xception pretrained state_dict keys no longer match the parameter names in the xception class #227

Open
jiversivers opened this issue May 31, 2024 · 0 comments

Comments

@jiversivers
Copy link

For anyone in the same boat, this will fix it:

state_dict = torch.load(f'{torch.hub.get_dir()}\checkpoints\xception-43020ad28.pth')
state_dict['last_linear.weight'] = state_dict.pop('fc.weight')
state_dict['last_linear.bias'] = state_dict.pop('fc.bias')

And you can save the "new" model under the same name so you don't have to do this more than once with:

torch.save(state_dict, f'{torch.hub.get_dir()}/checkpoints/xception-43020ad28.pth')
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

1 participant