mean_resizing = True does not work with mixed/meta initialization#3719
Open
jdchang1 wants to merge 2 commits intomosaicml:mainfrom
Open
mean_resizing = True does not work with mixed/meta initialization#3719jdchang1 wants to merge 2 commits intomosaicml:mainfrom
jdchang1 wants to merge 2 commits intomosaicml:mainfrom
Conversation
dakinggg
reviewed
Nov 20, 2024
| f' Resizing the model embeddings to {len(self.tokenizer)} from {self.config.vocab_size}.', | ||
| ) | ||
| self.model.resize_token_embeddings(len(self.tokenizer)) | ||
| self.model.resize_token_embeddings(len(self.tokenizer), mean_resizing=False) |
Contributor
There was a problem hiding this comment.
you'll need to gate on transformers version, or inspect the args to the func before passing this in or something i think
dakinggg
reviewed
Nov 20, 2024
Contributor
dakinggg
left a comment
There was a problem hiding this comment.
For posterity/if we want to fix this, could you explain why the mean_resizing doesn't work with meta but the old version does?
mvpatel2000
reviewed
Nov 22, 2024
Contributor
mvpatel2000
left a comment
There was a problem hiding this comment.
LGTM besides Daniel's comment which will fix tests
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?
Transformers recently added in
mean_resizingtoresize_token_embeddings. This is breaking with mixed initialization in downstream training tasks that requires adding tokens to Composer Huggingface Models. This PR sets this value to False for now rather than defaulting to True.