Repository navigation
Description
Config and public-API audit, done at e6b19c5 and re-checked on main @ 39cd57a. Items 1–3 and 5 reproduce with a CPU-only script; item 1 was also run end to end.
Checked and working:
- Config round trip for GPTQ, AWQ, Paro, QQQ, VPTQ, FP8, NF12, TT-BF, BnB, RTN and GGUF.
quantize_config.jsonandconfig.jsonagree in all 13 saved configs.- Invalid combinations are rejected early with clear messages:
format=marlinfor quantization, bad group sizes (including indynamic), AWQ 3-bit, QQQ gs=64 / asym, Paro asym, int64pack_dtype, a baddynamicregex, unknown rotation. - Calibration edge cases (empty,
None, all-too-short rows,datasets.Dataset, 2-D tensor, batch size > dataset, callingquantize()twice) give clear errors or work. - Documented defaults match the dataclasses.
1. EXL3 configs can't be serialized: a fresh auto_dtype_cast="off" quantize crashes at save, and every loaded EXL3 checkpoint crashes on re-save (high for EXL3)
gptqmodel/quantization/config.py:6303 EXL3Config.__post_init__ doesn't call the base normalisation: it never converts auto_dtype_cast, telemetry or mse. The base to_dict then assumes normalised types (:4925 self.auto_dtype_cast.value, :4897 asdict(self.telemetry)). auto_dtype_cast was added in #3853, which updated the base class but not EXL3.
EXL3Config(auto_dtype_cast='off').to_dict() -> AttributeError: 'str' object has no attribute 'value'
EXL3Config(auto_dtype_cast='bogus') -> accepted
end to end: quantize OK (5.6 s), then save() -> AttributeError (output dir holds only ledger/log files)
default EXL3 quantize + save OK; reload gives telemetry as a dict, auto_dtype_cast as a str ->
re-save -> TypeError: asdict() should be called on dataclass instances
Fix: apply the base normalisations in EXL3Config.__post_init__ (AutoDtypeCast(...), which also rejects bad values; dict → TelemetryConfig; _normalize_mse), or move them into a helper both classes call. Add an EXL3 to_dict → from_quant_config → to_dict round-trip test.
2. The QuantizeConfig(...) factory silently drops misspelled and unknown kwargs; the concrete classes raise (medium)
config.py:4031-4037 (QuantizeConfigMeta.__call__) → _prepare_target_quantize_config_kwargs → _filter_quantize_config_payload_for_target_cls (:3999-4001) keeps only the target class's init fields, with no error or log. GPTQModel.load(path, quantize_config={...}) takes the same path (models/auto.py:782).
QuantizeConfig(bits=4, damp_percnt=0.1) -> GPTQConfig, no error, no warning; damp_percent stays 0.05
GPTQConfig(bits=4, damp_percnt=0.1) -> TypeError ... Did you mean 'damp_percent'?
QuantizeConfig(bits=4, desc_act=True, act_grup_aware=False) -> typo dropped silently
QuantizeConfig(method='awq', static_groups=True, gptaq=...) -> fields valid elsewhere silently vanish
QuantizeConfig is the README's main entry point, so a user can quantize for hours with settings that aren't the ones they wrote. Fix: raise TypeError for keys that aren't a field of any config class, and warn or raise for known fields the dispatched class doesn't accept. Keep the lenient path only for checkpoint JSON (from_quant_config).
3. A list of tokenizer outputs ([tokenizer(text), ...]) is rejected with a misleading error (medium-low)
gptqmodel/utils/calibration.py:352 checks isinstance(example, dict). BatchEncoding is a UserDict, not a dict, so it falls through to _pack_ids and fails:
[tokenizer(text)] -> ValueError: Quantize: unsupported calibration example type <class '...BatchEncoding'> at index 0
[dict(tokenizer(text))] -> works
This happens with and without return_tensors="pt". It's the AutoGPTQ-style pattern, and quantize() is annotated List[Dict[str, ...]]. Fix: use isinstance(example, collections.abc.Mapping).
4. GPTQModel.load: device is silently ignored when device_map is also given, and the HF string forms device_map="cpu" / "cuda:0" are rejected (medium-low)
models/loader.py:1735-1760: a non-Nonedevice_mapreplacesdevicewith no conflict check:device='cpu', device_map='auto' -> loaded on cuda:0 (MarlinLinear) device='cuda:0', device_map={'':'cpu'} -> loaded on cpu (TorchCpuAvx512Linear)loader.py:2320-2329: any string other thanauto/balanced/balanced_low_0/sequentialraisesValueError: If passing a string for device_map, please choose 'auto', ....
Fix: raise or warn when device and device_map disagree, and map "cpu" / "cuda:N" to {"": value} as HF does. (Backend/device conflicts such as MARLIN + cpu already raise clearly.)
5. static_groups is written to meta but never read back (low)
models/writer.py:1909 writes meta.static_groups, but the meta field map in config.py (~4700-4760) has no static_groups entry, so it reloads as False. QQQ reads it (quantization/qqq.py:757) when re-quantizing from a loaded config. Fix: add the mapping.
Plausible, lower priority:
GPTQConfig(desc_act="False")becomesTrueviabool(), andsym="False"is kept as a truthy string and written to the checkpoint. Bool fields have no type validation.QuantizeConfig(method='gptq', format='gemm')silently becomes AWQ, with only a WARN.GPTQModel.load(quantized_path, quantize_config=X)silently ignoresX(from_pretrainedwarns).quantize()is annotated to acceptList[int], but a flat int list fails.- README:1410 implies
desc_actis on by default; it'sFalsewithact_group_aware=True.
🤖 Generated with Claude Code
Activity
fix(loader): reject invalid device_map strings and refresh docs (#4052)
fix(config): normalize EXL3 serialization and reject silent kwarg dro…
fix(config): reject bad bool values and unknown `dynamic` keys (#4668) (
fix(save): reject unknown `save()` keywords on the quantized path (#4686