Repository navigation
docs: align ROCm, checkpoint and calibration docs with shipped code (#5121) - #5165
Merged
Merged
Conversation
…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
force-pushed
the
fix/5121-docs-vs-code-round20
branch
from
November 18, 2026 07:16
1ec8ea9 to
941f366
Compare
This was referenced Nov 18, 2026
Qubitium
marked this pull request as ready for review
November 18, 2026 07:18
This was referenced Nov 18, 2026
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.
8 tasks done
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 #5121Per item
1. EoRA doc scripts forced the ROCm-corrupting allocator
Docs/scripts said: all four
docs/eora/entry points setos.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 gptqmodelinstalls the per-platform default before any Torch submodule import (gptqmodel/__init__.py:28-30).default_alloc_conf()returnsexpandable_segments:Trueon CUDA (gptqmodel/_alloc_conf.py:60,104-117) andexpandable_segments:Falseon 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 importsgptqmodelbefore any Torch import (eora_calibration_data_construction.pyimports onlydatasets). On this CUDA host, importinggptqmodelwith an empty allocator environment installsexpandable_segments:True;default_alloc_conf("rocm")returnsexpandable_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.mdalready documentsexpandable_segments:Falseand nomax_split_size_mbcap, so the issue's quotedmax_split_size_mb:256,garbage_collection_threshold:0.7text is stale; the scripts were still overriding the documented default.2.
rocm-rdna4.mdParo AUTO claims were staleDocs said:
rocm-rdna4.md:54said gfx1200 was "✅ explicitPARO_TRITONonly" and "AUTO keeps the TorchParoLinearkernel";:178saidSUPPORTS_FORMATS[FORMAT.PARO] = 0meansPARO_TRITONis never chosen by AUTO.Code does:
ParoTritonLinear.SUPPORTS_FORMATS = {FORMAT.PARO: 10}(gptqmodel/nn_modules/qlinear/paro_triton.py:60), andauto_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 selectsPAROTritonLinearon ROCm andParoLinearon CUDA/CPU.Changed: updated the table row to
AUTOon all three RDNA4 entries and rewrote the Paro Triton text to match the code, including the CUDA and CPU outcomes. Backed bytests/test_paro_rocm_auto_4914.pyandtests/test_rocm_backend_gating.py.3. ROCm BLAS-pin docs contradicted the code for Paro
Docs said:
rocm-default-environment.md:78said "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-106omitted Paro from the pin list.Code does:
_DETERMINISTIC_BLAS_PROCESSOR_STEPScontainsProcessorStep.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 bytests/test_rocm_quant_blas.py::test_paro_selects_the_deterministic_pin_on_mocked_rocm.4.
checkpoint.mdsupported-configuration list was staleDocs said:
checkpoint.md:204-218supported model typesllamaandqwen3_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 rejectdynamic(gptq_checkpoint.py:293-321); dynamic rules and runtime exclusions are part of the checkpoint identity (gptq_checkpoint.py:171-203).MacaqProcessordeclaresCheckpointSupport.PRIMARY(gptqmodel/looper/macaq_processor.py:75), as doesWeightOnlyProcessorfor NF12 (gptqmodel/looper/weight_only_processor.py:78).Changed:
checkpoint.mdnow 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 indocs/looper-checkpoint-redesign.mdwas aligned. Backed bytests/test_checkpoint_model_types.pyandtests/test_checkpoint_resume_nf12_macaq_4792.py.5. Calibration errors named the removed
calibration_dataset_concat_sizekeywordCode did: four user-facing strings in
gptqmodel/utils/calibration.pystill named the removed keyword::195,:1202,:1394,:1519.Changed: all four now say
CalibrationConfig.concat_size, matching theCalibrationConfig.min_lengthwording already used in the file. The remainingcalibration_dataset_concat_sizeoccurrences are internal parameter/variable names, not user-facing strings.docs/decision-transformer-calibration.mdnow names the public field in its failure table. Addedtests/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:linecitations it resolves indocs/gguf-config-resolution.md,docs/generate-cpu-offload-autograd.md,docs/quantize-run-summary.md, and thegptqmodel/quantization/gptq.pyreferences indocs/rocm-default-environment.md, and updated the correspondingCONTRACT_REFSentries. These were red on the base branch and are unrelated to the five issue items.Tests
Command (from
/root/work/issue-5121):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.pywas also collected: 31 skipped (ROCm GPU required).ruff checkon the changed Python files passed.Not verified on this host
expandable_segments:False) is verified bydefault_alloc_conf("rocm")and the existing allocator tests, not by a ROCm import.