-
Notifications
You must be signed in to change notification settings - Fork 32k
Attempting to test automatically the _keys_to_ignore.
#20042
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
Changes from all commits
134f8a8
6706337
9e33f8a
2225e65
0d1642c
602edaf
7851df5
8f6a6ae
f53fb25
7a7b378
e7cb3df
1d8811c
e66d960
7039418
8e7c939
3f38678
79c7e6e
6c399d4
c3bfad1
81b3692
fb6007b
56411ac
d845b3a
85c4bb2
e2f6a84
3354c8e
f552a91
bb3673c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1047,6 +1047,8 @@ def forward( | |
| BERT_START_DOCSTRING, | ||
| ) | ||
| class BertForPreTraining(BertPreTrainedModel): | ||
| _keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias", r"cls.predictions.decoder.weight"] | ||
|
|
||
| def __init__(self, config): | ||
| super().__init__(config) | ||
|
|
||
|
|
@@ -1153,7 +1155,7 @@ def forward( | |
| class BertLMHeadModel(BertPreTrainedModel): | ||
|
|
||
| _keys_to_ignore_on_load_unexpected = [r"pooler"] | ||
| _keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias"] | ||
| _keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias", r"cls.predictions.decoder.weight"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me review this slowly 🙏 and verify a few things. But do you think I am going to check myself anyway.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe. I'm not sure but the test does yell if we're hiding a valid key (we I don't try to yell when we have an unused |
||
|
|
||
| def __init__(self, config): | ||
| super().__init__(config) | ||
|
|
@@ -1288,7 +1290,7 @@ def _reorder_cache(self, past, beam_idx): | |
| class BertForMaskedLM(BertPreTrainedModel): | ||
|
|
||
| _keys_to_ignore_on_load_unexpected = [r"pooler"] | ||
| _keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias"] | ||
| _keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias", r"cls.predictions.decoder.weight"] | ||
|
|
||
| def __init__(self, config): | ||
| super().__init__(config) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me review this slowly 🙏 and verify a few things. But do you think
r"predictions.decoder.bias"is a mistake and should ber"cls.predictions.decoder.bias"?I am going to check myself anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A re match is done, so while the exact name is indeed
r"cls.predictions.decoder.bias", this works. But would be great to fix just in case one day a weight namedpredictions.decoder.biasthat should not be ignore appears ;-)