-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Make dropout condition on training. #29436
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
Conversation
ssnl
left a comment
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.
wow nice catch! pretty big bug I'd say though.....
test/test_jit.py
Outdated
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.
did you mean to use self.dropout here?
b6b5ec1 to
f784dba
Compare
|
Thanks for fixing |
f784dba to
5ead372
Compare
test/test_jit.py
Outdated
| FileCheck().check("aten::bernoulli_").run(scripted_module.graph_for(X)) | ||
| FileCheck().check("aten::bernoulli_").run(scripted_func.graph_for(X)) | ||
|
|
||
| X = torch.randn(M, M, 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.
The condition here is a bit weird. It should not depend on whether x is requiring grad, but on whether m is in training mode, right?
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.
The torchscript executor only bothers to split out symbolic gradients when the inputs require_grad, which is probably why these flags are getting set here.
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.
My question was more about why there is not a .eval() here to switch the scripted module to eval mode. Unless .graph_for auto selected train / eval mode based on input requires_grad which sounds wrong to me.
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.
@ssnl @zdevito @bddppq Thanks for the comments! To make the testcase a bit more clear, I've added a comment here to explain the behavior. https://github.com/pytorch/pytorch/pull/29436/files#diff-78aab5b4217aeaed920efab0c5f5f5c8R2202
Please let me know if that looks good! Thanks!
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.
Thank you so much!!!
11c11f3 to
3f760a0
Compare
facebook-github-bot
left a comment
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.
@ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
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.
@ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
No description provided.