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

Fix require_grad typo #1771

Closed
wants to merge 2 commits into from
Closed

Fix require_grad typo #1771

wants to merge 2 commits into from

Conversation

kit1980
Copy link
Contributor

@kit1980 kit1980 commented Jul 17, 2023

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

@facebook-github-bot
Copy link
Contributor

@kit1980 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@xuzhao9
Copy link
Contributor

xuzhao9 commented Jul 18, 2023

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!

@kit1980
Copy link
Contributor Author

kit1980 commented Jul 18, 2023

I'll submit upstream.

kit1980 added a commit to kit1980/BERT-pytorch that referenced this pull request Jul 18, 2023
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
@xuzhao9
Copy link
Contributor

xuzhao9 commented Jul 18, 2023

@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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@facebook-github-bot
Copy link
Contributor

@kit1980 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@kit1980 merged this pull request in ae8f06f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants