Skip to content

[executorch][examples] Muse Glimmer: export NVFP4 GGUF checkpoints on CUDA - #25428

Open
Gasoonjia wants to merge 8 commits into
gh/Gasoonjia/135/basefrom
gh/Gasoonjia/135/head
Open

Gasoonjia wants to merge 8 commits into
gh/Gasoonjia/135/basefrom
gh/Gasoonjia/135/head

Conversation

@Gasoonjia

@Gasoonjia Gasoonjia commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Wires NVFP4 GGUF checkpoints into the Muse Glimmer CUDA export. The GGUF reader pairs each NVFP4 weight with its .scale companion by name (a missing .scale means a unit global scale, as in llama.cpp; an unpaired companion, or a missing .input_scale when static activation scales are requested, raises before any weight is converted) and feeds the shared iter_checkpoint. On CUDA, Q/K/O-gate and gate/up projections fuse losslessly (per-row global scales where shards differ). source_transformations/nvfp4.py swaps the MLP for triton::nvfp4_gated_linear, whose dispatch now also falls back to F.linear for decode-size M outside forced w4a4; the batching export installs it too. export_solo and export_dflash gain --nvfp4-act {auto,w4a4,w4a16}, which sets ET_CUDA_NVFP4_ACT only when given (CUDA only); export_solo --nvfp4-static-act uses the checkpoint's .input_scale as a static activation scale (load_gguf_model(nvfp4_static_act_scale=True)).

Authored with Claude Code.

Differential Revision: D131418680

@pytorch-bot

pytorch-bot Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/25428

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure

As of commit 5f32131 with merge base 9f49fe2 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 22, 2026
@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@Gasoonjia

Copy link
Copy Markdown
Contributor Author

@claude /pr-review

@claude

claude Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Claude finished @Gasoonjia's task in 28m 13s —— View job


PR Review: #25428

Requesting changes: --nvfp4-act silently overrides the backend's documented ET_CUDA_NVFP4_ACT, CudaNVFP4MLP duplicates _gated_linear's routing, the new GGUF .scale companion pairing is untested, and test_nvfp4_mlp.py probably runs in no CI job.

Detailed review

Summary

This PR loads NVFP4 GGUF weights with their .scale / .input_scale companions, fuses QKO and gate/up on CUDA without loss, swaps in CudaNVFP4MLP to use the fused gated kernel, and adds --nvfp4-act. I found no definite numerical bug. The problems are in how it is put together:

  • configuration is passed through process env vars;
  • backend routing logic is copied into the example;
  • the GGUF loader is a hand-written copy of iter_checkpoint;
  • the core loader feature has no tests.

All 8 changed files were reviewed. No tests were run.

