hiyouga/LlamaFactory · error · ValueError
ChatGLM model is not supported yet.
Error message
ChatGLM model is not supported yet.
What it means
In the export-time GPTQ branch, after version checks, LlamaFactory explicitly rejects chatglm architectures because optimum/gptqmodel block-pattern handling for ChatGLM is not wired up. The check reads config.model_type == 'chatglm' and raises ValueError.
Source
Thrown at src/llamafactory/model/model_utils/quantization.py:152
check_version("autoawq", mandatory=True)
if quant_method == QuantizationMethod.AQLM:
check_version("aqlm>=1.1.0", mandatory=True)
quantization_config["bits"] = 2
quant_bits = quantization_config.get("bits", "?")
logger.info_rank0(f"Loading {quant_bits}-bit {quant_method.upper()}-quantized model.")
elif model_args.export_quantization_bit is not None: # gptqmodel
if model_args.export_quantization_bit not in [8, 4, 3, 2]:
raise ValueError("AutoGPTQ only accepts 2/3/4/8-bit quantization.")
check_version("optimum>=1.24.0", mandatory=True)
check_version("gptqmodel>=2.0.0", mandatory=True)
from accelerate.utils import get_max_memory
if getattr(config, "model_type", None) == "chatglm":
raise ValueError("ChatGLM model is not supported yet.")
try:
from optimum.gptq import utils as gq_utils
if "language_model.model.layers" not in gq_utils.BLOCK_PATTERNS:
gq_utils.BLOCK_PATTERNS.insert(0, "language_model.model.layers")
except ImportError:
pass
block_name_to_quantize = None
if getattr(config, "model_type", None) in ["gemma3", "paligemma"]:
block_name_to_quantize = "language_model.model.layers"
init_kwargs["quantization_config"] = GPTQConfig(
bits=model_args.export_quantization_bit,
tokenizer=tokenizer,
dataset=_get_quantization_dataset(tokenizer, model_args),
block_name_to_quantize=block_name_to_quantize,View on GitHub (pinned to f28afaf635)
Solutions
- Export ChatGLM unquantized (drop export_quantization_bit) and quantize with a ChatGLM-aware toolchain, if any supports it.
- Switch to a supported architecture (llama-family, qwen, etc.) for GPTQ export.
- Keep ChatGLM in AWQ/other PTQ form from upstream providers rather than quantizing locally via this path.
Example fix
# before (export yaml, chatglm base) model_name_or_path: THUDM/chatglm3-6b export_quantization_bit: 4 # after model_name_or_path: THUDM/chatglm3-6b # export_quantization_bit removed (export unquantized)
Defensive patterns
Strategy: type-guard
Validate before calling
if export_quantization_bit is not None:
assert getattr(config, "model_type", None) != "chatglm", "GPTQ export does not support chatglm" Type guard
def gptq_export_supported(config) -> bool:
return getattr(config, "model_type", None) != "chatglm" Prevention
- Check the model-support matrix before planning GPTQ exports.
- Prefer upstream-provided PTQ releases for architectures LlamaFactory does not quantize.
When it happens
Trigger: Running llamafactory-cli export with export_quantization_bit set on a ChatGLM checkpoint (THUDM/chatglm2-6b, chatglm3-6b, etc.).
Common situations: Attempting to produce GPTQ INT4 exports of ChatGLM2/3 for vLLM-style deployment; reusing a working export config from Llama with a ChatGLM base.
Related errors
- Cannot find satisfying example, considering decrease `export
- AutoGPTQ only accepts 2/3/4/8-bit quantization.
- Invalid API key.
- Invalid length
- Dict is not supported.
AI-assisted analysis of hiyouga/LlamaFactory@f28afaf635 (2026-08-14).
Data as JSON: /api/errors/8ecd464af437a727.
Report an issue: GitHub.