-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[bitsandbytes] allow directly CUDA placements of pipelines loaded with bnb components #9840
base: main
Are you sure you want to change the base?
Conversation
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. |
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.
Thanks for the PR ! Left a suggestion
@SunMarc WDYT now? |
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.
Thanks for adding this ! LGTM ! I'll marge the PR on accelerate also
Have run the integration tests and they are passing. |
|
@SunMarc yes, on |
No, I read that as a question, my bad ;) |
# For `diffusers` it should not be a problem as we enforce the installation of a bnb version | ||
# that already supports CPU placements. | ||
else: | ||
module.to(device=device) |
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.
ok but this means for diffusers the transformer version would always met the requirement, no? i.e. the check is_transformers_version(">", "4.44.0")
will aways pass
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.
Agree but for the diffusers
codepath, probably don't care about the transformer
version, no?
Anything I am missing?
What does this PR do?
When a pipeline is loaded with models that have quantization config, we should still be able to call
to("cuda")
on the pipeline object. For GPUs that would allow the memory (such as a 4090), this has performance benefits (as demonstrated below).Flux.1 Dev, steps: 30
Currently, calling
to("cuda")
is not possible because:has:
This is why this line complains:
diffusers/src/diffusers/pipelines/pipeline_utils.py
Line 413 in c10f875
This PR fixes that behavior.
Benchmarking code:
Unroll