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

[GPT2] Correct gradient checkpointing #9308

Conversation

patrickvonplaten
Copy link
Contributor

@patrickvonplaten patrickvonplaten commented Dec 25, 2020

What does this PR do?

Previously, it was not possible to train GPT2 with gradient_checkpointing and use_cache=False. However use_cache should not be set to True when training. This PR corrects the behavior so that
gradient checkpointing does not require use_cache=True.

In addition, this PR changes lists to tuples in GPT2 for consistency with other models.

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?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors which may be interested in your PR.

@patrickvonplaten patrickvonplaten merged commit 61443cd into huggingface:master Dec 25, 2020
@patrickvonplaten patrickvonplaten deleted the correct_gpt2_gradient_checkpointing branch December 25, 2020 22:28
guyrosin pushed a commit to guyrosin/transformers that referenced this pull request Jan 15, 2021
* correct gpt2

* fix gpt2

* fix use_cache ordering

* correct past tolerance

* fix for all cases

* style
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.

1 participant