Code Quality

  • source_transformations/nvfp4.py:36-59: CudaNVFP4MLP.forward copies the routing in _gated_linear (backends/cuda/quantize_op_dispatch/nvfp4_dispatch.py:238-260).
    • What is duplicated:
      • _gated_linear already parses and validates ET_CUDA_NVFP4_ACT, handles w4a16, applies the BF16/FP32 dtype policy, checks can_launch_triton and _has_native_fp4(), and falls back to F.linear plus SiLU gating.
      • The fallback at lines 52-55 also repeats MuseGlimmerMLP.forward (model/model.py:460-469).
    • What is new: only the small-M check. Line 44 hard-codes 4, while _linear uses NVFP4_DECODE_MAX_ROWS (backends/cuda/triton/kernels/nvfp4_output.py:12).
    • Side effects: the example imports the private _has_native_fp4 alias, and test_nvfp4_mlp.py:66-68 has to monkeypatch the same check in three modules.
    • Risk: if NVFP4_DECODE_MAX_ROWS or the mode/dtype policy changes, this copy silently diverges from _gated_linear and _linear.
    • Fix:
      • Add statically_known_true(flat.shape[0] <= NVFP4_DECODE_MAX_ROWS) to the fallback condition in _gated_linear and update its docstring (lines 219-222) to match. The new MLP is the op's only non-test caller.
      • forward then becomes self.down_proj(torch.ops.triton.nvfp4_gated_linear.default(self.norm(x), self.gate_up_proj.weight)).
      • At minimum, use NVFP4_DECODE_MAX_ROWS.
    • Fix this →
  • source_transformations/nvfp4.py:24-34: from_mlp assigns attributes onto a bare cls(). There is no __init__, so CudaNVFP4MLP() on its own is a broken object. An explicit __init__(self, norm, gate_up_proj, down_proj) would make the module's state visible.
  • loaders/checkpoint_loader.py:396-434: _atomic_sd_from_gguf replaces the base's iter_checkpoint call with a hand-written loop.
    • Mismatch with the same file: _iter_mlx pairs its .scales companions inside a raw_iter and hands that to iter_checkpoint. This PR drops iter_checkpoint(gguf_path, key_map=gguf_to_model_key, convert=to_default, dtype=activation_dtype) and re-implements key mapping, conversion and casting.
    • Cast at line 433: it uses .to(dtype=activation_dtype) rather than maybe_cast (extension/llm/export/quant/convert.py:47). Integer tensors and non-castable subclasses, which maybe_cast leaves alone, now get cast too. As far as I can tell, current checkpoints don't hit this.
    • Fix this →
  • checkpoint_loader.py:405-428: companion pairing fails silently (low confidence).
    • A missing .scale becomes a global scale of 1.0 with no warning.
    • A companion that is collected but never matched to a weight is dropped.
    • With ET_CUDA_NVFP4_STATIC_ACT=1, a missing .input_scale quietly falls back to dynamic scaling.
    • extension/llm/export/gguf.py:27-31 says an NVFP4 weight is incomplete without its <name>.scale.
    • If a unit scale is the intended default for checkpoints without a .scale tensor, say so in a comment. Either way, raising on unconsumed companions is a cheap guard against loading a model with the wrong scale.
  • checkpoint_loader.py:354-379: the new CUDA branch leaves stale docstrings and a duplicated branch.
    • The module docstring (lines 9-11) says all inputs "share the same backend-packing path". Fused CUDA NVFP4 groups are now packed here, not in convert_quantized_tensors_for_cuda (_finalize, line 546).
    • The _fuse_state_dict docstring (lines 333-334) still says "Fused entries use fuse_along_output".
    • fuse_along_output(shards) appears in both else branches (lines 377 and 379); one else is enough.
  • README.md:403-440:
    • It points to backends/cuda/benchmarks/nvfp4_gemm_bench.py, which does not exist at this PR's head. If a later PR in the stack adds it, move the sentence there.
    • export_dflash also gains --nvfp4-act but is not mentioned, and its prefill M is 512 (export_dflash.py:837), not 4096.
    • Much of the section describes backend internals or reads like a changelog: Triton tile/warp tuning, median-of-three timing, "default timing for other quantized formats is unchanged", packed-scale immutability, "as current llama.cpp does". This belongs in the backends/cuda docs; in the example README it will go out of date.
  • Unrelated whitespace churn:
    • blank lines added inside import blocks at export_solo.py:40, :735, :974 and source_transformations/cuda.py:24;
    • the blank line after add_on_device_sampler(model) removed (export_solo.py:782);
    • a double blank line before the new README heading.

Infrastructure

  • .github/workflows/cuda.yml:713-717: test_nvfp4_mlp.py probably runs in no CI job.
    • The CUDA job runs an explicit list of muse-glimmer test files, and this file is not on it.
    • The module calls pytest.importorskip("triton") at import time, so the CPU jobs that pick up examples/models/muse-glimmer/tests through pytest.ini:119 will most likely skip it entirely.
    • Fix this →

Testing

  • The NVFP4 branch of _atomic_sd_from_gguf (checkpoint_loader.py:401-433) has no tests.
    • Untested behavior:
      • .scale / .input_scale pairing by name;
      • companions that come before or after their weight (the code comment calls this case out);
      • the scalar-F32 check;
      • the 1.0 default;
      • the ET_CUDA_NVFP4_STATIC_ACT opt-in.
    • The existing load_gguf_model(..., backend="cuda") tests (test_pipeline.py:777-783, :1214-1220) write no NVFP4 tensors. The new fusion test builds ExportableNVFP4Tensors by hand and calls _fuse_state_dict directly. So nothing reaches this branch.
    • The "every shard must be NVFP4" ValueError (lines 363-366) is also untested.
    • test_pipeline.py:717 and test_checkpoint_context.py:47 already write synthetic GGUFs with GGUFWriter.
    • Fix this →
  • tests/test_nvfp4_mlp.py does not reach the paths it parametrizes or is named after.
    • Lines 38-57: every mode takes the same fallback. M=1 hits the small-M check, and M=5 fails can_launch_triton on CPU tensors, so the three parametrized runs are identical. The invalid-mode ValueError is not tested.
    • Lines 60-83: the test checks only the parameter FQNs and that no CONSTANT_TENSOR appears. The fallback self.gate_up_proj(h) path produces the same parametrizations.weight.original0..2, so the test passes even if the gated op is never traced. Assert that the gated op appears in the graph.
  • backends/cuda/tests/test_nvfp4_fusion.py:405-451:
    • This backend test now depends on a private function from the examples tree. The existing _fuse_state_dict tests live in examples/models/muse-glimmer/tests/test_pipeline.py:838-858.
    • Line 444 can never fail, because _FUSION_GROUPS["mlx"] has no qko group (checkpoint_loader.py:318-323).

