LongCat Image pipeline: Allow offloading/quantization of text_encoder component #12963
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.
What does this PR do?
Remove the attempt to move
text_encoderto the same device as the rest of the pipeline inpipeline_longcat_image.py. The text encoder may not be movable (VRAM limitations), and more to the point, it's the user's prerogative where they load things, not the pipeline's. Instead, simply moves the tensor thattext_encodergenerates.Also (and my main motivation) fixes quantization of the LongCat Image pipeline using bitsandbytes, which previously gave this exception:
Here's a simple example with bitsandbytes, which now works:
I did not submit an issue for this error, because the fix was trivial.
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
(There is no relevant documentation, as this is simply a tensor location)
(Are new tests necessary for this?)
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.
@junqiangwu