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

num_labels parameter needed in from_pretrained to load certain bert m… #80

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

oliverjarvis
Copy link
Contributor

Pull request in order to fix a mismatch in model and weight size when loading the bert models.
Specifically this error appeared when loading at least BertTone
RuntimeError: Error(s) in loading state_dict for BertForSequenceClassification: size mismatch for classifier.weight: copying a param with shape torch.Size([3, 768]) from checkpoint, the shape in current model is torch.Size([2, 768]). size mismatch for classifier.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([2]).

Furthermore a duplicate load_bert_tone_model was found.

…odels

num_label variables switched

Added correct num_labels to pre_trained in order to correctly load models
@AmaliePauli AmaliePauli merged commit 6f107c9 into alexandrainst:master Nov 2, 2020
@AmaliePauli
Copy link
Contributor

Thanks @saxogrammaticus

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