Skip to content

[BUG] Docs vs code: #4724 leftover pre-bound CalibrationConfig example (TypeError), rotation documented as a quantize() kwarg (TypeError), EoRA README saves the adapter where its next steps don't look, ~100 drifted contract file:line refs #4762

Closed

Description

@Qubitium

Found on main @ b225a43, CPU (docs-vs-code audit).

I extracted every Python block in README.md, checkpoint.md and docs/**/*.md (133 blocks), import-checked and kwarg-checked them against the live signatures, and ran the user-facing ones on Qwen2.5-0.5B / Llama-3.2-1B. Most docs match the code. The items below do not. All of them are API calls or workflows that fail when a reader follows the docs as written.

1. Leftover from #4724: the processor-author example still builds a pre-bound CalibrationConfig

docs/quantization-lifecycle-contracts.md:130-137:

calibration = CalibrationConfig(dataset=dataset, prepare_dataset=model.prepare_dataset, concat_size=2048, sort="desc", concat_separator=None, batch_size=1)
TypeError: CalibrationConfig.__init__() got an unexpected keyword argument 'prepare_dataset'

Since #4724, prepare_dataset is init=False and only CalibrationConfig.bind(model.prepare_dataset) sets it. The same block imports CalibrationConfig from gptqmodel.looper.loop_processor. That still works only through a re-export; the PR says the looper copy is gone, so the doc should import it from gptqmodel. The new docs/calibration-config.md example uses backend=BACKEND.AUTO without importing BACKEND, so it fails with NameError.

2. Rotation is documented as a quantize() keyword

docs/quantization-features.md:13 (and its Mermaid node at :116) and docs/rotation-model-support.md:3 (and its Mermaid node at :40) document GPTQModel.quantize(rotation="hadamard" | "random"). Rotation is a QuantizeConfig.rotation field, and quantize() has keyword-only parameters:

TypeError: BaseQModel.quantize() got an unexpected keyword argument 'rotation'

docs/gptq-w4a-gb10.md:327 shows the correct form (QuantizeConfig(..., rotation="hadamard")).

3. EoRA README: the first generation option saves the adapter where the later steps do not look

docs/eora/README.md option 1 runs eora_generation.py ... --quant_save_path docs/eora/Llama-3.2-3B-4bits --eora_save_path docs/eora/Llama-3.2-3B-4bits-eora_rank64_c4. The script builds Lora(path=os.path.join(quant_path, eora_path)) (docs/eora/eora_generation.py:97-100), so the adapter is written to docs/eora/Llama-3.2-3B-4bits/docs/eora/Llama-3.2-3B-4bits-eora_rank64_c4/. The README's Evaluation and Inference steps then load docs/eora/Llama-3.2-3B-4bits-eora_rank64_c4, which does not exist. The inference snippet's path also has a trailing space ('docs/eora/Llama-3.2-3B-4bits-eora_rank64_c4 ').

Reproduced with a 6-layer Qwen2.5-0.5B (C4 rows from a local file, --eora_rank 16):

eora_generation.py tiny --quant_save_path out/q --eora_save_path out/ad    -> rc=0, writes out/q/out/ad/adapter_model.safetensors
eora_load_and_inference.py --quantized_model out/q --eora out/ad           -> ValueError: Adapter: remote adapters are disabled by default. Pass allow_remote_adapter=True with adapter_revision and adapter_sha256 ...
eora_load_and_inference.py --quantized_model out/q --eora out/q/out/ad     -> loads

A missing local path is also reported as a Hub "remote adapter" refusal, which points the user in the wrong direction. Either drop the os.path.join in the script, or make the README pass the joined path.

4. Contract-doc file:line references have drifted

AGENTS.md makes these pages the logic-flow contract, but many "current/after" references now point at unrelated lines. Examples (doc line -> cited -> actual definition):

