-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Added support for bfloat16 to zero-shot classification pipeline #33554
Conversation
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.
Hey, the idea looks good but remember that this code can also run TensorFlow pipelines! I added a suggestion where we gate your line behind if self.framework == "pt"
, which should make the tests pass. I also used .float()
so we can avoid the import torch
at the top, which causes TF problems again.
Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>
Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>
@Rocketknight1 Makes sense, thanks for the improvements, I've committed them all. |
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.
Yes, LGTM now. Thank you for the fix, it's really appreciated!
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. |
…ingface#33554) * Added support for bfloat16 to zero-shot classification pipeline * Ensure support for TF. Co-authored-by: Matt <Rocketknight1@users.noreply.github.com> * Remove dependency on `torch`. Co-authored-by: Matt <Rocketknight1@users.noreply.github.com> --------- Co-authored-by: Matt <Rocketknight1@users.noreply.github.com>
This PR fixes #33386 and adds support for models that output logits in
torch.bfloat16
in the zero-shot classification pipeline by casting logits totorch.float32
before they are converted tonumpy
floats (instead of attempting a direct conversion, which is currently not possible and raisesTypeError: Got unsupported ScalarType BFloat16
).@Rocketknight1