fix(pipeline): Preserve dtype in from_pipe() instead of defaulting to float32#13103
Open
Mr-Neutr0n wants to merge 1 commit intohuggingface:mainfrom
Open
fix(pipeline): Preserve dtype in from_pipe() instead of defaulting to float32#13103Mr-Neutr0n wants to merge 1 commit intohuggingface:mainfrom
Mr-Neutr0n wants to merge 1 commit intohuggingface:mainfrom
Conversation
… float32 The from_pipe() method was defaulting to torch.float32 for torch_dtype, causing pipelines created from float16 pipelines to be converted to float32. This doubled memory usage and slowed inference. Now defaults to pipeline.dtype to preserve the source pipeline's dtype. Fixes huggingface#12754
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
from_pipe()to preserve the source pipeline's dtype instead of defaulting to float32.Problem
When using
from_pipe()to create a new pipeline from an existing one, the dtype was not preserved:This caused:
Solution
Changed the default value for
torch_dtypefromtorch.float32topipeline.dtype:Users can still override with
torch_dtype=torch.float32if needed.Fixes #12754