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

Fine Tuning with a new model #37

Open
tednaseri opened this issue Nov 9, 2022 · 1 comment
Open

Fine Tuning with a new model #37

tednaseri opened this issue Nov 9, 2022 · 1 comment

Comments

@tednaseri
Copy link

Hi @asahi417 ,

I am trying to fine-tune using different pre-trainedf distil-bert models. If the number of labels is not matched with the one Tner expects, I face with an error as:

RuntimeError: Error(s) in loading state_dict for DistilBertForTokenClassification:
	size mismatch for classifier.weight: copying a param with shape torch.Size([9, 768]) from checkpoint, the shape in current model is torch.Size([15, 768]).
	size mismatch for classifier.bias: copying a param with shape torch.Size([9]) from checkpoint, the shape in current model is torch.Size([15]).
	You may consider adding `ignore_mismatched_sizes=True` in the model `from_pretrained` method.

The suggested solution is using ignore_mismatched_sizes=True when loading model, like:
loading --> from_pretrained(path, num_labels, ignore_mismatched_sizes=True)
What do you think about it?

Thank you.

@asahi417
Copy link
Owner

asahi417 commented Nov 9, 2022

It looks like that’s an error specific for the distill Bert model class. Let me test the solution locally and would merge it once I confirmed it.

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