-
Notifications
You must be signed in to change notification settings - Fork 299
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
Fix require_grad typo #1771
Fix require_grad typo #1771
Conversation
@kit1980 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Thanks! Looks like torchfix is a very useful tool! Note that the upstream code also has this bug: https://github.com/codertimo/BERT-pytorch/blob/master/bert_pytorch/model/embedding/position.py#L13 Can you help submit a PR to the upstream code, and reference it in this PR? Thanks! |
I'll submit upstream. |
Fix require_grad typos (should be requires_grad). Before the fix, the code doesn't cause any errors but doesn't do what it's supposed to do. Also see pytorch/benchmark#1771
@kit1980 Thanks! Can you please also add the upstream PR link (codertimo/BERT-pytorch#104) in this PR? |
@@ -10,7 +10,7 @@ def __init__(self, d_model, max_len=512): | |||
|
|||
# Compute the positional encodings once in log space. | |||
pe = torch.zeros(max_len, d_model).float() | |||
pe.require_grad = False | |||
pe.requires_grad = False |
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.
Could you please add https://github.com/codertimo/BERT-pytorch/pull/104
here so that we can track the upstream code change?
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.
done
@kit1980 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Fix require_grad typos (should be requires_grad).
Before the fix, the code doesn't cause any errors but doesn't do what it's supposed to do.
Fixed with TorchFix https://github.com/pytorch/test-infra/tree/main/tools/torchfix
Upstream PR: codertimo/BERT-pytorch#104