-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Do not warn about unexpected decoder weights when loading T5EncoderModel and LongT5EncoderModel #26211
Do not warn about unexpected decoder weights when loading T5EncoderModel and LongT5EncoderModel #26211
Conversation
Both T5EncoderModel and LongT5EncoderModel do not have any decoder layers, so loading a pretrained model checkpoint such as t5-small will give warnings about keys found in the model checkpoint that are not in the model itself. To prevent this log warning, r"decoder" has been added to _keys_to_ignore_on_load_unexpected for both T5EncoderModel and LongT5EncoderModel
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.
Thanks a lot for this PR!
The explanation makes sense to me! However I was not able to repro on the main branch:
>>> import transformers
>>> model = transformers.T5EncoderModel.from_pretrained("t5-small")
>>>
Can you share a reproducible snippet?
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
Thank you for the follow-up question! import transformers
transformers.logging.set_verbosity_info()
m = transformers.T5EncoderModel.from_pretrained('t5-small') I was not using the latest version of transformers/src/transformers/modeling_utils.py Line 3674 in bc7ce18
The problem persists however, but we wont see the warning by default |
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.
Managed to reproduce, this makes sense, thanks !
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.
thanks!
…del and LongT5EncoderModel (huggingface#26211) Ignore decoder weights when using T5EncoderModel and LongT5EncoderModel Both T5EncoderModel and LongT5EncoderModel do not have any decoder layers, so loading a pretrained model checkpoint such as t5-small will give warnings about keys found in the model checkpoint that are not in the model itself. To prevent this log warning, r"decoder" has been added to _keys_to_ignore_on_load_unexpected for both T5EncoderModel and LongT5EncoderModel
…del and LongT5EncoderModel (huggingface#26211) Ignore decoder weights when using T5EncoderModel and LongT5EncoderModel Both T5EncoderModel and LongT5EncoderModel do not have any decoder layers, so loading a pretrained model checkpoint such as t5-small will give warnings about keys found in the model checkpoint that are not in the model itself. To prevent this log warning, r"decoder" has been added to _keys_to_ignore_on_load_unexpected for both T5EncoderModel and LongT5EncoderModel
What does this PR do?
Adds
[r"decoder"]
to bothT5EncoderModel
andLongT5EncoderModel
, as both models do not have any decoder layers and loading pretrained model checkpoints liket5-small
will give warnings about keys found in the checkpoint but not in the model itself. To prevent this issue,r"decoder"
has been added to_keys_to_ignore_on_load_unexpected
for both model classes.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@ArthurZucker @younesbelkada