Skip to content

[BUG] Config serialisation round-trip losses: to_dict() crashes on object-valued overrides; GPTQ-family drops smoother/foem/gptaq; QuantizeConfig(**d) loses settings and turns RTN into AWQ #4201

Closed

Description

@Qubitium

Severity: low–medium
Version: 7.11.0 @ 9dad249

1. to_dict() / save_pretrained raises TypeError for per-module overrides the quantizer accepts

config.py:5312-5318 serialises only adapter and bits inside dynamic. Processors accept these overrides per module (normalize_fallback, _normalize_mse, _normalize_pack_dtype, the smoother normaliser), so the crash comes at save, after quantization has finished.

import json, torch
from gptqmodel.quantization.config import GPTQConfig, Fallback, MSEConfig, SmoothMAD
for ov in [{"fallback": Fallback(threshold="5%")}, {"mse": MSEConfig(norm=2.0)},
           {"pack_dtype": torch.int16}, {"smoother": SmoothMAD(k=2.0)}]:
    json.dumps(GPTQConfig(bits=4, dynamic={r".*down_proj": ov}).to_dict())   # TypeError: not JSON serializable

2. GPTQ / QQQ / VPTQ / ParoQuant drop preprocessors (smoother); FOEM / GPTAQ+FOEM are lost in to_dict()

In config.py:5571-5596, GPTQConfig._update_meta_payload never calls super(), which is what writes preprocessors (config.py:~5394).

  • GPTQConfig(smoother={"smooth": {"type": "mad", "k": 2.5}}) reloads with smoother=None. The same happens for QQQ, VPTQ and Paro, while AWQ, RTN, FP8, BnB, GGUF and the others keep it.
  • The same block writes foem only when gptaq is set, and then omits gptaq:
    • GPTQConfig(foem=FOEMConfig(...)).to_dict() reloads with foem=None;
    • gptaq + foem reloads with gptaq=None.
  • models/writer.py:2068-2091 re-adds gptaq/foem on the normal save path, so the FOEM loss affects direct to_dict() / QuantizeConfig.save_pretrained. The preprocessors loss affects every save.

3. QuantizeConfig(**cfg.to_dict()) loses settings and changes method

config.py:~4191 says this path "keeps working", and GPTQModel.load(quantize_config=<dict>) uses it (models/auto.py:~800). But the factory (config.py:~4259) never lifts meta fields, unlike from_quant_config:

  • GPTQConfig(fallback="2%", damp_percent=0.1, mse=2.0, gptaq={"alpha": 0.5}) → QuantizeConfig(**d) gives fallback='0.5%', damp=0.05, mse=0.0, gptaq=None.
  • AWQConfig(fallback=None) → the default fallback comes back.
  • RTNConfig(format="gemm") becomes AWQConfig (method='awq'), i.e. a calibration-based AWQ run instead of RTN.

Expected

  • Serialise or normalise object-valued overrides.
  • Call super()._update_meta_payload, and write gptaq and foem independently.
  • Route dict input through from_quant_config, or lift the meta keys.

Minor

VPTQ to_dict() omits sym, so every VPTQ reload logs a misleading "missing sym" warning.


Found during an AI-assisted review (Claude Code) of 9dad249; repros were run on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions