Repository navigation
Troubleshooting and FAQ
🏠 Home · 🧭 Choose a method · 🚀 Quickstart · 🧰 Help
On this page
- Overview
- 🧭 Start with the symptom
- 🚑 Use it: change one boundary at a time
- First checks
- Workflow at a glance
- Why does no backend support my checkpoint?
- CUDA OOM during quantization
- Device selection problems
- Checkpoint resume and interruption recovery
- Quality, tokenizer and evaluation issues
- 🔬 Go deeper: dependency and build diagnostics
- Kernel build failures
- Marlin and BitBLAS
trust_remote_codeand Hugging Face loading- Transformers, Optimum and engine version conflicts
- Unknown or ignored quantization-config fields
- Where do logs go?
- Environment-variable reference
- Reporting a useful bug
- Source files
- See also
Locate the failing boundary before changing your recipe or clearing caches. For: anyone whose install, load, quantization, generation, or evaluation did not behave as expected.
Most failures occur at a boundary: the installed package set versus the requested engine, checkpoint representation versus kernel capabilities, physical GPU visibility versus logical device indices, or calibration memory versus runtime inference memory. Diagnose that boundary before changing quantization parameters or deleting caches.
This page is verified against source revision c649fcb5f, which declares GPT-QModel 7.12.4. The dependency ranges and flags below are revision-specific. Older releases, external engines, and model remote code can have different requirements.
| Where it fails | First useful check | Do not jump straight to |
|---|---|---|
| Import or first-use build | Environment snapshot, then JIT/compiler error | Installing every optional engine or deleting all caches |
| Loading a saved model | Method/layout/backend compatibility | Changing a config bit width without converting the payload |
SIGABRT when exiting after a model load |
Accelerator prewarm at shutdown | |
| Wrong GPU / unexpected parallelism | Logical device indices and selected pools | Treating visibility as tensor parallelism |
| Out of memory | Stage-specific OOM triage | Assuming a 4-bit model needs only packed-weight memory |
| Resume fails | Checkpoint support and identity |
GPTQMODEL_RESUME=1, skipping integrity checks, or using a second writer |
| Low scores / malformed text | Dense baseline, prompts, token IDs | Blaming the quantizer before checking tokenization |
| Need a useful report | Sanitized evidence checklist | Posting credentials, private prompts, or full local paths |
- Capture the first error plus the environment snapshot below. Save the full local log, but share only sanitized excerpts.
- Reproduce with one supported model, one concrete logical device, and a method-specific Torch backend where supported. Do not change dtype, layout, template, and runtime simultaneously.
- For generation/quality, compare the dense model on the exact rendered prompt and input IDs. For quantization, identify capture, solve, pack, offload, or save as the failing stage.
- Re-enable optimized kernels, fusion, offload, or multi-GPU features one at a time. A diagnostic fallback is not a benchmark result or proof of identical supported inputs.
NVIDIA CUDA and AMD ROCm are separate support families. On a HIP Torch build, cuda:0 names an AMD logical device; neither that spelling nor Triton installation makes a NVIDIA-only backend available.
Public source for this guide: gptqmodel/extension.py · gptqmodel/utils/importer.py · gptqmodel/nn_modules/qlinear/init.py · gptqmodel/utils/p2p.py. Examples and declarations target revision c649fcb5f.
| Symptom | First check | Relevant section |
|---|---|---|
| Import error or dependency resolver conflict | Run gptqmodel doctor and python -m pip check in the affected environment. |
Environment diagnostics |
quantize() raises TypeError for calibration or a removed keyword |
Pass CalibrationConfig(dataset=...); move batch, concat, sort, and filtering options into that config. |
Calibration API migration |
| Kernel build or shared-library failure | The first compiler/linker error, installed toolchain, build root, CUDA/HIP version, and target architecture. | Kernel build failures |
| No compatible quantized linear kernel | Actual method/format/bits/group size/activation order/symmetry/dtype/device and shape. | Backend compatibility |
| Quantization OOM | Whether allocation comes from input capture, Hessian, dense forward, finalization, or packing. | Quantization memory |
Packing reports scale value(s) cannot be stored as fp16
|
Named scale tensor and counts for nonfinite input, FP16 cast overflow, or cast underflow. | GPTQ scale storage |
| Wrong device or invalid ordinal | Device visibility and order before Python starts, plus the requested device or placement. |
Device selection |
| Resume rejected | Same original model, calibration, configuration, packing, software and device identity. | Checkpoint recovery |
| Poor generation or evaluation | Dense baseline plus exact prompts/input IDs before blaming quantization. | Quality and tokenizer issues |
Run gptqmodel doctor in the affected environment. It prints Python and GIL status, the PyTorch build, visible CUDA/ROCm devices and their memory, required and optional dependency versions, native kernel artifacts, and selected environment variables. Missing required dependencies are FAIL, out-of-range versions are WARN, and absent optional backends are INFO. A CPU-only build or no visible CUDA/ROCm devices is informational.
gptqmodel doctor --json-out doctor.json
gptqmodel doctor --model ./checkpoint --fail-on warn| Option | Behavior |
|---|---|
--model PATH |
Reads a local checkpoint's architecture, model type, quantization metadata, and an 8,192-token KV-cache estimate when the config supports one. Quantization metadata follows loader precedence: quantize_config.json or quant_config.json before embedded quantization_config. Unreadable quantization metadata is FAIL. |
--json-out FILE |
Writes JSON with checks, failing, and warning. The table still prints to stdout. |
--fail-on {fail,warn} |
The default fail exits 1 if any check is FAIL. Use warn to also exit 1 on WARN. A report below the selected threshold exits 0. |
--trust-remote-code |
For a checkpoint whose config needs its own Python, review that code before opting in. The flag requires GPTQ_BYPASS_SAFETY_CHECKS=1. |
If a missing runtime dependency raises ImportError during startup, the installed console script reports it and exits 2. python -m gptqmodel doctor uses the same checks after the package imports successfully. Use the JSON file for automation because package startup can write logs to stdout. CLI reference
For package metadata and an independent Torch device check, use:
python -m pip check
python -m pip show GPTQModel torch transformers tokenicer optimum
python - <<'PY'
import importlib.metadata as metadata
import platform
import torch
print("Python:", platform.python_version())
for name in ("GPTQModel", "torch", "transformers", "tokenicer",
"optimum", "bitblas", "triton", "vllm", "sglang"):
try:
print(name, metadata.version(name))
except metadata.PackageNotFoundError:
print(name, "not installed")
print("Torch CUDA:", torch.version.cuda, "Torch HIP:", torch.version.hip)
print("CUDA API available:", torch.cuda.is_available())
for i in range(torch.cuda.device_count()):
print(i, torch.cuda.get_device_name(i), torch.cuda.get_device_capability(i))
PYOn ROCm, PyTorch exposes AMD devices through its torch.cuda API. This report's CUDA API availability is not evidence of an NVIDIA GPU; include torch.version.hip and actual device names. For XPU/MPS/NPU, report that platform's availability and devices separately.
Reading the diagram: Lanes are independent diagnoses. Workspace budgets are not total-memory caps; an inference export is not a resume checkpoint.
Text version of the workflow
- Import or JIT failure: Record the environment → Identify the extension → Fix the first failure → Retry the affected path.
- Kernel selection failure: Read saved metadata → Resolve the device → Check kernel contracts → Choose a valid backend.
- Quantization OOM: Locate the stage → Inspect live memory → Bound relevant work → Retry and validate.
- Interrupted quantization: Reload the source → Verify resume identity → Restore committed state → Finish, then export.
METHOD identifies the quantization family. FORMAT identifies the saved tensor layout. BACKEND selects execution. The selector normalizes legacy backend names with the method, validates candidate qlinear classes, and applies auto-selection priorities. It does not reinterpret arbitrary packed tensors as another format.
For a supported device family, qlinear validation now preserves the kernel's specific rejection reason (for example compute capability or a missing kernel image) instead of replacing it with a generic device mismatch. Unsupported families retain a concise family error without repeating the same sentence. Use the detailed reason to distinguish hardware limits from build/runtime problems; the diagnostic change does not enable new devices.
The following is a focused compatibility reference from class declarations, not a complete substitute for shape/device/dtype/packing/runtime validation:
| GPTQ backend | Bits | group_size |
desc_act |
sym |
Device / activation dtype |
|---|---|---|---|---|---|
MARLIN |
4, 8 | -1, 32, 64, 128 | False, True | True only | Linux, NVIDIA CUDA compute capability 8.0 or newer, FP16/BF16, and compatible layer shapes. |
GPTQ_EXLLAMAV2 |
4 | -1, 32, 64, 128 | False, True | False, True | CUDA; FP16/BF16/FP32 activations and outputs, FP16 scales. Source excludes ROCm because of accuracy issues. |
GPTQ_TRITON |
2, 4, 8 | -1, 16, 32, 64, 128, 256, 512, 1024 | False, True | False, True | CUDA; FP16/BF16. XPU is not declared supported by this class. |
GPTQ_BITBLAS |
2, 4, 8 | -1, 32, 64, 128 | False only | False, True | CUDA; FP16/BF16, with BitBLAS dependency/runtime checks. |
All four declare GPTQ/GPTQ_V2 format support; Marlin also declares legacy MARLIN, and BitBLAS declares BITBLAS. Their declaration of a format does not mean all are valid raw quantization packers.
Examples outside GPTQ:
| Class / family | Bits and groups | Ordering/symmetry | Important constraints |
|---|---|---|---|
AwqGEMMLinear / GEMM |
4; -1,16,32,64,128 | Both declared values | CUDA; FP16/BF16. |
AwqGEMVLinear / GEMV |
4; -1,64,128 | Both declared values | Native CUDA only; FP16. On ROCm explicitly choose BACKEND.AWQ_GEMV_TRITON for a compatible GEMV checkpoint, or use a GEMM checkpoint with AUTO/AWQ_GEMM_TRITON. AUTO does not switch GEMV to Triton. |
AwqGEMVTritonLinear / GEMV |
4; normalized 64,128 (-1 only when K resolves accordingly) |
Both declared values | Explicit-only Linux CUDA/ROCm; FP16 compute, INT32 storage, N divisible by 8, no auto-padding. Not a GEMV_FAST/LLM_AWQ reader. |
| AWQ GEMV_FAST / LLM_AWQ | 4; 128 | Both declared values | FP16, INT16 packing, K/N divisible by 64/128. NVIDIA CUDA can use AWQ_GEMV_FAST. CPU or ROCm can use AUTO or explicit AWQ_TORCH with the portable reader for the saved format. |
QQQLinear / QQQ |
4; -1,128 |
desc_act=False, sym=True
|
Linux NVIDIA CUDA, capability at least 8.0, FP16 and BF16. Use QQQ_TORCH or AUTO for FP32 activations. ROCm also uses the portable QQQTorchLinear. |
| Parameter | Meaning and practical implication |
|---|---|
group_size |
Grouping of quantization parameters; -1 is the channel-wide grouping convention. Backend support lists are discrete. 128 is not universally interchangeable with 64, nor can a saved checkpoint be changed by editing JSON. |
sym |
Symmetric versus asymmetric quantization/zero-point semantics. GPTQ Marlin accepts asymmetric weights only without effective activation order. |
desc_act |
GPTQ activation-order handling and associated indexing/permutation requirements. A kernel that does not support it cannot be fixed by relabeling the metadata. |
Current base config defaults are bits=4, group_size=128, sym=True, and desc_act=None before concrete-class normalization. GPTQConfig.default_desc_act() resolves it to false. GPTQ's act_group_aware defaults to true and cannot be true together with desc_act=True; explicitly enabling desc_act with no explicit act_group_aware automatically disables the latter with a warning. Both explicitly true raises.
When diagnosing selection, include dimensions, activation dtype, packing dtype, dynamic overrides, adapters/training, format, platform, and optional-package availability. “Four-bit CUDA” is insufficient. For a controlled isolation, try BACKEND.AUTO and then a documented compatible explicit backend without modifying checkpoint metadata. See Inference Backends and Kernel Backends Reference.
Quantization works with original weights, forward activations, method-specific statistics, temporary solver tensors, packing buffers, and sometimes multiple devices/replicas. Inference checkpoint size is not a peak-quantization-memory estimate. Identify the stage from the traceback and optional timing/Hessian/telemetry logs before choosing a remedy.
For a very wide projection, a single Hessian/factor/workspace request can fail with substantial free VRAM, including cuMemSetAccess OOMs under expandable segments. Try PYTORCH_ALLOC_CONF=backend:cudaMallocAsync python quantize.py before process startup. The backend is opt-in and does not support memory snapshots/history; see wide-layer allocator guidance.
| Setting | Actual default | Diagnostic action |
|---|---|---|
CalibrationConfig.batch_size |
1 |
Reduce a larger batch to one. Models that disallow batch quantization force one. |
CalibrationConfig.concat_size |
None |
Bound calibration sequence construction deliberately; changing it changes calibration data/quality and checkpoint identity. |
CalibrationConfig.sort |
"desc" |
Sort supports asc, desc, shuffle; ordering affects scheduling and checkpoint calibration identity. |
CalibrationConfig.min_length |
10 |
Filters short examples; not a peak-memory limit. |
offload_to_disk |
True |
Keep enabled for the supported disk-offload lifecycle; use a writable disk with sufficient capacity. Required for checkpointing. |
offload_to_disk_path |
None before normalization |
Auto-generated when offload is enabled and no path was provided. Use explicit durable paths for deliberate operational control. |
calibration_data_device |
None |
Review whether retained calibration is consuming scarce accelerator memory. |
auto_forward_data_parallel |
True |
Review multi-device forward replicas and memory use; disable for a controlled single-device diagnosis. |
dense_vram_strategy |
VramStrategy.EXCLUSIVE |
exclusive and balanced are valid strategies; choose intentionally for the dense pool rather than assuming another GPU's free memory is automatically available. |
wait_for_submodule_finalizers |
False |
Waiting for packing/offload finalizers before advancing can reduce overlap-related VRAM pressure. |
HessianConfig.chunk_size, chunk_bytes
|
None, None
|
Bound GPTQ Hessian staging chunks. They do not remove the full method's statistics/solver requirements. |
HessianConfig.staging_dtype |
torch.float32 |
FP16/BF16 are accepted, but lower staging precision can change numerical results. Validate quality rather than treating it as free compression. |
HessianConfig.dedup_shared_inputs |
True |
Capture explicitly tagged shared-input Hessians once; requires correct model-tree shared-input declarations. |
MSEConfig.grid_budget, clip_grid_budget
|
None, None; each resolves to 16 MiB on CPU or 256 MiB on other devices |
Chunk-sizing targets for GPTQ/QQQ MSE shrink-grid scratch and AWQ clipping scratch respectively. Accept nonnegative byte integers or strings such as "64M", "1G"; 0 selects single-candidate chunks and, for AWQ, one-token product tiles. These are not total-memory caps: multiple scratch buffers or even a minimum tile can exceed one budget. |
AWQConfig.scale_search_chunked_activations |
True |
Stream/chunk the AWQ scale-search activation work rather than retaining full reference/reconstruction activation working sets. Separate from clip-grid workspace control. |
For example, this configuration uses real fields while leaving model selection and calibration to the application:
from gptqmodel import CalibrationConfig, GPTQConfig
from gptqmodel.quantization.config import HessianConfig, VramStrategy
quant_config = GPTQConfig(
bits=4,
group_size=128,
offload_to_disk=True,
offload_to_disk_path="offload/my-run",
auto_forward_data_parallel=False,
dense_vram_strategy=VramStrategy.EXCLUSIVE,
hessian=HessianConfig(chunk_bytes=64 * 1024 * 1024),
)
# Load the original model with this configuration, then use:
# model.quantize(CalibrationConfig(dataset=calibration_dataset, batch_size=1))64 MiB here is an example staging budget, not a source default or a total VRAM cap. Reducing sample count/length is another resource tradeoff, but changes calibration and possibly quality. Do not silently change data when retrying a checkpointed job.
For a GPTQ or QQQ shrink-grid workspace failure, lower MSEConfig.grid_budget and preserve your chosen norm. For example, MSEConfig(norm=2.4, grid_budget="64M") keeps a recipe's existing exponent of 2.4. For an AWQ clipping-workspace failure, use MSEConfig(clip_grid_budget="64M") in the AWQ config.
Also check other processes, device visibility, host RAM/disk pressure, unexpected replicas, and stale application references. PYTORCH_ALLOC_CONF=expandable_segments:True may help supporting NVIDIA builds; it cannot solve an oversized live working set and is deliberately not enabled by default on ROCm because of observed corruption after cache release. torch.cuda.empty_cache() cannot free tensors still referenced by your program. Completed device-worker tasks and StopForward capture tracebacks now release their own references instead of pinning the last layer replica/intermediates.
The loader disables offload_to_disk for the xielu activation construction path because activation initialization reads weights. Inspect the effective normalized config when diagnosing source-model memory use. Loader implementation
If allocated VRAM grows layer by layer on a secondary GPU during MoE quantization, check whether your checkout includes the forward-replica cleanup fix. Earlier revisions could keep finished layer copies alive until Python's cyclic garbage collector ran. Setting auto_forward_data_parallel=False isolates replica memory pressure on an affected checkout. See how the forward executor releases replicas.
See Memory Offload and Multi-GPU and Quantization Lifecycle.
Set visibility before importing Torch/GPT-QModel. After CUDA_VISIBLE_DEVICES=2, the visible physical GPU is generally logical cuda:0, not cuda:2. Use the logical device indices visible inside the process when constructing maps. Avoid changing visibility midway through a job or between checkpoint attempts.
Use device= for a device or pool and placement= for explicit inference rules. Integer device values resolve in the active accelerator namespace (CUDA or ROCm, XPU, or NPU). Without an active accelerator they raise. For placement and backend errors, check the resolved execution devices and their exact logical ordinals. See device placement.
| Problem | Explanation / action |
|---|---|
| Several GPU families in one map | Importer validation rejects maps spanning different accelerator families. CPU offload plus one accelerator family is not equivalent to combining CUDA/XPU/MPS/NPU families. |
| Different GPU compute capabilities in one map | The selector rejects heterogeneous probed capability tuples, including NVIDIA SM versions. HIP's synthetic SM tuple is excluded; AMD-specific kernels must validate each target's supported architecture instead. For AllSpark, every selected GPU must be gfx1200/gfx1201; on a mixed AMD host, explicitly select eligible indexed devices. |
| ROCm shown as CUDA in Torch | Expected API convention. normalize_device() maps HIP cuda strings/Torch devices/ordinals and DEVICE.CUDA to DEVICE.ROCM; AMD stays explicit in config/kernel support, then resolves back to Torch cuda at runtime boundaries. Do not select GPTQ_TRITON or W4A FP8/NVFP4 from CUDA availability or HIP's synthetic SM version. EXL3 AUTO can select native HIP on gfx1200/gfx1201; use BACKEND.EXL3_TORCH to bypass the extension. |
ROCm exit 139 inside hipMemcpyPeerAsync, or unexpected host staging |
Check directed peer capability and torch.cuda.get_allocator_backend(). On the native allocator, GPT-QModel delegates peer enablement to PyTorch and validates direct Tensor.copy_; raw runtime copies are withheld, even when expandable segments are disabled. Non-native ROCm (cudaMallocAsync) degrades every cross-device pair and stages covered moves through pinned host memory because even a same-device copy failed in the tested configuration. Configure P2PConfig through QuantizeConfig(p2p=...) or GPTQModel.load(..., p2p=...); mode="on" cannot override allocator safety or make denied directions safe. NCCL_P2P_DISABLE=1 does not disable ordinary Torch copies. GPT-QModel's sharded inference hooks can still use ordinary Torch copies for activations. Use single-device inference on affected topologies. See P2P safety and probe controls. |
| CPU fallback unexpectedly used | Inspect requested versus AUTO backend, optional import failures, actual tensor placement and device validation. |
| Wrong ordinal after masking | Report original visibility variables and in-process enumerated names/capabilities. |
| Explicit GPU list still uses excluded devices | For source quantization, use a list/tuple such as device=("cuda:1", "cuda:2") and leave quantize_config.device and compute_device_filter unset for automatic filtering. Existing filters are preserved. Older revisions expanded the list to all visible GPUs; see specific GPU selection. |
| Native QQQ fails on a non-current CUDA device | Current dispatch guards the activation tensor's CUDA context and restores the caller's device. Upgrade older revisions that could produce NaNs/illegal accesses in sharded inference; this does not relax QQQ's kernel requirements. See QQQ. |
| Unsupported NPU or XPU operation | Check the selected qlinear class and platform API support. hw/ascend_npu.md lists missing CUDA-equivalent capability/memory APIs. |
| Optimizer CLI waits for GPU |
optimize/_common.py has GPU allocation/idle-gate behavior beyond normal model loading. Check CLI arguments and allocator availability. |
CUDA_DEVICE_ORDER and allocator defaults preserve existing nonempty user values. Allocator defaults are now installed before package submodule imports, with a best-effort runtime update if native CUDA was already initialized. Explicit process-start environment remains more reliable than import side effects, especially when choosing a different allocator backend.
The current checkpoint config is a frozen dataclass with these public fields/defaults:
@dataclass(frozen=True)
class CheckpointConfig:
path: str | Path = "auto"
resume: str = "auto"
interval: str = "layer:1"
keep_last: int = 2
strict_device_check: bool = TrueThe implementation additionally maintains an internal non-init _resolved_path; the fields above are the public initialization fields. Do not assign to fields after construction; create a new config for changed settings. Changing settings can still invalidate an existing checkpoint's identity.
| Field | Validation / meaning |
|---|---|
path |
Nonempty path or "auto". Automatic location is derived from the existing offload path and retained on that config; use an explicit durable root across freshly loaded model/config objects. |
resume="auto" |
Start if no published checkpoint exists; resume compatible progress; incompatible/corrupt published progress is an error, not silent restart. |
resume="required" |
Require a compatible published checkpoint. |
resume="never" |
Refuse a published checkpoint; use a new path for a deliberate fresh run. |
interval |
layer:<positive integer> only, not seconds or arbitrary strings. |
keep_last |
Integer at least two; retained published generations, not a cap on all attempt directories. |
strict_device_check |
Boolean; false relaxes physical UUID/serial matching only, not GPU count/order/type, algorithm/data, or other identity checks. |
This pattern follows the repository's checkpoint.md; model_id and calibration_dataset must be the same original source/data on every attempt:
from gptqmodel import CalibrationConfig, CheckpointConfig, CheckpointStopped, GPTQConfig, GPTQModel
quant_config = GPTQConfig(bits=4, group_size=128, offload_to_disk=True)
model = GPTQModel.load(model_id, quant_config)
try:
model.quantize(
CalibrationConfig(dataset=calibration_dataset, batch_size=1),
checkpoint=CheckpointConfig(
path="checkpoints/my-run",
resume="auto",
interval="layer:1",
keep_last=2,
),
)
except CheckpointStopped:
raise SystemExit(75)
model.save("quantized-output")Do not save a final model from the stop handler. Reload the original model and resume, then save only after normal completion. A checkpoint directory is not an exported model and an attempt-* directory is not the original source.
For QQQ restore failures involving QQQLinear._get_perms(), tolist(), or a meta permutation tensor, current source constructs fixed permutation metadata on CPU before loading packed weights. Upgrade older revisions; do not change checkpoint codes or scales to work around missing metadata. See QQQ checkpoint restore.
looper/gptq_checkpoint.py lists model types llama, qwen2, and qwen3_moe in CHECKPOINT_MODEL_TYPES; Qwen2 sources may have tied or untied word embeddings. Unsupported model types raise an error listing the supported set and the requested type. Exact processor chains are GPTQ, AWQ, QQQ, or Paro, each alone or followed by EoRA; weight-only alone; and EXL3's own processor alone. A method enum alone does not guarantee that its chosen processor chain has a continuation adapter.
Checkpointing requires:
-
offload_to_disk=True, sequential quantization, Python main thread for signals, and a local safetensors source model. - No GPTAQ/FOEM, rotation preprocessing, embedding/lm-head quantization, or unsupported adapter types. Supported adapter handling is specifically the checked LoRA type and processor chains. Ordered
dynamicoverrides/exclusions are supported, provided the same configuration and calibration are supplied on resume: each packed module retains its resolved settings and winning rule, and runtime exclusions are restored rather than reinterpreted as a different run. - The same source/configuration/calibration/runtime/packing/execution topology identity on resume.
Source safetensors and config are hashed. Calibration is prepared again and checked; completed transformer layers are not replayed merely to validate identity. Physical GPU checks are only one portion of identity. Using strict_device_check=False is not a general “ignore compatibility” flag.
| Event / artifact | Behavior |
|---|---|
SIGINT / Ctrl+C or SIGTERM
|
Request a safe stop; finish current layer/finalizers, publish checkpoint, raise CheckpointStopped. Not immediate cancellation. |
SIGKILL, crash, host failure |
Only the previously published generation survives; later work is repeated. |
| Partial layer/subset | Re-run the uncommitted layer; partial Hessians are not resumed. |
| Ordinary exception | No partial-layer checkpoint is synthesized. |
CURRENT |
Atomically publishes retained generations; recovery does not scan unpublished directories and guess. |
objects/ |
Content-addressed continuation/tensor objects, SHA-256 verified on recovery. |
writer.lock |
One writer per root; separate concurrent jobs need separate roots. |
| Damaged newest generation | Try retained generations newest to oldest; fail if none is complete. |
Use a local filesystem supporting file locks, atomic rename and file/directory fsync. Object stores or network filesystems lacking those semantics do not provide the documented durability. Do not edit source weights, CURRENT, manifests, objects or attempts during a run.
For an incompatible-checkpoint error, restore the accidental difference or use a new checkpoint path for an intentional change. For corruption, preserve the root and restore a backup or start elsewhere if no retained complete generation exists. keep_last does not remove every private offload attempt; storage can remain large across retries. Remove the root only after a successful final save and when live quantization objects no longer need it.
For extra diagnostics, TelemetryConfig(device=True) records checkpoint preparation/validation/capture/commit/restore/failure metadata without tensor contents. Telemetry is excluded from algorithm identity, so it can be enabled just for a resume diagnosis. See checkpoint.md for the complete operational guide.
For recent fixes, regenerate affected quantization artifacts rather than expecting old packed weights to change on reload: AWQ retunes nondivisible group sizes and stabilizes offset-gain folds; QQQ's default damping is now 0.05; staged GSQ widens sensitive arithmetic; GPTAQ/FOEM stop pairing mismatched routed-expert activations. For cross-process ROCm variation, import GPT-QModel before the first BLAS call and check the explicit BLAS/allocator settings above. See the method pages for scope and exact defaults.
Before changing quantization settings, run the original dense model with the same tokenizer, template, calibration/evaluation tasks, sequence lengths, generation settings and dependency versions. Compare exact rendered prompt text, input IDs, attention masks, special tokens and template behavior as well as scores.
Reusable tokenizer/chat-template corrections belong in Tokenicer. AGENTS.md explicitly rejects accumulating GPT-QModel loader workarounds to avoid fixing that dependency. Task-specific few-shot/evaluation formatting belongs to the evaluator rather than a tokenizer normalization shim.
For kernel numerical reports, distinguish arithmetic error from final FP16/BF16 rounding, and identify both the kernel actually executed and the independent reference. A low perplexity score alone does not validate packing, every activation dtype, or fallback correctness. See Evaluation and Developer Guide.
The shared GPTQ PackableQuantLinear.pack_block(), pack_gpu(), and pack_original() paths reject scales that cannot survive their FP16 checkpoint cast. A ValueError such as layer.q_proj.scales: ... scale value(s) cannot be stored as fp16 identifies the tensor and reports separate source nonfinite, cast overflow, and cast underflow counts. This prevents silently saving nonfinite scales or erasing weights with a nonzero scale rounded to zero.
Inspect the named module's source weights and scales first. BF16/FP32 source weights can legitimately span a wider range, but changing the model dtype does not widen these stored scales. The check uses the cast result: FP32 65505 still rounds to finite FP16 65504, while 65520 overflows; 2**-25 rounds to zero, while the next higher FP32 value survives as 2**-24. Ordinary finite rounding and exact zero are not rejected by this storage guard.
Do not suppress the error, clamp a scale, or edit checkpoint scale tensors without recomputing matching codes. This is a representation limit, not an OOM or kernel-build failure, and the same guard applies to all three shared pack paths. It is not a universal rule for every method's scale dtype; Torch AWQ preserves source scale precision separately. See GPTQ's scale-storage contract and the source guide.
Use these references after locating the failure stage. Preserve the original logs; cache deletion and broad dependency upgrades can erase the evidence you need.
Preserve the first compiler, missing-header, linker, import, or missing-operator error. A later “kernel unavailable” or “using fallback path” line may only be the consequence. Record:
- Python executable/version, Torch version,
torch.version.cuda/torch.version.hip, compiler/toolkit version, driver, GPU/capability. - The extension name, requested activation dtype and backend.
- Cache/build root, relevant overrides, target architectures, and write permissions.
- Whether the same failure occurs in a fresh process with one supported visible GPU.
The common loader logs extension build diagnostics including base/actual root, Python/PID, TORCH_EXTENSIONS_DIR, GPTQMODEL_TORCH_EXTENSIONS_DIR, candidate binaries and build entries. It also reports resolved ninja/cmake executable paths and version probes, or <not on PATH>. When CONDA_PREFIX is set, PATH_hint identifies a missing environment bin (Windows Scripts) directory and an installed Ninja there. For Ninja is required to load C++ extensions, install Ninja or add that environment directory to PATH in the shell launching Python; do not treat it as a GPU numerical failure. CPU, CUDA and HIP source sets are not interchangeable.
The public named extension API in gptqmodel/extension.py includes these exact signatures:
def available_extensions() -> tuple[str, ...]:
def is_available(name: str, *, use_cache: bool = True) -> bool:
def error(name: str) -> str:
def load(name: str = "all", *, use_cache: bool = True) -> dict[str, bool]:These are signature-only reference lines, not a runnable block of function definitions. Load one extension to isolate its diagnostics:
GPTQMODEL_EXT_VERBOSE=1 python - <<'PY'
from gptqmodel import extension
print(extension.available_extensions())
try:
print(extension.load("marlin_fp16"))
finally:
print(extension.error("marlin_fp16"))
PYis_available() can load/JIT; it is not a zero-work static package probe. marlin is a group name for the FP16 and BF16 extensions, while availability/error/operator queries target concrete names. load() raises if a selected extension fails. use_cache=False clears cached build artifacts only before the library is loaded into the current interpreter; afterward it raises and requires restarting Python. It does not change the module's supported hardware.
For one diagnostic rebuild:
GPTQMODEL_KERNEL_REBUILD=1 GPTQMODEL_EXT_VERBOSE=1 python - <<'PY'
from gptqmodel import extension
try:
print(extension.load("marlin_fp16"))
finally:
print(extension.error("marlin_fp16"))
PYDo not delete shared build directories while other processes are compiling/loading them. The shared loader serializes cross-process builds with an OS lock; exiting/killing a process releases that lock. A timeout can mean another legitimate build is still running. Increase the timeout only after inspecting the owner/workload; arbitrarily removing a lock file can defeat synchronization.
A populated read-only cache can serve matching Torch ops binaries and current generated sources for Marlin and Machete without taking a build or generation lock. If a required artifact is missing or a rebuild is requested, use a writable cache root. See build and cache settings.
Torch 2.13 and later can automatically compile through ccache or sccache found on PATH. Use sccache 0.18.0 or later for JIT kernel builds. With CUDA 13.3 and later, older sccache drops device-compilation steps and can leave fatbinary reporting a missing .cubin. Check the installed version with sccache --version. Set the launcher policy with RuntimeConfig.compiler_cache.
| Value | Build behavior |
|---|---|
None (default) |
Skip sccache older than 0.18.0 or whose version cannot be read. Use an allowed launcher and, if that build fails, retry once with the launcher disabled. |
False |
Disable the compiler launcher for the build. |
True |
Use Torch's launcher with a single build attempt, including an older sccache. Torch's own TORCH_NO_COMPILER_WRAPPER=1 still disables the launcher. |
from gptqmodel import GPTQModel
from gptqmodel.backend import RuntimeConfig
model = GPTQModel.load(
"path/to/quantized-model",
runtime=RuntimeConfig(compiler_cache=False),
)The shared Torch ops loader records a failed build in .gptqmodel_build_failed.json inside that kernel's cache directory. Later processes reuse the recorded failure and take the fallback immediately. The record expires after 24 hours and is ignored when the tracked toolchain, PATH, compiler/toolkit environment, or launcher policy changes. After fixing a build problem, use the one-off rebuild command in a fresh process to retry immediately. GPTQMODEL_KERNEL_REBUILD=1 or the extension's logged *_FORCE_REBUILD setting bypasses the record. A successful build clears it.
On older Torch builds using FileBaton, the shared loader removes a leftover Torch build-lock file while holding its cross-process lock. Torch 2.14+ leaves an inert lock file after normal builds, which the loader preserves. See the JIT build reference and loader implementation.
| Error category | Action |
|---|---|
| Compiler/Ninja absent or C++ standard unsupported | Check the active environment and compiler/toolkit installation. The package requires Ninja, but it does not ship a complete host C++ compiler or NVCC/HIP compiler. Shared JIT flags select C++20 for Torch at least 2.14 and C++17 for older Torch; check the first compiler error against that requirement. |
| Wrong CUDA/HIP/toolkit | Align the active Torch build with the intended compiler/toolkit. Do not repair a CUDA build by pointing at a ROCm directory or vice versa. |
| Missing runtime/cuBLAS/cuSPARSE/cuSOLVER headers | Use the matching package extra/toolkit; see Marlin below. Runtime availability alone does not prove headers are installed. |
| Unsupported GPU target | Inspect compute capability and actual kernel support. A manual TORCH_CUDA_ARCH_LIST is a build request, not an emulation layer. |
| Undefined symbol or incompatible cached binary | Capture the symbol and environment versions, then rebuild the affected extension in a new process with matching Torch/toolchain/ABI. Shared JIT fingerprints help separate incompatible builds but cannot validate an arbitrary user-supplied prebuilt binary. |
| Permission/disk failure | Select a writable, sufficiently large cache root; preserve build logs before cleanup. |
| Build OOM | Reduce external build concurrency or target breadth as appropriate and inspect host RAM. NVCC_THREADS controls compiler threads, not quantization batch size or all Ninja concurrency. |
| Optional extension fails but program continues | Determine which fallback actually ran and whether its performance/device/format is suitable; a warning is not proof the requested accelerated kernel executed. |
The shared JIT resolver supports pip development wheels, explicit ROCM_PATH / HIP_PATH / Torch ROCM_HOME, versioned /opt/rocm/core-* SDKs, legacy /opt/rocm, and /usr, in that order. Within versioned SDKs it prefers the full/major-minor version reported by torch.version.rocm before other numeric versions. A sparse _rocm_sdk_core wheel containing HIP headers is not a complete development SDK.
The resolver chooses one root with both development headers and the unversioned HIP library so include/link flags do not mix SDK versions. It derives -I root/include and -L root/lib from that root. If no complete root exists, a header-only fallback does not add -L from an unrelated library-only SDK. Device bitcode is resolved separately: ROCM_HOME is preferred, then only the selected complete toolkit root supplying lib/llvm/amdgcn/bitcode/hip.bc; an unrelated bitcode-only SDK is ignored. The selected directory supplies --rocm-device-lib-path. The Tenstorrent block-float HIP loader uses these shared flags rather than prepending a separate legacy --rocm-path / -L. TheRock's hipcc does not translate ROCM_PATH/HIP_PATH into --rocm-path, so setting an environment root alone is insufficient. If artifacts are missing, install/initialize the matching development SDK rather than borrowing headers from another version. See ROCm JIT toolkit discovery.
A compiled model can retrace on later calls when Dynamo guards change. A call through GPT-QModel's compiled wrapper that may trace can wait for an in-flight GPT-QModel forward or generation, or for another load's guarded Transformers initialization. The guard prevents the tracing error NameError: module is not installed as a submodule in concurrent GPT-QModel forwards. Once a graph is cached, calls that reuse it can overlap with eager inference. See concurrent loading and inference.
torch.compile() is lazy: its wrapper can be created successfully and fail on the first model call. GPT-QModel's shared torch_compile() wrapper catches classified Dynamo/Inductor/compiler-worker failures at that invocation, logs the failure, releases the compiled callable, and uses eager execution on that call and subsequent calls. It does not repeatedly retry the compiler. Direct exceptions from user code still propagate. BackendCompilerFailed/TorchRuntimeError are eligible even with fullgraph=True; other capture failures fail closed in fullgraph mode. Without fullgraph, the wrapper also recognizes Dynamo exception chains and a narrow compiler-origin fallback: RuntimeError, or Dynamo's specific Guard failed on the same frame it was created assertion. A compiler-package frame alone does not justify swallowing ValueError or unrelated AssertionError. Eager fallback remains packed between operations; it does not retain dense weights. See the decision contract.
QuantizeConfig(compile=False) disables the Torch kernel's dequantization compiler when layers are created from that config; the default is True. This field is runtime-only and is not saved into checkpoint metadata. The lower-level Torch layer constructor also accepts compile=False. The generic GPTQModel.load() API does not expose a dedicated compile keyword, so do not assume an arbitrary load keyword changes this config. For a process-wide Torch switch before importing/loading, use TORCHDYNAMO_DISABLE=1. Successful eager inference does not prove the compiler/toolchain was repaired. See compile fallback and its exception boundaries.
Native Transformers static-cache generation can trigger compilation even when quantized kernels break the graph at each linear. GPT-QModel now defaults that call to disable_compile=True when any selected kernel has SUPPORTS_COMPILE=False; the static cache remains enabled. Explicit caller choices override this policy. Compare generate(..., cache_implementation="static", disable_compile=True) with your current call; use disable_compile=False only to deliberately allow compilation. The wrapper does not mutate a supplied generation config when applying its default. See generation compile policy.
SUPPORTS_COMPILE_LEVEL describes trace/compile capability and SUPPORTS_GRAPH_CAPTURE describes eager CUDA-graph capture. Neither alone promises faster generation or capture of a whole model. Check the selected classes and their capability declarations. These controls are separate from the Torch kernel's QuantizeConfig(compile=False) dequantization setting above.
Use a fresh process for native TTNN if PJRT has already queried/claimed the chips; the two runtimes cannot own the same device. Explicit BACKEND.GPTQ_TTNN avoids the PJRT probe in device resolution. Call model.release_device() when finished with a native model. Use the dedicated CPython 3.12 installation rather than resolving TT PJRT against the base Torch floor. Native block-float loading is a separate CPU reconstruction route that preserves checkpoint dtype; its CUDA/ROCm kernels emulate TT formats and do not establish native TTNN support. See Tenstorrent.
GPTQ and AWQ Marlin validate the target NVIDIA GPU and require compute capability 8.0 or newer. On Turing (sm_75), use BACKEND.AUTO to select a compatible kernel for an ordinary GPTQ or AWQ checkpoint.
FP16 and BF16 use separate extensions and build roots. GPTQ Marlin supports 4/8-bit weights with group sizes -1, 32, 64, 128, subject to device and shape checks. Packed K/N dimensions must be divisible by 32 // bits. Effective activation-order weights require symmetric quantization and aligned thread tiles. For asymmetric GPTQ with effective activation order, use AUTO on an ordinary GPTQ checkpoint or choose a compatible non-Marlin backend.
AUTO and AUTO_TRAINABLE deliberately reject Marlin's tile-misaligned shapes so selection can try another backend. Explicit MARLIN can enable runtime tile padding for otherwise valid non-activation-ordered shapes. Padding does not waive packing divisibility, group boundaries, dtype, hardware, or other validation requirements. desc_act=True with a single group (group_size=-1 or group_size=in_features) is treated as no effective activation ordering.
MarlinConfig(fp32=True) is the default for the GPTQ Marlin class; the legacy field is KernelConfig.marlin_fp32. Disabling it changes reduction precision; first reproduce with the default before attributing numerical differences to weight quantization.
For missing CUDA headers, the source's install hint selects:
| Torch CUDA major | Extra | Dependencies at this revision |
|---|---|---|
| 12 | marlin-cuda12 |
Runtime 12.9.79, cuBLAS 12.9.2.10, cuSPARSE 12.5.10.65, cuSOLVER 11.7.5.82 CUDA-12 wheels. |
| 13 or later | marlin-cuda |
nvidia-cuda-runtime>=13.2, nvidia-cublas>=13.4, nvidia-cusparse>=12.7, nvidia-cusolver>=12.2. |
For example, choose the one matching the active Torch CUDA build, not both blindly:
python -m pip install 'gptqmodel[marlin-cuda12]'The wheels provide headers/libraries, not a general replacement for NVCC and the host compiler. Repeated compilation can also result from GPTQMODEL_KERNEL_REBUILD=1, GPTQMODEL_MARLIN_FORCE_REBUILD=1, changing fingerprints/toolchains, nonpersistent caches, or unwritable build directories.
Do not select format="marlin" for new quantization. BaseQModel.quantize() rejects this deprecated export format; use a compatible GPTQ checkpoint and select/allow the Marlin inference backend.
The bitblas extra was withdrawn. BitBLAS 0.1.0.post1 bundles TVM linked against libnvrtc.so.12, which causes the import to fail on CUDA 13-only systems. For a compatible standard GPTQ checkpoint, select BACKEND.GPTQ_TORCH or BACKEND.MARLIN. For a compatible AWQ checkpoint, select BACKEND.AWQ_TORCH or an eligible AWQ CUDA backend. See format-specific loader branches for artifacts already serialized in BitBLAS format.
For an existing BitBLAS environment, the probe catches import errors, attempts to preload CUDA libraries when the error mentions libcu, retries the import, and checks for a minimum version of 0.1.0.post1. Unavailability errors report the probe failure when available.
Pass kernel={"disable_bitblas": True} through the quantization/load API to skip unstable BitBLAS probing and try another compatible backend. This does not make explicit BitBLAS selection succeed; it marks BitBLAS unavailable.
The GPTQ BitBLAS class supports desc_act=False, bits 2/4/8, group sizes -1/32/64/128, and both symmetry values. It does not support activation-order GPTQ just because another backend does.
Initialization writes TVM_TARGET from its normalized detection and uses a database path suffixed with the BitBLAS version. This revision caps the normalized target SM at 90, logging a compatibility fallback on newer architectures. That fallback is not proof that every newer GPU executes correctly; include the target and GPU in reports.
GPTQ checkpoint repacking disables expensive tuning by default unless BITBLAS_ENABLE_TUNING explicitly enables it. A native serialized/non-repack load defaults differently. Distinguish import, compilation, target selection, repack, database access, and tuning time when reporting an apparent hang.
Remote code executes code supplied by a model repository. Enable it only after reviewing and trusting that repository/revision; do not automatically retry every failure with trust enabled.
GPT-QModel model types resolve to their bundled implementation before any Transformers native-support probe. An “overriding trust_remote_code=True to False” warning means a native Transformers causal-LM implementation was found and selected. See implementation selection.
| Symptom | Action |
|---|---|
| Config/model type unknown to Transformers | Check the model's required Transformers version, actual installed version and remote-code requirements; include config model type and traceback. |
| Remote code imports missing dependencies | Install the model's documented dependencies in the same environment, or use native support when available. |
| Ling-2.6-flash loads the wrong layout | Use GPTQModel.load() with the Bailing port. The port selects its MLA or hybrid layout from the checkpoint configuration. See supported Bailing layouts. |
| Checkpoint remote code fails on Transformers 5.23 (for example, a missing legacy cache method) | GPT-QModel no longer installs Transformers 5.x compatibility shims. Supported models load through their package-owned port regardless of trust_remote_code. Unsupported checkpoint Python runs unmodified and needs both trust_remote_code=True and GPTQ_BYPASS_SAFETY_CHECKS=1; see checkpoint Python. |
Wrapper attribute lookup raises RecursionError during initialization |
Use a GPT-QModel revision containing the BaseQModel.__getattr__ fix. It reads the optional _modules container directly from __dict__, so a wrapper without an initialized module container raises the original missing-attribute error instead of re-entering the hook. Wrapped-model attribute forwarding is preserved. |
| Trust error on a local model directory | Local paths can still reference HF dynamic modules through config auto_map; local storage is not a guarantee of no custom code. |
UnsafeModelArtifactError or a checkpoint path error |
Check the file and reason in the exception. Compare the GGUF, tokenizer or processor metadata, or shard index with the original publisher's trusted revision. Replace incomplete or invalid files with a verified copy. The artifact checks remain active when checkpoint Python is permitted. |
| Tokenizer/template mismatch after load | Establish prompt/input-ID baseline and follow Tokenicer ownership rules below; trust is not a tokenizer-normalization fix. |
| Model version-dependent loader error |
loader.py calls check_versions(cls, cls.require_pkgs) for model-definition package constraints. Follow the concrete required package/version, not a generic downgrade recipe. |
See Hugging Face Integration and Model Definitions and Module Tree.
An import-time UnsafeTorchVersionError comes from the pre-import runtime gate, not the model's quantization backend. Upgrade to final Torch 2.13.x or >=2.15.0; 2.14.x is affected by a separate torch.load(weights_only=True) advisory. requirements.txt selects >=2.15.0. Do not treat weights_only=True or safetensors-only application code as a reason to ignore the runtime check. The explicitly unsupported GPTQ_BYPASS_SAFETY_CHECKS=1 exception is for controlled pinned environments, including the isolated Tenstorrent stack. See runtime safety checks.
| Component | Declared requirement in this revision |
|---|---|
| Python | >=3.11 |
| Build backend |
setuptools.build_meta, setuptools >=84.2.1,<85
|
| Torch | >=2.15.0 |
| Transformers |
>=5.23.0,<5.24 (one minor release; see model ports) |
| Safetensors | >=0.8.0 |
| Tokenicer | >=0.0.21 |
Optimum (hf extra) |
>=2.3.0; not a core requirement. |
| BitsAndBytes extra | >=0.50.2 |
| Triton extra |
>=3.8.0, Python <3.15
|
These come from requirements.txt and pyproject.toml. The current package metadata omits the vllm and sglang extras. Use dedicated engine environments and check each engine release's Torch and Transformers pins before combining it with GPT-QModel. See Serving.
Recommended diagnosis:
- Confirm the Python executable used by the process and use
python -m pip, not an unrelatedpip. - Run
python -m pip checkand record package versions. - Distinguish GPT-QModel core loading, Optimum integration, and a separate engine's loader.
- Reproduce with the package's current declared dependencies in an isolated environment.
- If model-specific version checks conflict with broad package requirements, include both in the report. Do not invent a silent downgrade workaround.
CI pins and old changelog examples are not authoritative public dependency ranges. For example, the unit workflow's selected Torch can differ from requirements.txt; inspect the installed packages rather than copying a workflow label into a bug report.
There are several distinct cases:
| Path | Behavior |
|---|---|
QuantizeConfig.from_quant_config(...) |
Lowercases keys, applies supported aliases, normalizes method/format, logs and ignores unknown top-level parameters. |
Public QuantizeConfig(...) factory |
Routes to a concrete config class, normalizes compatibility aliases, rejects unknown keys with TypeError and a close-match hint. Known fields belonging to another method warn and are ignored rather than silently disappearing. |
| Nested configuration | Some normalizers reject unsupported fields/types, and strict dataclasses can raise. Top-level ignore behavior is not universal. |
| Invalid known value | Can raise validation errors for group sizes, formats, dtype, nested limits or conflicting settings. |
Deprecated is_marlin_format
|
False is accepted/dropped for legacy compatibility; truthy values raise. Use an explicit format field. |
| Manual format plus checkpoint format metadata |
from_quant_config rejects conflicting sources instead of silently overriding. |
The serialized method field is quant_method; the public dataclass attribute is method. Use the current config API and inspect both the normalized object and serialized payload. Do not “fix” an incompatible checkpoint by editing desc_act, sym, group size, or format metadata without converting/requantizing the tensors.
The concrete config methods allowed_quant_methods() and supported_export_formats() are part of validation. Use QuantizeConfig Reference for supported fields and Packing Formats and Compatibility for layout conversion.
| Log / artifact | Location and behavior |
|---|---|
| General messages/progress | LogBar-backed logger and process output. The common setup does not establish a universal rotating file-log directory. Capture stdout and stderr explicitly. |
| Processor records |
logs/<processor>_log_<random>_time_<timestamp>.log relative to the current working directory, from LoopProcessor._build_log_file_path(). keep_processor_logs=True preserves them by default; False removes files during successful base finalization, not after a failed run. Despite the docstring's “project-local” wording, the constant is Path("logs"). |
| Quantization CSV |
<save_dir>/quant_log.csv when writer.py saves a quantized model with a nonempty quant_log. Columns are layer, module, loss, sample count, damping and processing time. Not every failing run reaches save. |
| JIT diagnostics | Process logs plus the extension's recorded error/build directory; extension.error(name) exposes the error text. |
| CI per-test logs |
/opt/dist/GPTQModel/<run_id>/logs/<test_script>.log in the self-hosted test runner. Local pytest does not use this path automatically. |
| Timings |
GPTQMODEL_LOG_TIMES=1 enables opt-in block/region timing messages where instrumented and is checked at call time. QuantizationRegionTimer aggregates are recorded and periodically flushed independently of this flag. |
| Device telemetry | Structured diagnostic records through the telemetry/logger path; not a promise of a separate persistent file. |
For a reproducible capture:
set -o pipefail
GPTQMODEL_LOG_TIMES=1 GPTQMODEL_EXT_VERBOSE=1 python -u reproduce.py 2>&1 | tee run.logThis is a Bash example; pipefail preserves failure status through tee. Keep complete output, not only the final progress bar. Pytest capture suppression checks PYTEST_CURRENT_TEST and non-TTY stdout. LOGBAR_ANIMATION=0 can simplify CI output, but missing redraws are not evidence that no work ran.
Kernel selection and tuning use typed backend configurations, for example backend=MarlinConfig(fp32=False). Shared controls use runtime=RuntimeConfig(...) on a loader or quantization config: RuntimeConfig(gptq_fused_block_update=False) replaces the old GPTQ fast-path disable switch, and RuntimeConfig(disable_bitblas=True) suppresses BitBLAS probing. Import these classes from gptqmodel.backend. Legacy kernel=KernelConfig(...) or a dictionary remains supported with enum/string selectors, but cannot combine with typed backend= or runtime=. Quantized linears own policy snapshots; shared quantizer/host settings still use a process fallback. Settings are validated and not serialized. See policy lifetime. The tables below retain only environment readers still present at the pinned revision.
Use explicit config/API controls for runtime policy. This table is a revision-specific inventory of existing readers, not a recommendation to add new behavior switches. Set import-time build/log diagnostics before importing; do not assume changing a variable mid-run reconfigures cached module state.
Package import warns once for each present retired kernel/thread variable in its migration registry and names the replacement API. For example, replace GPTQMODEL_CPU_WORKERS with RuntimeConfig(cpu_workers=...); the old variable does not change worker counts. GPTQMODEL_RESUME=1 additionally raises when quantization starts, even if a checkpoint argument was supplied. Unset it and use the explicit checkpoint API.
| Retired control | Current control at the pinned source |
|---|---|
GPTQMODEL_USE_TORCH_REPLICATE |
P2PConfig(use_torch_replicate=...); defaults to False, still gated by allocator/topology/GIL safety |
GPTQMODEL_DISABLE_PACK_EXT, GPTQMODEL_FORCE_PACK_EXT
|
Removed: the Python packer is the implementation, not an environment-selected native fallback |
GPTQMODEL_PACK_THREADS, GPTQMODEL_PACK_PY_THREADS
|
pack_block(..., workers=...) is the direct thread-count control |
GPTQMODEL_RESUME=1 |
Raises ValueError at quantize() entry; unset it and pass checkpoint=CheckpointConfig(path=...)
|
GPTQMODEL_P2P* policy switches |
QuantizeConfig(p2p=P2PConfig(...)) or GPTQModel.load(..., p2p=...)
|
The remaining environment readers below are legacy/external diagnostic/build controls in this revision. Their presence does not override the project's config/API design rule.
gptqmodel/utils/env.py defines no named application environment variables. It provides a generic helper used throughout the package:
TRUTHFUL = {"1", "true", "yes", "on", "y"}
def env_flag(name: str, default: str | bool | None = "0") -> bool:
"""Return ``True`` when an env var is set to a truthy value."""
value = os.getenv(name)
if value is None:
if default is None:
return False
if isinstance(default, bool):
return default
value = default
return str(value).strip().lower() in TRUTHFULThe helper returns true only for the trimmed, case-insensitive values in TRUTHFUL. An unset variable uses the caller's default; an explicitly empty value is false even if the default is true. None defaults are false. Values such as "2", "enabled", and "t" are not truthy for this helper.
The tables enumerate its named consumers, dynamic JIT controls, and related operational settings. Not every setting uses env_flag: integer conversions, permissive false-lists, and exact "1" tests are identified below. Set variables before starting Python unless the consumer explicitly reads them per operation. Many flags are module globals or cached capability probes; changing os.environ after imports may have no effect.
| Variable | Default / accepted value | Effect and source |
|---|---|---|
GPTQMODEL_KERNEL_REBUILD |
False; env_flag
|
Global force-rebuild control for TorchOpsJitExtension; utils/cpp.py. Remove it after diagnosis to avoid rebuilding every new process. |
GPTQMODEL_TORCH_EXTENSIONS_DIR |
Unset | Parent directory for shared Torch ops builds. If unset, builds use torch_extensions/<subdir> under the GPT-QModel cache root. Extension-specific build roots take precedence. Build-root resolution
|
GPTQMODEL_TORCH_OPS_LOCK_TIMEOUT |
Unset: max(600.0, 5.0 * compile_baseline_seconds) seconds |
Cross-process JIT lock wait scales with the extension's compile baseline; a missing baseline is zero. An explicit numeric value replaces the adaptive wait; negative values clamp to zero. Invalid text falls back to 600.0, not the adaptive baseline. |
GPTQMODEL_NVCC_COMPILE_LEVEL |
Unset; common compile default is O3
|
Case-insensitive O0, O1, O2, O3, or NONE, NOOPT, NO_OPT, OFF, DISABLE, 0; surrounding whitespace and one leading - are stripped, and an empty value also disables optimization flags. Disable spellings remove the optimization-level flag; O0 explicitly requests it. Other values raise ValueError. Despite its name, the shared helper normalizes C++ and CUDA optimization flags. |
NVCC_THREADS |
"8" unless an explicit thread argument is passed |
CUDA compiler --threads setting; not the number of concurrent Ninja build jobs. |
GPTQMODEL_EXT_VERBOSE |
False through env_flag
|
Verbose shared extension builds. The CPU helpers load_pack_block_extension(verbose=True) and load_floatx_cpu_extension(verbose=True) in utils/cpp.py temporarily set it and restore the prior environment. The public extension.load() has no verbose parameter; set the environment variable for that API. ExLlama v3's early module-level parser uses a false-list rather than TRUTHFUL. |
GPTQMODEL_EXT_BUILD |
Unset | Build-root override shared by CPU pack-block, FloatX, and INT4 qzero-group-scaled extensions. Otherwise their roots are separate subdirectories under the default root. |
TORCH_CUDA_ARCH_LIST |
Unset | PyTorch CUDA target override. GPT-QModel may temporarily merge visible GPU capabilities into an override, then restore it. A manual target list does not bypass hardware/kernel checks. |
TORCH_EXTENSIONS_DIR |
Torch-owned | Included in failure diagnostics; distinct from GPT-QModel's own explicit build-root control. Setting it alone does not replace GPTQMODEL_TORCH_EXTENSIONS_DIR. |
CUDA_PATH |
Unset | Explicit CUDA toolkit root considered by shared build helpers in addition to Torch's detected CUDA home. |
ROCM_PATH, HIP_PATH, ROCM_HOME
|
Unset | ROCm-root candidates used by shared build helpers; detection also considers the Torch-provided ROCm home and /opt/rocm. |
GPTQMODEL_CACHE_DIR |
Unset | Root for Marlin generated sources, Machete and Paro caches, and default Torch ops build directories. Falls back to $XDG_CACHE_HOME/gptqmodel, then ~/.cache/gptqmodel. Cache-root resolution
|
XDG_CACHE_HOME |
Unset | Fallback parent for the GPT-QModel cache when GPTQMODEL_CACHE_DIR is unset. |
GPTQMODEL_OFFLINE |
False; env_flag
|
Suppresses Machete online precompiled-cache probing; it is not a global Hugging Face/dataset offline switch. |
GPTQMODEL_CUTLASS_DIR |
Unset | Machete CUTLASS search override; it must contain the expected CUTLASS header tree. See utils/machete.py. |
GPTQMODEL_MACHETE_PRECOMPILED_LIBRARY |
Unset | Explicit Machete prebuilt library path handled by TorchOpsJitExtension; do not point it at an incompatible binary. |
GPTQMODEL_EXT_DEBUG |
Off | ExLlama v3 debug compile behavior; accepts 1, true, on, yes after normalization, not the full env_flag truth set. |
Each row below names the complete override variables. Build-root variables default to unset and rebuild variables default to false. Default subdirectories are beneath the root described above; fingerprinted build directories may exist within them.
| Extension / source | Build-root variable | Force-rebuild variable | Default subdirectory |
|---|---|---|---|
GPTQ block / quantization/gptq_cuda.py
|
GPTQMODEL_GPTQ_BLOCK_BUILD_ROOT |
GPTQMODEL_GPTQ_BLOCK_FORCE_REBUILD |
gptq_block |
AWQ / utils/awq.py
|
GPTQMODEL_AWQ_BUILD_ROOT |
GPTQMODEL_AWQ_FORCE_REBUILD |
awq |
QQQ / utils/qqq.py
|
GPTQMODEL_QQQ_BUILD_ROOT |
GPTQMODEL_QQQ_FORCE_REBUILD |
qqq |
VPTQ / utils/vptq_cuda.py
|
GPTQMODEL_VPTQ_BUILD_ROOT |
GPTQMODEL_VPTQ_FORCE_REBUILD |
vptq |
ExLlama v2 GPTQ / utils/exllamav2.py
|
GPTQMODEL_EXLLAMAV2_BUILD_ROOT |
GPTQMODEL_EXLLAMAV2_FORCE_REBUILD |
exllamav2 |
| ExLlama v2 AWQ / same source | GPTQMODEL_EXLLAMAV2_AWQ_BUILD_ROOT |
GPTQMODEL_EXLLAMAV2_AWQ_FORCE_REBUILD |
exllamav2_awq |
ExLlama v3 / exllamav3/ext.py
|
GPTQMODEL_EXLLAMAV3_BUILD_ROOT |
GPTQMODEL_EXLLAMAV3_FORCE_REBUILD |
exllamav3 |
Marlin FP16 / utils/marlin.py
|
GPTQMODEL_MARLIN_FP16_BUILD_ROOT |
GPTQMODEL_MARLIN_FORCE_REBUILD |
marlin_fp16 |
| Marlin BF16 / same source | GPTQMODEL_MARLIN_BF16_BUILD_ROOT |
GPTQMODEL_MARLIN_FORCE_REBUILD |
marlin_bf16 |
Machete / utils/machete.py
|
GPTQMODEL_MACHETE_BUILD_ROOT |
GPTQMODEL_MACHETE_FORCE_REBUILD |
machete |
Swordfish / utils/swordfish.py
|
GPTQMODEL_SWORDFISH_BUILD_ROOT |
GPTQMODEL_SWORDFISH_FORCE_REBUILD |
swordfish |
Paro rotation / utils/paro.py
|
GPTQMODEL_PARO_BUILD_ROOT |
GPTQMODEL_PARO_FORCE_REBUILD |
paro |
Hadamard / utils/hadamard.py
|
GPTQMODEL_HADAMARD_BUILD_ROOT |
GPTQMODEL_HADAMARD_FORCE_REBUILD |
hadamard |
| Variable | Default / parser | Behavior and consumer |
|---|---|---|
DEBUG |
False; env_flag
|
Package debug mode and importer support-map diagnostics; __init__.py, utils/importer.py. Not a promise of a global file log. |
GPTQMODEL_LOG_TIMES |
False; env_flag
|
Opt-in block/region timing messages; does not gate aggregate QuantizationRegionTimer recording/flushing. utils/logger.py. |
GPTQMODEL_LOG_HESSIAN |
False; env_flag
|
Additional GPTQ Hessian diagnostics; quantization/gptq.py. |
GPTQMODEL_LOG_QUANT_STATS |
"0"; enabled unless empty, 0, false, or False
|
Extra quantization statistics logging; looper/loop_processor.py. This parser is not case-normalized env_flag. |
GPTQMODEL_LOG_CALIBRATION_SAMPLES |
0; integer, lower-bounded at zero |
Preview that many prepared calibration samples; utils/calibration.py. Invalid non-integer text can raise. Use with care if calibration contains private text. |
GPTQMODEL_PRINT_MODULE_TREE |
False | Opt-in model-tree dump; accepts 1, true, yes, on, y, t; models/loader.py. |
GPTQMODEL_POOL_PREWARM |
True; env_flag
|
Best-effort prewarm of the device worker pool during model entry-point setup. |
GPTQMODEL_LINEAR_PREWARM |
True; env_flag
|
Best-effort background linear-library prewarm; utils/linalg_warmup.py. |
GPTQMODEL_QUANTIZE_PREWARM |
True; env_flag
|
Best-effort quantization-library prewarm; same source. Unsupported devices/dtypes and failures are skipped/debug-logged. |
GPTQMODEL_USE_MODELSCOPE |
False; env_flag
|
Enable ModelScope repository resolution; missing ModelScope produces an installation error. See utils/modelscope.py. |
GPTQMODEL_DISABLE_GIL_WARNING |
Unset | Exact "1" suppresses GIL diagnostic messages; does not change the interpreter's GIL. |
PYTHON_GIL |
Interpreter-owned |
0 requests disabled GIL on a supporting free-threaded Python build. Not a switch that makes ordinary Python free-threaded. |
GPTQMODEL_IMAGE_FETCH_MAX_BYTES |
33554432 (32 MiB) |
Download cap for load_image_from_url() remote calibration images, enforced on Content-Length and while streaming; non-integer text warns and uses the default, resolved value must be positive. |
GPTQMODEL_IMAGE_FETCH_MAX_PIXELS |
67108864 (64 Mpx) |
Decode cap checked from declared dimensions before Image.load() allocates; same env parsing as the byte cap. Fetch failures raise ImageFetchError with the URL and reason. |
BITBLAS_ENABLE_TUNING |
Unset: enabled for non-repack, disabled for GPTQ repack | If set, values other than trimmed case-insensitive 0, false, no, off enable tuning; utils/bitblas.py. |
TVM_TARGET |
Set by BitBLAS initialization | Receives the normalized detected CUDA target. A user value is not a supported replacement for GPT-QModel's target-selection checks. |
A script that exits soon after GPTQModel.load(..., quantize_config=...) may still have accelerator prewarm running. On normal Python shutdown, GPT-QModel waits up to 30 seconds total for in-flight linear and quantization prewarm threads to finish. This reduces the chance of CUDA teardown aborting the process with terminate called without an active exception (SIGABRT, exit status 134). See the shutdown handler.
The retired GPTQMODEL_PARO_OPT_LARGE_TRAIN_QUANT_COMPILE and GPTQMODEL_PARO_OPT_STAGE_CUDAGRAPH variables no longer select optimizer behavior. Native fused-rotation timing variables under GPTQMODEL_PARO_ROTATE_AUTOTUNE_* are also no longer read; timing counts and thresholds are internal constants.
Paro runtime tuning and launch choices use validated KernelConfig.paro_* fields; see native rotation controls and Triton tuning. Native rotation search uses paro_rotate_autotune, paro_rotate_cta_m, and paro_rotate_row_pad; Triton GEMM tuning uses its separate paro_triton_* fields. Build-root, rebuild, and shared JIT verbosity settings remain documented above. Runtime metadata caches do not authorize persistent dense or expanded weight caches. AGENTS.md requires quantized persistent weight storage for every backend and fallback.
| Retired variable | API replacement | Behavior |
|---|---|---|
GPTQMODEL_INTERNAL_GGUF_QUANTIZED_LOADER |
gguf_native_quantized_loader=True |
No effect; warns once and names its replacement. Use False to disable native packed detection. |
GPTQMODEL_INTERNAL_GGUF_TORCH_LOADER |
Direct-to-Torch dense import was removed | Dense import uses the Transformers GGUF loader. |
GPTQMODEL_INTERNAL_GGUF_DEQUANT_DEVICE |
gguf_dequant_device=None |
No effect; warns once. The API accepts Torch cpu / cuda[:INDEX]; invalid or unavailable requested targets raise instead of silently changing the conversion device. |
GPTQMODEL_INTERNAL_GGUF_DEQUANT_MAX_BYTES |
gguf_dequant_chunk_bytes=268435456 |
No effect; warns once. The API requires an integer >=1; this sign-only conversion-chunk budget is not a general quantization VRAM cap. |
The replacement fields belong to shared RuntimeConfig and legacy KernelConfig; supply them through runtime= or kernel= respectively, without combining the two. Torch's cuda execution spelling also addresses AMD ROCm. Typed GGUF backend configs select/tune execution and do not carry these checkpoint-load options. See GGUF loading and defaults.
| Variable | Role |
|---|---|
CUDA_VISIBLE_DEVICES |
CUDA visibility/logical indexing. Set before Python/Torch initialization; optimize/_common.py also writes and verifies it for its CLI. |
ROCR_VISIBLE_DEVICES |
ROCm visibility variable considered by optimizer GPU setup. models/auto.py deletes it when both it and CUDA_VISIBLE_DEVICES are present, preferring the CUDA visibility setting to avoid the ROCm conflict. |
CUDA_DEVICE_ORDER |
models/auto.py sets PCI_BUS_ID if the current value is missing or empty, preserving a nonempty explicit value. CI also selects PCI bus ordering. |
PYTORCH_ALLOC_CONF, PYTORCH_CUDA_ALLOC_CONF
|
Defaults are installed before submodule imports only when no recognized caller setting is nonempty. NVIDIA CUDA: expandable_segments:True; AMD ROCm: expandable_segments:False. Neither pins a split size or garbage-collection threshold. On ROCm, a nonempty PYTORCH_HIP_ALLOC_CONF also prevents default installation. Already-initialized native allocation gets a best-effort update; non-native backends remain unchanged. The opt-in backend:cudaMallocAsync wide-Hessian remedy is for affected NVIDIA runs, not a ROCm P2P fix. See allocator defaults and caveats. |
ROCBLAS_USE_HIPBLASLT |
On HIP builds, defaults to 0 before first BLAS use to avoid observed cross-process kernel-selection drift. Any caller value (even empty) wins. Set before Python starts; importing after a BLAS call is too late to change its initialized choice. |
LOGBAR_ANIMATION |
LogBar's animation control; CI sets 0. It is not the logger's sole pytest-capture detection mechanism. |
PYTEST_CURRENT_TEST |
Pytest-owned signal used with non-TTY stdout to suppress live redraw during test capture. |
GPU_ALLOCATOR_URL |
CI/optimization GPU-allocation service setting, not a qlinear backend or local device-selection API. |
Open an issue in ModelCloud/GPTQModel with a small, complete reproduction and the first failure. Include:
| Category | Required information |
|---|---|
| Source | GPT-QModel release/version and commit for source installs; whether local edits are present. |
| Environment | OS, Python executable/version/GIL mode, Torch build, Transformers, Tokenicer, Safetensors, relevant optional backend/engine versions, pip check output. |
| Hardware/toolchain | GPU/accelerator model, in-process logical devices, capability, driver/toolkit/compiler versions, CUDA versus HIP build, host RAM/disk if relevant. |
| Model | Model ID and revision or reproducible local layout, config model_type, trust setting, tokenizer/template revision, attention implementation. |
| Quantization | Concrete config class and normalized settings: method, format, bits, group size, desc_act, sym, packing dtype, activation dtype, dynamic overrides, preprocessing/adapter options. |
| Workload | Calibration source/order/count/length, batch size, concat/sort settings, device or placement rules, offload strategy, checkpoint settings, inference/generation shapes. |
| Backend | Requested and actual selected backend/qlinear class, available extension status, JIT roots/flags, whether a fallback ran. |
| Failure/evidence | Complete traceback and log from startup, expected versus observed behavior, minimal command/script, whether dense/reference execution succeeds. |
| Resume | Preserved checkpoint error/identity differences, original environment, signal/failure type, published-generation status. Do not modify checkpoint metadata to make a report look compatible. |
Include only relevant non-secret environment settings. Remove access tokens, private credentials, signed URLs and sensitive calibration/prompt text. Prefer a public or synthetic reproduction where possible. Do not upload proprietary weights or private datasets simply to demonstrate a failure.
Review environment values and local paths before sharing a doctor.json report.
-
docs/cli.md,gptqmodel_cli.py,gptqmodel/cli/main.py,gptqmodel/cli/doctor.py— environment diagnostics and launcher behavior. -
docs/gptq-scale-storage-range.md,gptqmodel/nn_modules/qlinear/__init__.py,tests/test_quant_scale_overflow.py— FP16 scale-storage failures in the shared GPTQ packers. -
gptqmodel/utils/env.py,logger.py,cpp.py,device_telemetry.py -
gptqmodel/extension.py,gptqmodel/version.py,gptqmodel/__init__.py -
gptqmodel/_alloc_conf.py,docs/multi_gpu_quantization.md,tests/test_alloc_conf.py,tests/test_layerwise_device_placement.py -
gptqmodel/utils/p2p.py,tests/test_p2p.py— directed transfer routing, host staging, forced-unverified links, and replication fallback. -
gptqmodel/utils/marlin.py,machete.py,bitblas.py,paro.py,awq.py,qqq.py,vptq_cuda.py,hadamard.py,exllamav2.py -
gptqmodel/utils/importer.py,backend.py,model.py,looper_helpers.py,linalg_warmup.py,rocm.py,cpu_features.py -
gptqmodel/utils/hf.py,internal_gguf.py,modelscope.py,calibration.py,gptqmodel/utils/__init__.py -
gptqmodel/models/auto.py,base.py,loader.py,writer.py,_const.py -
gptqmodel/quantization/config.py,gptq.py,qqq.py,gptq_cuda.py,dtype.py,npu_linalg.py -
gptqmodel/quantization/awq/modules/triton/,gptqmodel/quantization/paro/ -
gptqmodel/nn_modules/qlinear/__init__.py,torch.py,marlin.py,bitblas.py,exllamav2.py,tritonv2.py,gemm_awq.py,gemv_awq.py,gemv_fast_awq.py,qqq.py,paro.py,paro_triton.py,bitsandbytes.py,bitsandbytes_triton.py,gguf.py,gguf_cpp.py -
gptqmodel/nn_modules/exllamav3_torch.py,gptqmodel/exllamav3/ext.py -
gptqmodel/looper/loop_processor.py,awq_processor.py,gptq_checkpoint.py,checkpoint_store.py,checkpoint.py checkpoint.md-
requirements.txt,pyproject.toml,AGENTS.md,.agents/skills/ -
optimize/_common.py,hw/ascend_npu.md,tests/pytest.ini -
.github/workflows/unit_tests.yml,unit_tests_reusable.yml,.github/scripts/ci_tests.py,docs/changelog/archive.md
Documentation home · Quickstart · Troubleshooting · Repository · PyPI
Public source 775013e41 declares package version 7.14.0. Individual pages identify their source revisions. Choose a method · Dtypes and formats. Maintained by ModelCloud.ai.
🧭 1 · Choose and understand
🚀 2 · Use it
- Installation and Quickstart
- Loading and Inference
- LeapQuant recurrent-state quantization
- Evaluation
- Serving
- Troubleshooting and FAQ
- Memory, Offload, Multi-GPU
- MLX / Apple Silicon
- Tenstorrent / Block Floats
- Hugging Face Integration
- Multimodal and MoE Models
🎛️ Methods and representations
Each guide: choose → examples → math / advanced
- GPTQ / GPTAQ / G2PTQ / ADMM-Q / RTN
- SINQ
- JointQ
- AWQ
- QQQ
- MACaQ / MXFP4
- EXL3
- CPTC
- VPTQ
- Tetra
- TWLA
- Paro
- FP8 and NVFP4
- NF12: lossless BF16 storage
- GGUF families
- BitsAndBytes: NF4 / FP4 / INT8
🧰 Refinement and execution
- GSQ refinement / allocation
- EoRA adapters
- Rotation, Smoothing, Norm Tuning
- Projection Fusion
- TurboQuant KV cache
🧠 3 · Theory and advanced reference