API Design

  • export_solo.py:1265-1272, export_dflash.py:1174-1180: --nvfp4-act always overwrites ET_CUDA_NVFP4_ACT.
    • Problem: nvfp4_dispatch.py:7-12 documents that env var as the backend's control. Because the flag defaults to "auto", ET_CUDA_NVFP4_ACT=w4a16 python -m …export_solo --backend cuda … silently exports with auto. On SM120 that can select W4A4 and change numerics.
    • No backend check: other backend-only flags are rejected with parser.error (export_solo.py:1282-1285), but --nvfp4-act is silently accepted with --backend mlx.
    • Defined twice: the DFlash copy has no help=, and the solo help text doesn't say what w4a16 does.
    • Fix:
      • Use default=None and set the env var only when the flag is given, or better, pass the mode explicitly.
      • Define the flag once, next to add_kv_layout_arguments.
    • Fix this →
  • checkpoint_loader.py:421: ET_CUDA_NVFP4_STATIC_ACT is a new setting that exists only as an env var.
    • It is CUDA-named, but it is read inside _atomic_sd_from_gguf, which every backend uses, so it changes MLX GGUF loads too.
    • It is missing from the env-var list in nvfp4_dispatch.py.
    • Unlike the activation mode, it has no CLI flag.
    • Make it a load_gguf_model(...) parameter with a matching CLI flag.

Recommendation

Request Changes

Must fix before landing:

  1. Stop the CLI from silently overriding ET_CUDA_NVFP4_ACT.
  2. Stop duplicating the _gated_linear routing in the example.
  3. Test the GGUF NVFP4 companion pairing, which is the core of this PR.
  4. Add test_nvfp4_mlp.py to the CUDA job.

The rest is cleanup.

@Gasoonjia

Copy link
Copy Markdown
Contributor Author

Thanks, narrowed.

  • Only test_cuda_source_transformations_swap_every_nvfp4_mlp reaches the CUDA dispatch, so it moved into test_nvfp4_mlp.py, which already imports the dispatch and stays out of the CPU session.
  • test_nvfp4_gguf_loader.py is back in the CPU session: pairing, static act, companions and fusion.
  • Re-ran the leak check on the top. The muse-glimmer directory (CPU collection), extension/llm/export and the 8da4w tests in one session pass, and executorch.backends.cuda.quantize_op_dispatch is never imported (session-level check). The six loader tests now run there.
  • Add an NVFP4 GGUF solo Muse Glimmer CUDA e2e job #25437's batching job already lists test_nvfp4_mlp.py, so its file list needs no change.

@Gasoonjia

Copy link
Copy Markdown
Contributor Author

@claude /pr-review

@claude

claude Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Claude finished @Gasoonjia's task in 22m 57s —— View job


Approve: no blockers. Three minor items remain: static activation scales are tested only on unfused weights, companion scale values are never range-checked, and --nvfp4-static-act is still accepted in cases where it has no effect.

Detailed review: PR #25428

Summary

This PR adds NVFP4 GGUF export for Muse Glimmer on CUDA:

  • it pairs .scale / .input_scale companions by name;
  • it fuses Q/K/O-gate and gate/up losslessly, with per-row global scales;
  • it swaps fused MLPs for CudaNVFP4MLP;
  • it adds --nvfp4-act and --nvfp4-static-act.

Three findings remain, all minor. The --nvfp4-static-act validation and two of the test gaps carry over from the last two rounds, which have had no reply yet.

Three independent reviewers covered all 12 changed files, and I re-read the code behind every finding. No tests were run, because this job cannot execute Python. Paths are relative to examples/models/muse-glimmer/ unless they start with backends/, extension/ or examples/.

