Skip to content

enable QA bf16 pipeline - #34483

Merged
Rocketknight1 merged 3 commits into
huggingface:mainfrom
jiqing-feng:falcon
Oct 31, 2024
Merged

Rocketknight1 merged 3 commits into
huggingface:mainfrom
jiqing-feng:falcon

Conversation

@jiqing-feng

Copy link
Copy Markdown
Contributor

Hi @SunMarc @ArthurZucker

The same issue as #31625 . Numpy can only process fp32 data type but the input tensor could be bf16/fp16 based on the model's dtype. Please review it, thx!

@jiqing-feng

Copy link
Copy Markdown
Contributor Author

The issue can be reproduced by:

import torch
from transformers import pipeline

question = "How many programming languages does BLOOM support?"
context = "BLOOM has 176 billion parameters and can generate text in 46 languages natural languages and 13 programming languages."

question_answerer = pipeline("question-answering", model="bert-large-uncased-whole-word-masking-finetuned-squad", torch_dtype=torch.bfloat16)
out = question_answerer(question=question, context=context)

@jiqing-feng

Copy link
Copy Markdown
Contributor Author

Hi @Rocketknight1 , could you please review this PR ? Thx!

@Rocketknight1 Rocketknight1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, good fix, and thank you for the clean reproducer!

@Rocketknight1

Copy link
Copy Markdown
Member

Merging without core maintainer review since this is a straightforward pipeline dtype fix that shouldn't have any side effects

@Rocketknight1
Rocketknight1 merged commit f385316 into huggingface:main Oct 31, 2024
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* enable QA bf16 pipeline

* add tests
@jiqing-feng
jiqing-feng deleted the falcon branch December 19, 2024 02:02
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