-
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
fix dtype bug #30518
fix dtype bug #30518
Conversation
It would raise error if we use the bfloat16 dtype.
Hi @chujiezheng, thanks for opening a PR! Could you share an example snippet which reproduces this error on main? |
import torch
from transformers import pipeline
rm_pipe = pipeline(
"sentiment-analysis",
model="weqweasdas/RM-Mistral-7B",
device_map='auto',
torch_dtype=torch.bfloat16,
)
texts = ['hello']
outputs = rm_pipe(texts) |
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.
@chujiezheng Thanks for proving an example!
Could you also add a test which will fail on main but pass on this branch? Ideally, this test should be added to all pipelines to check that can accept bf16 inputs.
Sorry, I do not get it well. What tests should I do, e.g., with other pipelines? |
@chujiezheng Apologies for the delay in my reply. My mistake, I thought that all the pipelines had standard input tests. In this case - it's fine to just add a test for this pipeline |
Sorry, but I am unfamiliar with the "test" and what it means. Could you give some reference? |
@chujiezheng Sure! We want to add a test in transformers/tests/pipelines/test_pipelines_text_classification.py e.g. like the one here which checks the pipeline can accept a dtpye of bfloat16. Ideally, we'd add one to check for float16 too. Let me know if this isn't clear or anything needs expanding |
@amyeroberts Hi, sorry that I made some mistakes in this PR. I opened a new one (#30996) where I add the tests. For the current PR, I will close it. |
It would raise error if we use the bfloat16 dtype.
What does this PR do?
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
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.