Skip to content

Only cast logits to float when computing loss#34147

Merged
ArthurZucker merged 2 commits intohuggingface:mainfrom
ringohoffman:only-cast-logits-float-compute-loss
Oct 18, 2024
Merged

Only cast logits to float when computing loss#34147
ArthurZucker merged 2 commits intohuggingface:mainfrom
ringohoffman:only-cast-logits-float-compute-loss

Conversation

@ringohoffman
Copy link
Copy Markdown

What does this PR do?

A few updates that were missed in #31292 and #33902.

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 who may be interested in your PR.

cc: @Cyrilvallez @gante @ArthurZucker

Copy link
Copy Markdown
Contributor

@gante gante left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the fix 🙏

Comment thread src/transformers/models/chameleon/modeling_chameleon.py Outdated
@gante gante requested a review from ArthurZucker October 17, 2024 15:53
Copy link
Copy Markdown
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

🤗 thanks for bookeeping hehe

@ArthurZucker ArthurZucker merged commit 816f442 into huggingface:main Oct 18, 2024
stevhliu pushed a commit to stevhliu/transformers that referenced this pull request Oct 21, 2024
* Only cast logits to float when computing loss

Some misses from huggingface#31292 and huggingface#33902

* Move logits.float() into existing if labels is not None branch
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* Only cast logits to float when computing loss

Some misses from huggingface#31292 and huggingface#33902

* Move logits.float() into existing if labels is not None branch
@ringohoffman ringohoffman deleted the only-cast-logits-float-compute-loss branch March 9, 2025 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