Skip to content

convert: the llama.cpp pin's convert_hf_to_gguf.py reads args.dspark but never registers --dspark, so every conversion dies with AttributeError #961

Closed

Description

@bong-water-water-bong

Filed while resuming the Zyphra lane (~/briefs/T1BP-ZYPHRA-STATE.md, entry 2026-11-03 18:5x). This lane hit it converting the
Zyphra originals and worked around it in a throwaway checkout; the pin itself was left untouched and the finding never got a
tracker. It is one argparse block, and it breaks every conversion from the pin, not just dspark ones.

Where

third_party/llama.cpp pin d8bd0ff6052a3cc15b5f83d8d0625aac5b644404, which is also fork
1bit-MONSTER/llama.cpp branch 1bit/hrx-vulkan-patched HEAD — so a fresh clone at the pin behaves the same way.
Fix PR (fork): 1bit/convert-dspark-flag.

Root cause

convert_hf_to_gguf.py main():

        if args.dspark:                                     # :261 in the pin

parse_args() registers --mtp, --no-mtp, --mistral-format, --fuse-gate-up-exps, --fp8-as-q8,
--sentence-transformers-dense-modules, --target-model-dir — and not --dspark. parse_args() therefore returns a
Namespace with no such attribute and main() raises before any model work: every model, every outtype, not only dspark ones.
The flag is otherwise a real, documented feature of this fork: src/models/deepseek41.cpp:226 tells the user to run
convert_hf_to_gguf.py --dspark, and conversion/deepseek41.py:301 implements DeepseekV41DSparkModel for exactly that flag.

Reproducer (before)

cd ~/cache/llama-pin-d8bd0ff6   # worktree at the pin, pristine convert_hf_to_gguf.py
PYTHONPATH=$PWD/gguf-py ~/venvs/d3ref/bin/python convert_hf_to_gguf.py \
  ~/models/zyphra-orig/ZR1-1.5B@6108a26d0cd7 --outtype bf16 --outfile /tmp/repro.gguf
INFO:hf-to-gguf:Loading model: ZR1-1.5B@6108a26d0cd7
INFO:hf-to-gguf:Model architecture: Qwen2ForCausalLM
Traceback (most recent call last):
  File ".../convert_hf_to_gguf.py", line 307, in <module>
    main()
  File ".../convert_hf_to_gguf.py", line 261, in main
    if args.dspark:
       ^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'dspark'

After (fork PR 1bit/convert-dspark-flag, +4 lines: one argparse block, nothing else)

check result
convert_hf_to_gguf.py --help lists [--dspark] and its help line
--dspark on a non-Deepseek model (ZR1-1.5B, Qwen2ForCausalLM) ERROR:hf-to-gguf:--dspark is only supported for DeepseekV4ForCausalLM and DeepseekV41ForCausalLM, exit 1 — the guard that was unreachable now runs
full BF16 conversion of Zyphra/ZR1-1.5B@6108a26d0cd7 from the pin, patched completes: 3,560,417,696 B, sha256 d817473c0e56d2389fb5b0dc633ca33bdc7ec0d82448c318283800c0728744f3
same conversion from the same originals, unpatched but with the same 4 lines applied in a local workaround (the reference this lane measured its whole quality table against) byte-identical — same size, same sha256 d817473c…

So for every non-dspark conversion the change is inert (same bytes out) and the dspark path stops being unreachable. Run was
~/lb/thermal-run.sh (4 cores, nice 19), 86 s wall for the 1.5B model.

Second half — same file, still broken, deliberately not in this PR

--dspark on a V4 (non-4.1) checkpoint does from conversion.deepseek import DeepseekV4DSparkModel, and
conversion/deepseek.py defines no such class (it has DeepseekModel, DeepseekV2Model, DeepseekV32Model,
DeepseekV4Model only) although both conversion/__init__.py and main() name it. So after this fix the V4.1 drafter path
works and the V4 one raises ImportError. Building it needs the checkpoint to test against (DeepSeek-V4-Flash-DSpark,
217 GiB-class family) — that is a DeepSeek V4.x conversion job, not an argparse one, so it is named here rather than guessed at.

Why it is worth an issue rather than a note in one lane's state file

Anything that converts from the pin dies on the first line of real work. This lane's artifacts and the other convert lanes'
were all produced with the same uncommitted local workaround, so nothing on disk is wrong — but a reader who clones the pin
and follows docs/ gets an AttributeError with no hint, and the flag the runtime error message tells them to pass does not exist.

Activity

  1. bong-water-water-bong commented on Nov 4, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Fix PR (fork): 1bit-MONSTER/llama.cpp#187 — branch 1bit/convert-dspark-flag, head 661382ba8ac5 (verified with ls-remote), base 1bit/hrx-vulkan-patched, i.e. the exact commit the pin points at (d8bd0ff6 is that branch's HEAD). +4 lines in parse_args(), nothing else. Not merged (owner merges), and it lands in the engine only when third_party/llama.cpp is bumped to a commit containing it — this issue is the tracker for that bump.

  2. bong-water-water-bong commented on Nov 4, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Provenance, from the pi-prs lane's independent find: the missing block is upstream's own — ggml-org/llama.cpp 3581ba0cf "convert: add option to create separate dspark GGUF (#26452)" adds parser.add_argument("--dspark", action="store_true", help="Export only the DeepSeek-V4 DSpark draft tensors as a separate GGUF."). Our branch has main()'s caller (:261) and none of the flag, so the fix restores it verbatim.

    PR head updated to fb176b5cdfc0fec87ffa37dc2a55bf8345872a26 (help text is now upstream's wording). Duplicate disclosed: pi-prs pushed 1bit/convert-dspark-arg (44b73c31) for the same four lines minutes later; I asked them to drop it, #187 is the single PR.

  3. bong-water-water-bong commented on Nov 4, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Final PR head: 9ee6a198497afd1a9ff80c07e21597de6958f6bc (the previous force-push had missed the working-tree change, so fb176b5 still carried my own help text; corrected and re-verified against the pushed blob through the contents API). Branch content now equals upstream 3581ba0cf's block verbatim.

  4. bong-water-water-bong commented on Nov 4, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Fork #187 is the fix and it is reviewed: the pin reads args.dspark at convert_hf_to_gguf.py:261 and registers no --dspark argument, so argparse raises AttributeError on every conversion; #187 adds the registration at :156. It does not, however, carry upstream 3581ba0cf's V4 class: on 1bit/hrx-vulkan-patched, conversion/deepseek.py has no DeepseekV4DSparkModel (nor conversion/qwen.py a Qwen3DSparkModel, though conversion/__init__.py:61 lists both), so --dspark + DeepseekV4ForCausalLM would still fail with ImportError — the DeepSeek-V4.1 path is the one that becomes usable. Details and the branch audit are in the #187 review.

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