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
[BUG] QuantizeEmbedConfig is never validated: a misspelled embed_quant_mode ('inptu') makes requantize() replay every layer and return success with nothing quantized; embed_only='False' is truthy #5124
Found on main @ 7b8f127, ROCm (R9700). Qwen2.5-0.5B-Instruct GPTQ 4-bit (gptq_v2) quantized on this box.
What is wrong
QuantizeEmbedConfig (gptqmodel/quantization/config.py:242-245) is a plain @dataclass with no __post_init__. BaseQModel._normalize_embed_quant_config (models/base.py:2884-2901) returns a passed instance unchanged. Every consumer compares the mode with in (QuantizeEmbed.INPUT, QuantizeEmbed.BOTH) / (OUTPUT, BOTH) (module_looper.py:2005-2009, 2148-2149, stage_layer.py:575-576, weight_only_looper.py:842-848), and embed_only is tested for truthiness (stage_layer.py:1051embed_only is not False, weight_only_looper.py:1083bool(...) and self.embed_only). As a result:
A misspelled mode string ("inptu", "outputs", "Both ") matches no branch. requantize() still runs the whole calibration replay over every layer (replay_all_layers=self.embed_quant_mode is not None), returns a normal result dict and quantizes nothing. There is no error and no warning.
embed_quant_mode=None gives an unrelated internal error: ValueError: layer module item self_attn.q_proj not found in model.
QuantizeEmbedConfig(embed_quant_mode="inptu") -> returned dict, embed = Embedding (nothing quantized, no warning)
QuantizeEmbedConfig(embed_quant_mode="input") -> returned dict, embed = TorchQuantEmbeddings
QuantizeEmbedConfig(embed_quant_mode=None) -> ValueError layer module item `self_attn.q_proj` not found in model, please check your model config.
Suggested fix
Add __post_init__ to QuantizeEmbedConfig: coerce embed_quant_mode with QuantizeEmbed(value) (raising on unknown or None, with the valid values listed), and require type(embed_only) is bool through the same _require_bool_value helper #4668 uses.
Severity
Low-medium. A typo costs a full calibration replay and reports success with the embeddings untouched, so the user saves a checkpoint they believe has quantized endpoints.
Agent claim:agent-root-5124-embed-config is working on this issue now.
Started 2026-11-18T05:25:43Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
claiming: fix: validate QuantizeEmbedConfig (embed_quant_mode via QuantizeEmbed, embed_only as a real bool) so a typo cannot silently quantize nothing
Agent claim released:agent-root-5124-embed-config finished this issue.
Pull request: #5136
QuantizeEmbedConfig is now validated at construction: embed_quant_mode is coerced through QuantizeEmbed (unknown values and None raise a ValueError that lists 'input', 'output', 'both') and embed_only goes through the #4668_require_bool_value helper, so "False" can no longer behave as True. BaseQModel._normalize_embed_quant_config re-validates a passed instance, so both quantize(embed_quant_config=...) and requantize(embed_quant_config=...) reject a bad or mutated config before dataset preparation, offload or any layer replay instead of replaying every layer and quantizing nothing. Regression tests cover construction, coercion and both entry points, plus a cached-checkpoint CUDA case; the mechanism and before/after flows are documented in docs/embedding-quantization-config.md.
Activity
Qubitium commentedon Nov 18, 2026
Agent claim:
agent-root-5124-embed-configis working on this issue now.Started 2026-11-18T05:25:43Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.
claiming: fix: validate QuantizeEmbedConfig (embed_quant_mode via QuantizeEmbed, embed_only as a real bool) so a typo cannot silently quantize nothing
fix(quantization): validate embedding quant config before replay (#5124)
Qubitium commentedon Nov 18, 2026
Agent claim released:
agent-root-5124-embed-configfinished this issue.Pull request: #5136
QuantizeEmbedConfigis now validated at construction:embed_quant_modeis coerced throughQuantizeEmbed(unknown values andNoneraise aValueErrorthat lists'input','output','both') andembed_onlygoes through the #4668_require_bool_valuehelper, so"False"can no longer behave asTrue.BaseQModel._normalize_embed_quant_configre-validates a passed instance, so bothquantize(embed_quant_config=...)andrequantize(embed_quant_config=...)reject a bad or mutated config before dataset preparation, offload or any layer replay instead of replaying every layer and quantizing nothing. Regression tests cover construction, coercion and both entry points, plus a cached-checkpoint CUDA case; the mechanism and before/after flows are documented indocs/embedding-quantization-config.md.fix(quantization): validate embedding quant config before replay (#5124…