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

Call super().__setstate__() in Embeddings #3057

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

SimonZehetner
Copy link

When loading a model that was trained with an older torch version, it is possible that an AttributeError occurs. This can happen if new attributes were added to torch.nn.Module.

For backwards compatibility, they implemented their __setstate__ to add these attributes if they are not present (https://github.com/pytorch/pytorch/blob/ae4ec7de1e6f60aa7dcf4d5187c720f2f40543c3/torch/nn/modules/module.py#L1564).

In oder to be independent from these changes and increase backwards compatibility, it would be good, if the super-method would be called when unpickling Embeddings instead of setting __dict__.

@alanakbik
Copy link
Collaborator

@SimonZehetner thanks for fixing this!

@alanakbik alanakbik merged commit 65c17e2 into flairNLP:master Jan 23, 2023
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

Successfully merging this pull request may close these issues.

2 participants