-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Fix embedding renormalization on cpu #28546
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
Closed
Closed
Conversation
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
[ghstack-poisoned]
Collaborator
Author
|
Runtime tests: import torch
import time
def run(val):
print("Running with: ", val)
weights = torch.rand(100, 64, requires_grad=True)
inp = torch.rand(val).mul(100).long()
with torch.no_grad():
start = time.time()
torch.embedding_renorm_(weights, inp, 1.0, 2)
end = time.time()
print("Time: ", end - start)
run(10)
run(999)
run(1001)
run(10000)
run(100000)Before this patch: After this patch: |
albanD
added a commit
to albanD/pytorch
that referenced
this pull request
Oct 23, 2019
ghstack-source-id: ec2c403 Pull Request resolved: pytorch#28546
Fix #28370 repro Differential Revision: [D18094126](https://our.internmc.facebook.com/intern/diff/D18094126) [ghstack-poisoned]
soumith
approved these changes
Oct 25, 2019
VitalyFedyunin
approved these changes
Oct 27, 2019
Contributor
zdevito
pushed a commit
to zdevito/ATen
that referenced
this pull request
Nov 1, 2019
Summary: Pull Request resolved: pytorch/pytorch#28546 Fix #28370 repro Test Plan: Imported from OSS Differential Revision: D18251533 Pulled By: albanD fbshipit-source-id: cd9ab609797b8c887ec9128752cc6a2f58a9aee6
gchanan
reviewed
Nov 1, 2019
| auto scale = max_norm / (norm + 1e-7); | ||
| row *= scale; | ||
| } | ||
| for (auto i = 0; i < num_indices; i++) { |
Contributor
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.
you should comment this -- it would be totally sensible for someone to not realize what's going on here and change it back.
facebook-github-bot
pushed a commit
that referenced
this pull request
Dec 11, 2019
wuhuikx
pushed a commit
to wuhuikx/pytorch
that referenced
this pull request
Jan 30, 2020
Summary: Address last comment in pytorch#28546 Pull Request resolved: pytorch#29140 Differential Revision: D18915091 Pulled By: albanD fbshipit-source-id: 756ff5bb6a92d47c80aa9f96ff6f0edea5fd24de
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.
Stack from ghstack:
Fix #28370 repro
Differential Revision: D18251533