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.
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
[core] TorchAO Quantizer #10009
[core] TorchAO Quantizer #10009
Changes from 26 commits
64cbf11
b78a36c
355509e
cbb0da4
ee084a5
748a002
bc006f2
956f3bf
2c6beef
cfdb94f
8e214e2
1d9f832
01b2b42
b17cf35
250ccf4
50946a9
edae34b
8f09bdf
7c79b8e
820ac88
f9f1535
747bd7d
25d3cf8
10deb16
f3771a8
55d6155
de97a51
101d10c
edd98db
2677e0c
cc70887
5f75db2
9704daa
b227189
7d9d1dc
e9fccb6
bc874fc
29ec905
7ca64fd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
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.
@sayakpaul I'm not sure how this impacts BnB quantizer. I assume it was disabled for BnB for some reason I'm not aware of. It works with TorchAO as expected though so if you need this to have some kind of guard for torchao-specific, I'll add it
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.
cc @SunMarc
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.
How did you test that?
That is because we merge the sharded checkpoints when using
bnb
and using customdevice_map
s needs this codepath:diffusers/src/diffusers/models/modeling_utils.py
Line 886 in 69c83d6
This is not hit when loading quantized checkpoints at least for
bitsandbytes
. This will be tackled in: #10013There 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.
There is a test for this in
tests/quantization/torchao/test_torchao.py
calledtest_offload
that can be used to verify that cpu/disk offloading works with torchaoThere 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.
Yeah but this is about custom user-provided
device_map
s. What am I missing?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.
The check of
if device_map is not None
was added in the BnB Quantizer PR. I assume it was added because device_map is not supported in BnB. But it works perfectly fine with TorchAO (as the test checks), so I removed the change in order to do the initial testing of the TorchAO quantizer quickly.I would like to know if there should be an error raised if BnB quantizer is the method used. Something like:
Does that work?
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.
yeah that works for me.