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
[M2M100] fix positional embeddings #10590
Merged
Merged
Conversation
This file contains 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
patil-suraj
commented
Mar 8, 2021
Comment on lines
+1163
to
+1165
_keys_to_ignore_on_save = [ | ||
r"model.encoder.embed_positions.weights", | ||
r"model.decoder.embed_positions.weights", |
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.
since M2M100
uses sinusoidal positional embeddings, we don't need to save the pos embed weights.
patrickvonplaten
approved these changes
Mar 8, 2021
decoder_input_ids = ids_tensor([self.batch_size, self.seq_length], self.vocab_size) | ||
|
||
# we need to clamp the input ids here to avoid having pad token in between |
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.
great! Thank for the very in-detail explanation!
Iwontbecreative
pushed a commit
to Iwontbecreative/transformers
that referenced
this pull request
Jul 15, 2021
* fix tests * emb should be a parameter * fix positional embeddings * fix make_weights * don't save pos embeds * add comment to describe the clamping
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?
The torchscript tests for
M2M100
are failing on master. This is because theweights
inM2M100SinusoidalPositionalEmbedding
are initially not on the same device as the rest of the parameters.The PR makes the
weights
asnn.Parameter
so they'll be on the same device.