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

mean_resizing = True does not work with mixed/meta initialization #3719

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer/models/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _check_tokenizer_and_maybe_resize_embeddings(self, allow_embedding_resizing:
f' This would cause an error during training.'
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to gate on transformers version, or inspect the args to the func before passing this in or something i think

else:
raise ValueError(
f'The number of tokens in the tokenizer is greater than the number of tokens in the model.'
Expand Down
Loading