Code Quality

  • Companion scale values are never range-checked (loaders/checkpoint_loader.py:405-409).
    • The first pass checks each companion's type and size, but not its value.
    • .scale: no check on the load or pack path looks at the value. to_exportable_nvfp4_tensor (extension/llm/export/gguf.py:506-516) and CudaNVFP4Tensor.__new__ (backends/cuda/nvfp4_tensor.py:91-96) check only dtype and size. A .scale that is 0, negative or NaN therefore exports all-zero, sign-flipped or NaN weights, with no error.
    • .input_scale with --nvfp4-static-act: ExportableNVFP4Tensor checks only that it is a scalar (extension/llm/export/nvfp4.py:105-109). The first range check is _act_scale_tensor (backends/cuda/nvfp4_tensor.py:19-22).
      • That check first runs inside _fuse_cuda_nvfp4. The broad except ValueError in _fuse_state_dict (loaders/checkpoint_loader.py:378-380) catches it, prints "Keeping … projections separate", and leaves the group unfused.
      • The same error then fails the export in _pack_nvfp4 (examples/models/gemma4_31b/cuda_packers.py:64-65), after the whole checkpoint has been converted.
    • Fix: in the first pass, next to the scalar check, raise for any companion whose value is not finite and positive. The pairing errors already fire there, before any weight is converted.
    • Fix this →

Testing

  • Static activation scales are tested only on unfused weights (tests/test_nvfp4_gguf_loader.py). Two reviewers reported the fusion gap.
    • Equal scales:
      • No test fuses shards that share an .input_scale and checks that the fused CudaNVFP4Tensor keeps act_per_tensor_scale (backends/cuda/nvfp4_tensor.py:151-162, :180).
      • Fusion is the only way static scales reach the fused Q/K/O-gate projection and nvfp4_w4a4_gate_up.
      • Equal scales are probably the common case, because the shards of each group read the same input.
    • Different scales:
      • test_cuda_nvfp4_group_stays_separate_when_unfusable (line 185) gives one shard a scale and leaves the others at None.
      • No test covers two different values, which is the torch.equal branch at backends/cuda/nvfp4_tensor.py:157 and the case README.md:423-424 documents.
    • Still open from the last two rounds:
      • TENSORS (line 64) has no token_embd.weight, so deleting the embedding exemption (loaders/checkpoint_loader.py:426) would fail no test.
      • No test runs export_solo.main with --nvfp4-act and a non-CUDA backend, or with --nvfp4-static-act and no --gguf. No test checks that --nvfp4-static-act reaches load_gguf_model (export/export_solo.py:1337). tests/test_checkpoint_context.py already runs main() with mocked loaders.
    • Fix: in the atomic_state_dict() tests, give every shard the same act scale and assert that the fused tensor carries it. Then give two shards different values and assert that the group stays separate.
    • Fix this →

API Design

  • Still open from the last two rounds: --nvfp4-static-act is accepted in cases where it has no effect (export/export_solo.py:1301-1302).
    • W4A16 path: this covers --nvfp4-act w4a16, and also auto on a GPU without native FP4.
      • The W4A16 kernels never read act_per_tensor_scale (nvfp4_gemv and nvfp4_w4a16, backends/cuda/quantize_op_dispatch/nvfp4_dispatch.py:348-355).
      • The flag's only remaining effect is negative: a group whose shards have different .input_scale values stays unfused.
    • GGUF with no NVFP4 weights: the missing check (loaders/checkpoint_loader.py:420-429) runs over an empty set, so the flag does nothing and reports nothing.
    • Python API: load_gguf_model(..., backend="mlx", nvfp4_static_act_scale=True) is not rejected either.
    • Fix: reject these combinations, or reply that the current behavior is intended.
    • Fix this →

Recommendation

Approve

Nothing blocks landing, and all three findings are minor. The cheapest one worth doing before landing is the equal-scale fusion test, because it covers the path static activation scales take in practice.


  • Gather context (diff, commit log)
  • Run three independent reviewers
  • Consolidate findings
  • Fact-check findings
  • Post review

@Gasoonjia

Copy link
Copy Markdown
Contributor Author

Rebased onto the upstream GGUF rework. The NVFP4 pairing in checkpoint_loader._iter_gguf_nvfp4_paired matches GGMLQuantizationType.NVFP4 now, because gguf.py no longer exports a GGML_NVFP4 id constant. Nothing else changed.

Authored with Claude Code.

@Gasoonjia

