You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@dataclass on quant configs breaks __eq__/__repr__/hashing, and to_json_string() raises for most configs #15126
Every quantization config subclass in src/diffusers/quantizers/quantization_config.py is decorated with @dataclass, but each has a custom __init__ and declares no dataclass fields beyond the inherited quant_method. @dataclass still generates __eq__/__repr__ from the declared fields it sees, so:
GGUFQuantizationConfig(compute_dtype=torch.float16) == GGUFQuantizationConfig(compute_dtype=torch.bfloat16) is True.
The configs are unhashable.
repr() hides every real parameter for GGUF, BFL, Nunchaku, Quanto, ModelOpt, and AutoRound configs.
Separately, to_json_string() calls self.to_diff_dict(), which only BitsAndBytesConfig defines — every other config raises AttributeError when to_json_string() is called (which is the default use_diff=True path).
Reproduction
importtorchfromdiffusers.quantizers.quantization_configimportGGUFQuantizationConfig, QuantoConfiga=GGUFQuantizationConfig(compute_dtype=torch.float16)
b=GGUFQuantizationConfig(compute_dtype=torch.bfloat16)
print(a==b) # True - should be Falseprint(repr(a)) # "GGUFQuantizationConfig(quant_method=<QuantizationMethod.GGUF: 'gguf'>)" - compute_dtype is missinghash(a) # TypeError: unhashable type: 'GGUFQuantizationConfig'QuantoConfig(weights_dtype="int8").to_json_string()
# AttributeError: 'QuantoConfig' object has no attribute 'to_diff_dict'
Logs
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: unhashable type: 'GGUFQuantizationConfig'
Traceback (most recent call last):
File ".../diffusers/src/diffusers/quantizers/quantization_config.py", line 144, in to_json_string
config_dict = self.to_diff_dict()
^^^^^^^^^^^^^^^^^
AttributeError: 'QuantoConfig' object has no attribute 'to_diff_dict'
System Info
diffusers @ main, commit aaf57d0
Python 3.12, Linux
Who can help?
(leaving blank — no specific quantization reviewer listed in the template's tag guide)
Activity