Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#15,126 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
73/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python, pytorch

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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)

Lenguaje dominante
Python
Estrellas
34.8k
Forks
7.4k
Merge medio
2 d 6 h
PR fusionados (30 d)
54

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de huggingface/diffusers

Todos los issues de huggingface/diffusers

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.