Copy link
Copy Markdown
Contributor Author

@claude /pr-review

@claude

claude Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Claude finished @Gasoonjia's task in 24m 5s —— View job


Request Changes: the branch still has the pre-rebase loader (5f32131 imports GGML_NVFP4), and the GGMLQuantizationType.NVFP4 lookup that the latest comment describes would break every GGUF load on gguf packages without that member. Everything else is minor.

Detailed review: PR #25428

Summary

This PR adds NVFP4 GGUF export for Muse Glimmer on CUDA:

  • it pairs .scale / .input_scale companions by name;
  • it fuses the Q/K/O-gate and gate/up groups with per-row global scales;
  • it swaps fused MLPs for CudaNVFP4MLP;
  • it adds --nvfp4-act and --nvfp4-static-act.

What was reviewed: the checked-out head 5f32131 was committed at 14:33 UTC, before the rebase comment at 18:13 UTC. In the 12 files this PR touches, it is identical to the previous push. So this review covers the pre-rebase loader. If the rebased commit has been pushed since, please re-run the review on it.

Findings:

  • One new finding blocks landing (Backward Compatibility).
  • Two new findings are minor (Code Quality and Testing).
  • The previous round's three findings have had no reply and are unchanged in the code, so they are repeated briefly below.

Three independent reviewers covered all 12 changed files, and I re-read the code behind every finding. No tests were run, because this job cannot execute Python. Paths are relative to examples/models/muse-glimmer/ unless they start with backends/, extension/, .github/, origin/main: or requirements-dev.txt.

Code Quality

  • The pairing pass converts and checks NVFP4 tensors that the key map later drops (low confidence) (loaders/checkpoint_loader.py:420-444; reported by all three reviewers).
    • iter_checkpoint drops names that gguf_to_model_key maps to None, but only after the raw iterator has yielded them (extension/llm/export/load.py:262-264).
    • An NVFP4 tensor outside _GGUF_KEY_MAP is therefore still converted, even though the model never uses it, and to_exportable_nvfp4_tensor can reject it (for example for a 0xff block-scale byte, extension/llm/export/gguf.py:500-505).
    • With --nvfp4-static-act, such a tensor must also carry an .input_scale. Only the embedding is exempt (line 426).
    • Confidence is low because this only matters for GGUFs that carry NVFP4 tensors the model does not load.
    • Fix: skip None-keyed weights in the conversion and in the missing check, but still count them as owners of their companions in the unpaired check. Fix this →
  • Still open from the previous round: companion values are never range-checked (loaders/checkpoint_loader.py:405-409).
    • .scale: the first pass checks each companion's type and size but not its value. to_exportable_nvfp4_tensor (extension/llm/export/gguf.py:506-516) and CudaNVFP4Tensor.__new__ (backends/cuda/nvfp4_tensor.py:91-98) check only dtype, size and device. A .scale that is 0, negative or NaN therefore exports zero, sign-flipped or NaN weights with no error.
    • .input_scale: a bad value is first rejected when a CudaNVFP4Tensor is built (backends/cuda/nvfp4_tensor.py:13-36). In fusion that only leaves the group unfused. The export then fails in packing, after the whole checkpoint has been converted.
    • Fix: in the first pass, raise for any companion value that is not finite and positive. Fix this →

Testing

  • The only test that loads an NVFP4 GGUF through load_gguf_model is in a file the CPU session ignores (tests/test_nvfp4_mlp.py:155-191; reported by one reviewer).
    • test_cuda_source_transformations_swap_every_nvfp4_mlp is the only coverage of:
      • _finalize passing pre-packed CudaNVFP4Tensors through convert_quantized_tensors_for_cuda (loaders/checkpoint_loader.py:570-575);
      • config.fuse_gate_up;
      • per-row scales surviving to gate_up_proj.weight.
    • Only lines 180-182 need Triton: cuda_source_transformations and the CudaNVFP4MLP check. The load half runs on CPU; tests/test_pipeline.py:798 already calls load_gguf_model(path, backend="cuda", ...) in the CPU session.
    • After Add an NVFP4 GGUF solo Muse Glimmer CUDA e2e job #25437, the file runs only in unittest-cuda-muse-glimmer-batching. Outside full runs, that job does not trigger on extension/llm/export or examples/models/gemma4_31b (.github/workflows/cuda.yml:661-675), which is where iter_checkpoint, iter_gguf and convert_quantized_tensors_for_cuda live.
    • Fix: move the load and dequant assertions into tests/test_nvfp4_gguf_loader.py, and keep only the swap in test_nvfp4_mlp.py. Fix this →
  • Still open from the previous rounds (all three reviewers re-reported the first two items):
    • Token-embedding exemption: nothing tests it (loaders/checkpoint_loader.py:426). TENSORS (tests/test_nvfp4_gguf_loader.py:64) has no token_embd.weight.
    • CLI checks: no test covers --nvfp4-act with a non-CUDA backend, --nvfp4-static-act without --gguf, or --nvfp4-static-act reaching load_gguf_model (export/export_solo.py:1337). tests/test_checkpoint_context.py already drives main() with mocked loaders (test_invalid_prefill_stops_export).
    • Static activation scales: they are tested only on unfused weights.
      • No test fuses shards that share an .input_scale and checks that the fused tensor keeps it.
      • No test gives two shards different non-None values. test_cuda_nvfp4_group_stays_separate_when_unfusable (line 183) sets a scale on one shard and leaves the rest None.
    • Smaller gaps: the ffn_up .input_scale (line 99) is never asserted, and the unpaired-companion test (line 122) covers only .scale.
    • Fix this →

API Design

  • Still open from the last three rounds: --nvfp4-static-act is accepted where it has no effect (export/export_solo.py:1301-1302, loaders/checkpoint_loader.py:420-429; all three reviewers re-reported it).
    • W4A16: this covers --nvfp4-act w4a16, and also auto on a GPU without native FP4 (backends/cuda/quantize_op_dispatch/nvfp4_dispatch.py:323-328).
      • The kernels that run there, nvfp4_gemv and nvfp4_w4a16 (lines 348-355), never read act_per_tensor_scale.
      • The flag's only remaining effect is that a group with differing .input_scale values stays unfused.
    • GGUF with no NVFP4 weights: the missing check runs over an empty set, so the flag silently does nothing.
    • Python API: load_gguf_model(..., backend="mlx", nvfp4_static_act_scale=True) is not rejected (loaders/checkpoint_loader.py:795-802).
    • Fix: reject these combinations, or reply that the current behavior is intended. Fix this →

Backward Compatibility

  • The branch still has the pre-rebase loader, and the lookup that the latest comment describes would break GGUF loading on older gguf packages (loaders/checkpoint_loader.py:398, :410; reported by all three reviewers).
    • On the branch: _iter_gguf_nvfp4_paired imports GGML_NVFP4 from extension/llm/export/gguf.py (line 398) and compares int(tensor.tensor_type) == GGML_NVFP4 (line 410).
    • After the rebase: the reworked gguf.py on origin/main (799098d) defines no GGML_* constants, so this import raises ImportError. load_gguf_model runs the iterator for every GGUF on every backend (:812, raw_iter at :460), so Q4_K/Q6_K checkpoints would fail too.
    • The described replacement: line 410 runs for every tensor that is not a companion. If the rebased code reads GGMLQuantizationType.NVFP4 there, every GGUF load raises AttributeError on a gguf package without that member. The PR's own test gate places that below gguf 0.19 (tests/test_nvfp4_gguf_loader.py:23-27).
      • This would undo the earlier reply that older gguf packages still load other checkpoints.
      • CI would not catch it: requirements-dev.txt:23 installs the latest gguf, and the NVFP4 tests skip on older packages.
    • Fix:
      • Push the rebased commit.
      • Look the type up the way the reworked module does, with GGMLQuantizationType.__members__.get(...) (origin/main:extension/llm/export/gguf.py:81), once before the loop, and compare tensor.tensor_type against the result. On older packages the lookup returns None, so no tensor matches.
    • Fix this →

Recommendation

Request Changes

Before this lands, the branch has to carry the rebased loader, with a guarded NVFP4 lookup so that older gguf packages still load non-NVFP4 checkpoints. Everything else is minor. For the three carried-over items, a reply that the behavior is intended is also fine.


  • Gather context (diff, commit log)
  • Run three independent reviewers
  • Consolidate findings
  • Fact-check findings
  • Post review

This branch was successfully deployed

1 active and 1 inactive deployments
upload-benchmark-results — 5f321315 Deployed Nov 23, 2026 by Gasoonjia via upload-benchmark-results #23165
cadence — 5f321315 Deployed Nov 23, 2026 by Gasoonjia via hifi-op-test / hifi4 #40338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant