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

Drop inplace operation for loss computation with gradient accumulation #35416

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

qgallouedec
Copy link
Member

@qgallouedec qgallouedec commented Dec 25, 2024

What does this PR do?

Fix

RuntimeError: a leaf Variable that requires grad is being used in an in-place operation.

reported here: https://huggingface.co/answerdotai/ModernBERT-base/discussions/9#6769e0390519344317755b3b

Initially introduced in #35207

The solution does solve the issue, tested locally.

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?

@muellerzr @SunMarc @ArthurZucker who reviewed #35207

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec
Copy link
Member Author

qgallouedec commented Dec 25, 2024

Not related, but relate to the same lines: #35207 (comment) @yzhangcs Ignore: point raised wrong

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Nice thanks for fixing it so quickly ! I'll merge this as others are out for a while and this is safe to merge !

@SunMarc SunMarc merged commit 4eb17b2 into main Dec 26, 2024
26 checks passed
@SunMarc SunMarc deleted the fix_inplace branch December 26, 2024 13:58
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