doc cited now
calibration-replay.md:107-108 (After column) capture_layer_type_replay_kwargs base.py:3457, _build_layer_type_position_embeddings base.py:3440 base.py:4014, base.py:3997
layer-type-replay-masks.md:137 _rotary_layer_type_kwargs awq_processor.py:2835 awq_processor.py:4462
fp8-scale-semantics.md:87 _decoder_fp8_scale_semantics base.py:3731 base.py:4744
awq-scale-folding.md:130 _select_prev_op base.py:4443 base.py:5481
openai-server-exposure.md:90 serve() base.py:3168 base.py:3748
rocm-default-environment.md:95-96 compute_hessian_xtx gptq.py:971, hessian_inverse gptq.py:1802 gptq.py:1077, gptq.py:1954
adapter-rank-pattern-matching.md:111 extract_adapter_rank_patterns config.py:4944 config.py:5540
quantize-run-summary.md:72 _quantize_summary_counts base.py:236-259 base.py:346
multi_gpu_quantization.md:185 torch_sync torch.py:564 torch.py:611
nf12-installed-extension.md:62,64 gptqmodel/utils/nf12.py:173, :318 file has 91 lines

A heuristic pass (the backticked symbol nearest a path.py:N reference must appear within +-8 lines of N) flags about 100 references across 40 pages. Some of these are intentional "before" citations, so the exact count is fuzzy.

Suggested fix

Fix the four items above. Add a docs CI check that (a) import- and signature-checks fenced Python blocks (the 133 blocks take a few seconds) and (b) for path:line references outside "before/previous" columns, verifies that the named symbol is near the line. Alternatively, have the docs cite symbols instead of line numbers.

Checked and consistent (for the record)

The quantization-guide recipes (GPTQ 4/8-bit, AWQ, RTN, FP8, GGUF, BnB, ParoQuant, EXL3 quantize, VPTQ, MACaQ) and the README quick start / inference examples run end to end. The checkpoint.md SIGINT -> exit 75 -> resume flow is bitwise identical to an uninterrupted run. The #4724 claim "default CalibrationConfig writes the same checkpoint as old quantize(data)" holds bitwise for GPTQ and AWQ. AUTO_NF12 is bitwise lossless against OFF for bf16 GPTQ. Attention-sink exclusion is a no-op for Qwen (no BOS). The thread-caps defaults, the backend-retention table, the KernelConfig field table, the MACaQ/VPTQ default tables and the supported-models table match MODEL_MAP and the code. The protocol-actions, hf_packing_api, fusion and module-plan examples all run.

Severity

Low to medium. Nothing silently corrupts output. Each item is a documented call or workflow that fails for a user or contributor who follows it.

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Taking this.

  2. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-53ba17eb4d83 finished this issue.

    Pull request: #4791

    Docs-vs-code drift: calibration example, rotation kwarg, EoRA paths, ~100 file:line refs; worktree /root/work-4762

  3. added a commit that references this issue on Nov 17, 2026
  4. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim: agent-root-4762-docs is working on this issue now.

    Started 2026-11-17T16:05:25Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.

    claiming: fix the doc examples that raise (pre-bound CalibrationConfig, rotation kwarg, EoRA save path) and the drifted file:line refs

  5. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Agent release: agent-root-4762-docs is releasing this claim — the doc defects are already fixed on main by #4791 (b22245774, "docs: fix stale #4724 example, rotation kwarg, EoRA save path, and contract refs").

    Verified on main @ e3084443e:

    1. Pre-bound CalibrationConfig — docs/quantization-lifecycle-contracts.md:132 now builds CalibrationConfig(dataset=..., ...).bind(model.prepare_dataset), and both blocks import from gptqmodel (:62, :94). docs/calibration-config.md:9 imports BACKEND.
    2. Rotation as a quantize() kwarg — docs/quantization-features.md:13/116 and docs/rotation-model-support.md:3/40 now read QuantizeConfig(rotation=...).
    3. EoRA save path — docs/eora/eora_generation.py passes --eora_save_path straight to Lora(path=...) (no quant_path join), so the option-1 example writes where evaluation.py/eora_load_and_inference.py read. The only remaining os.path.join is the single-argument post_quant_eora_generation.py:59, which is a no-op.
    4. Drifted contract refs — repaired in the same commit.

    Nothing left to change; releasing rather than opening a duplicate PR.

  6. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Fixed by #4791 (merged as b22245774); verified on main that the pre-bound CalibrationConfig example, the rotation kwarg documentation, the EoRA save path, and the drifted contract refs are corrected, with tests/test_docs_contract_refs.py guarding them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions