Skip to content

docs: align ROCm, checkpoint and calibration docs with shipped code (#5121) - #5165

Merged
Qubitium merged 1 commit into
mainfrom
fix/5121-docs-vs-code-round20
Nov 18, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/5121-docs-vs-code-round20

Conversation

@Qubitium

@Qubitium Qubitium commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Docs-vs-code pass for #5121, rebased on current upstream/main (fe9d82400). Product name in prose is GPT-QModel; package/import names are unchanged. This is a docs-and-user-facing-string change, so no Mermaid diagram is needed (no control flow changed).

Fixes #5121

Per item

1. EoRA doc scripts forced the ROCm-corrupting allocator

Docs/scripts said: all four docs/eora/ entry points set os.environ["PYTORCH_ALLOC_CONF"] = "expandable_segments:True" unconditionally (eora_generation.py:21, post_quant_eora_generation.py:21, evaluation.py:21, eora_load_and_inference.py:21).

Code does: import gptqmodel installs the per-platform default before any Torch submodule import (gptqmodel/__init__.py:28-30). default_alloc_conf() returns expandable_segments:True on CUDA (gptqmodel/_alloc_conf.py:60,104-117) and expandable_segments:False on ROCm (gptqmodel/_alloc_conf.py:81); apply_default_alloc_conf() preserves a caller-set value (gptqmodel/_alloc_conf.py:166-179).

Changed: removed the unconditional line from all four scripts. They still set CUDA_DEVICE_ORDER, and each imports gptqmodel before any Torch import (eora_calibration_data_construction.py imports only datasets). On this CUDA host, importing gptqmodel with an empty allocator environment installs expandable_segments:True; default_alloc_conf("rocm") returns expandable_segments:False. No ROCm host was available, so the ROCm path is verified by inspection and the existing allocator tests, not a ROCm run.

Note: on this base, docs/rocm-default-environment.md already documents expandable_segments:False and no max_split_size_mb cap, so the issue's quoted max_split_size_mb:256,garbage_collection_threshold:0.7 text is stale; the scripts were still overriding the documented default.

2. rocm-rdna4.md Paro AUTO claims were stale

Docs said: rocm-rdna4.md:54 said gfx1200 was "✅ explicit PARO_TRITON only" and "AUTO keeps the Torch ParoLinear kernel"; :178 said SUPPORTS_FORMATS[FORMAT.PARO] = 0 means PARO_TRITON is never chosen by AUTO.

Code does: ParoTritonLinear.SUPPORTS_FORMATS = {FORMAT.PARO: 10} (gptqmodel/nn_modules/qlinear/paro_triton.py:60), and auto_select_priority() returns that rank on ROCm (paro_triton.py:96-105). ParoLinear.auto_select_priority() demotes its own ROCm rank to 0 because its AWQ GEMM is CUDA-only (gptqmodel/nn_modules/qlinear/paro.py:515-525). So AUTO selects PAROTritonLinear on ROCm and ParoLinear on CUDA/CPU.

Changed: updated the table row to AUTO on all three RDNA4 entries and rewrote the Paro Triton text to match the code, including the CUDA and CPU outcomes. Backed by tests/test_paro_rocm_auto_4914.py and tests/test_rocm_backend_gating.py.

3. ROCm BLAS-pin docs contradicted the code for Paro

Docs said: rocm-default-environment.md:78 said "AWQ, Paro and weight-only (RTN) accumulate none of these and keep hipBLASLt"; the same page's table already said Paro was pinned rocBLAS. rocm-rdna4.md:104-106 omitted Paro from the pin list.

Code does: _DETERMINISTIC_BLAS_PROCESSOR_STEPS contains ProcessorStep.PARO (gptqmodel/models/base.py::_DETERMINISTIC_BLAS_PROCESSOR_STEPS, :181-190), and _needs_deterministic_hessian() tests that set (base.py::_needs_deterministic_hessian, :193-203). Paro accumulates no Hessian; it is pinned because hipBLASLt chose GEMM kernels per process (#4460).

Changed: both pages now name Paro as pinned rocBLAS and explain why it is pinned without a Hessian. Also corrected the stale _HESSIAN_PROCESSOR_STEPS/line citations in the same section to the shipped symbol names. Backed by tests/test_rocm_quant_blas.py::test_paro_selects_the_deterministic_pin_on_mocked_rocm.

4. checkpoint.md supported-configuration list was stale

Docs said: checkpoint.md:204-218 supported model types llama and qwen3_moe, omitted MACaQ and NF12, and listed "dynamic per-module quantization/exclusions" as unsupported.

Code does: CHECKPOINT_MODEL_TYPES = {"llama", "qwen2", "qwen3_moe"} (gptqmodel/looper/gptq_checkpoint.py:290); validate_checkpoint_support() does not reject dynamic (gptq_checkpoint.py:293-321); dynamic rules and runtime exclusions are part of the checkpoint identity (gptq_checkpoint.py:171-203). MacaqProcessor declares CheckpointSupport.PRIMARY (gptqmodel/looper/macaq_processor.py:75), as does WeightOnlyProcessor for NF12 (gptqmodel/looper/weight_only_processor.py:78).

Changed: checkpoint.md now names qwen2, MACaQ and NF12, documents dynamic quantization (including runtime exclusions) as supported and identity-checked, and removes the "dynamic unsupported" claim. The same stale family/method sentence in docs/looper-checkpoint-redesign.md was aligned. Backed by tests/test_checkpoint_model_types.py and tests/test_checkpoint_resume_nf12_macaq_4792.py.

5. Calibration errors named the removed calibration_dataset_concat_size keyword

Code did: four user-facing strings in gptqmodel/utils/calibration.py still named the removed keyword: :195, :1202, :1394, :1519.

Changed: all four now say CalibrationConfig.concat_size, matching the CalibrationConfig.min_length wording already used in the file. The remaining calibration_dataset_concat_size occurrences are internal parameter/variable names, not user-facing strings. docs/decision-transformer-calibration.md now names the public field in its failure table. Added tests/test_calibration_concat_policies_4892.py::test_concat_size_errors_name_the_public_config_field, which asserts all four messages.

Docs-contract citations

While running the docs-contract guard, I also repaired stale file:line citations it resolves in docs/gguf-config-resolution.md, docs/generate-cpu-offload-autograd.md, docs/quantize-run-summary.md, and the gptqmodel/quantization/gptq.py references in docs/rocm-default-environment.md, and updated the corresponding CONTRACT_REFS entries. These were red on the base branch and are unrelated to the five issue items.

Tests

Command (from /root/work/issue-5121):

PYTHONPATH=/root/work/issue-5121 HF_HUB_OFFLINE=1 /root/venv/bin/python -m pytest \
  tests/test_docs_contract_refs.py \
  tests/test_calibration_concat_policies_4892.py \
  tests/test_calibration_config.py \
  tests/test_calibration_input_gaps_4311.py \
  tests/test_paro_rocm_auto_4914.py \
  tests/test_rocm_backend_gating.py \
  tests/test_rocm_quant_blas.py \
  tests/test_cuda_alloc_conf_4389.py \
  tests/test_rocm_alloc_conf_5072.py \
  tests/test_checkpoint_model_types.py \
  tests/test_checkpoint_resume_nf12_macaq_4792.py -q

Result: 170 passed, 2 skipped. Skips are device-gated: one ROCm allocator-reuse test and one ROCm QQQ packing test. tests/kernels/test_awq_rocm_triton.py was also collected: 31 skipped (ROCm GPU required). ruff check on the changed Python files passed.

Not verified on this host

  • No ROCm GPU/ROCm runtime here. Items 2 and 3 are verified from the code paths and the mocked-ROCm/CPU tests above, not by re-running a Paro checkpoint on gfx1201.
  • The allocator import path was executed on this CUDA host; the ROCm branch (expandable_segments:False) is verified by default_alloc_conf("rocm") and the existing allocator tests, not by a ROCm import.

…5121)

Drop the unconditional expandable_segments override from the EoRA doc scripts; import gptqmodel already installs expandable_segments:True on CUDA and expandable_segments:False on ROCm. Correct the RDNA4 Paro AUTO row/text, name Paro in the rocBLAS pin docs, update the checkpoint support list, and rename calibration_dataset_concat_size in user-facing calibration errors to CalibrationConfig.concat_size. Also repair stale file:line citations the docs-contract test resolves.
@Qubitium
Qubitium force-pushed the fix/5121-docs-vs-code-round20 branch from 1ec8ea9 to 941f366 Compare November 18, 2026 07:16
@Qubitium
Qubitium marked this pull request as ready for review November 18, 2026 07:18
@Qubitium
Qubitium merged commit a3e98ce into main Nov 18, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/5121-docs-vs-code-round20 branch November 18, 2026 07:18
Qubitium added a commit that referenced this pull request Nov 18, 2026
…#5201) (#5217)

`docs/generate-cpu-offload-autograd.md` cited `gptqmodel/models/base.py:3939`
for `generate`. Three merges after #5165 repaired it, #5176 and #5182 moved
`def generate` to 3948, outside `LINE_WINDOW`, so
`test_docs_contract_refs.py::test_contract_reference_resolves` was red on
`main`.

Cite the symbol instead, as the test's own header already recommends for a
file that moves often. The registry keeps one `SYMBOL_CITATION` entry instead
of the line-anchored duplicate.

Also convert the remaining guarded `base.py:359` citation
(`_quantize_summary_counts`) and add
`test_models_base_citations_use_the_symbol_form`, which rejects any future
line-numbered citation into `models/base.py` in the registry. That file grows
with nearly every fix PR, so a line citation drifts within a couple of merges.
Qubitium pushed a commit that referenced this pull request Nov 18, 2026
…tqmodel (#5199) (#5256)

optimize/_common.set_env() runs before gptqmodel is imported and set
PYTORCH_ALLOC_CONF=expandable_segments:True,max_split_size_mb:1024,...
GPT-QModel defers to a caller-set allocator config, so the requantization
CLI (optimize/requant_embed_lm_head.py) replaced the ROCm default
(expandable_segments:False) with the configuration that corrupts ordinary
Torch results after empty_cache() on gfx1201, and restored the
max_split_size_mb cap that #5108 removed. #5165 fixed only docs/eora/.

Drop the line so import gptqmodel installs the per-platform default. Remove
the same pinned literal from scripts/eval_model.py,
scripts/benchmark_llama_cpp_vs_gptqmodel_gguf.py, and
tests/benchmark/benchmark_test.py.

Tests in tests/test_rocm_default_env.py:
- a fresh interpreter imports the real tool, then gptqmodel, and must end
  up with _alloc_conf.default_alloc_conf() (a caller value still wins);
- a repo-wide AST guard rejects any os.environ/os.putenv write of
  expandable_segments:True to PYTORCH_*ALLOC_CONF outside
  gptqmodel/_alloc_conf.py unless it sits under a HIP/ROCm check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant