Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

@dataclass on quant configs breaks __eq__/__repr__/hashing, and to_json_string() raises for most configs

Aperta
#15,126 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
73/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, pytorch

Direzione di ricerca

Start by reading src/diffusers/quantizers/quantization_config.py, especially the dataclass declarations and to_json_string() implementation. Reproduce the equality, representation, hashing, and JSON serialization failures described in the issue, then inspect the existing config tests for where those behaviors are covered. Done means the affected configs preserve their parameters in equality and representation, have the expected hashing behavior, and serialize to JSON without raising.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

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
import torch
from diffusers.quantizers.quantization_config import GGUFQuantizationConfig, QuantoConfig

a = GGUFQuantizationConfig(compute_dtype=torch.float16)
b = GGUFQuantizationConfig(compute_dtype=torch.bfloat16)
print(a == b)       # True - should be False
print(repr(a))       # "GGUFQuantizationConfig(quant_method=<QuantizationMethod.GGUF: 'gguf'>)" - compute_dtype is missing
hash(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)

Lingua principale
Python
Stelle
34.8k
Fork
7.4k
Merge medio
2g 6h
PR unite (30g)
54

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di huggingface/diffusers

Tutte le issue di huggingface/diffusers

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.