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

Add with torch.no_grad() to DistilBERT integration test forward pass #14979

Merged
merged 4 commits into from
Jan 12, 2022

Conversation

jaketae
Copy link
Contributor

@jaketae jaketae commented Dec 29, 2021

What does this PR do?

This PR encapsulates forward passes in DistilBERT unit tests with with torch.no_grad(): as per #14642.

Also, a unit test seemed to terminate early due to a return in a loop; this was replaced with continue. (If this was not what was intended, I will rollback the modification.)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@NielsRogge @LysandreJik @sgugger

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

I'm not sure those checks were meant under the scope of the issue. I think it was only for the last integration test, but I'll let @LysandreJik confirm.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

The request was indeed meant only for the integration tests :)

@jaketae
Copy link
Contributor Author

jaketae commented Jan 6, 2022

Thank you for the feedback and confirmation! I've reverted the change.

@LysandreJik
Copy link
Member

Hello @jaketae, were your last changes committed? I still see a lot of non-integration tests with torch.no_grad

@jaketae
Copy link
Contributor Author

jaketae commented Jan 12, 2022

@LysandreJik Apologies for the delay! I thought I had properly committed and pushed the changes but seems like that wasn't the case. Reverted most of the no_grad context and modified only the integration test. Thank you!

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@sgugger sgugger merged commit 97f3bee into huggingface:master Jan 12, 2022
@jaketae jaketae deleted the patch-1 branch February 17, 2022 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants