[Lazy init] Force fall back to slow init for composite models#11705
Merged
LysandreJik merged 5 commits intohuggingface:masterfrom May 12, 2021
Merged
[Lazy init] Force fall back to slow init for composite models#11705LysandreJik merged 5 commits intohuggingface:masterfrom
LysandreJik merged 5 commits intohuggingface:masterfrom
Conversation
added 3 commits
May 12, 2021 13:56
LysandreJik
approved these changes
May 12, 2021
Member
LysandreJik
left a comment
There was a problem hiding this comment.
Eventually would be nice to add a test for this, as this is an issue that should have been caught by the tests!
Thanks for the hotfix.
…er.py Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
Iwontbecreative
pushed a commit
to Iwontbecreative/transformers
that referenced
this pull request
Jul 15, 2021
…gface#11705) * fix encoder-decoder & RAG * finalize * Update src/transformers/models/encoder_decoder/modeling_encoder_decoder.py Co-authored-by: Lysandre Debut <lysandre@huggingface.co> * Update src/transformers/models/rag/modeling_rag.py Co-authored-by: Lysandre Debut <lysandre@huggingface.co> Co-authored-by: Patrick von Platen <patrick@huggingface.co> Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Thanks to the great issue #11704 it was discovered that fast initialization currently breaks for all models whose
XXXPreTrainedModeldoes not implement a_init_weightsfunction and for which parts of the weights are missing when using.from_pretrained(...). This includes essentially all composite models, beingRagandEncoderDecoder.This PR does the vanilla fix of forcing those models to fall back on
_slow_initsince a better fix requires a careful re-design which is left for a future PR.Future PR
from_pretrained(...)methods in RAG and EncoderDecodermodel._init_weightsfor composite models. For Composite models, each part has to be called directly =>Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.