[Engine] drafting: gguf_facts stops at the first string array, so a renamed llama.cpp GGUF never "fits" and DFlash2 is refused

Aperta Adatta ai principianti
#6,695 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Inizia da gguf_facts() in terminal/strata_control/drafting.py, intorno alla riga 580, dove il ciclo chiave/valore si ferma al primo array di stringhe (break). Leggi il chiamante di file_fit() e la fixture di header esistente tests/terminal/data/flash_next_iq3s_header.gguf in tests/terminal/test_drafting_file_fit.py. È completato quando gguf_facts() restituisce layers, hidden e vocab per un GGUF il cui array general.tags precede le dimensioni, e un test con fixture copre questo caso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area

speed, kernels, models, the server and API

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build)

What happened

file_fit() (dd015b8c3, "drafting: decide DFlash2 by what the model file is when its name is not one setup writes") reads a GGUF's header to decide whether a run config with an unknown model_name is Qwen3.8-Flash-Next. gguf_facts() walks the key/value pairs and stops at the first array whose elements are strings (terminal/strata_control/drafting.py:580 in v0.2.19):

                else:
                    break                                   # an array of words before the tokens: not looked into

GGUFs written by llama.cpp's converter carry general.tags (and often general.languages) among the general.* keys, before <arch>.block_count and <arch>.embedding_length. For those files the reader returns no sizes, and file_fit() answers family for a file that is exactly the model. The start then logs Drafting: MTP (DFlash2 is for Qwen3.8-Flash-Next only) and runs the MTP, also when DFlash2 is chosen by name.

Every llama.cpp-written GGUF on this PC reads that way. general.tags is key 16 in Unsloth's Qwen3.8-27B UD-Q4_K_M and UD-Q4_K_XL, and key 17 in a Qwen3.8-Flash-Next ModelOpt NVFP4 file converted by tools/nvfp4_convert.py:

Qwen3.8-27B-UD-Q4_K_M.gguf   {'arch': 'qwen35',   'layers': None, 'hidden': None, 'vocab': None}
Qwen3.8-27B-UD-Q4_K_XL.gguf  {'arch': 'qwen35',   'layers': None, 'hidden': None, 'vocab': None}
gemma-4-31B-it-Q4_0.gguf     {'arch': 'gemma4',   'layers': None, 'hidden': None, 'vocab': None}
Flash-Next NVFP4 (ModelOpt)  {'arch': 'qwen4exp', 'layers': None, 'hidden': None, 'vocab': None}   -> file_fit: family

tests/terminal/data/flash_next_iq3s_header.gguf has no string array before tokenizer.ggml.tokens (its keys run general.architecture ... general.size_label, then qwen4exp.*), so test_drafting_file_fit.py passes.

Expected: the sizes are read past a string array, and a renamed Qwen3.8-Flash-Next GGUF fits.

A fix. Skip a string array (each element is a u64 length and its bytes) instead of stopping:

                elif etype == 8:
                    for _ in range(count):
                        (slen,) = struct.unpack_from("<Q", head, pos)
                        pos += 8 + slen
                else:
                    break

With it the NVFP4 file above reads {'arch': 'qwen4exp', 'layers': 48, 'hidden': 2560, 'vocab': 248320} and fits. A header fixture with general.tags before the sizes would cover it in test_drafting_file_fit.py.

Smallest steps or command that reproduce it
from strata_control import drafting as d
print(d.gguf_facts("<any llama.cpp-converted GGUF with general.tags>"))     # layers / hidden / vocab: None
print(d.file_fit(["--native", "<a Qwen3.8-Flash-Next GGUF with general.tags>"], "<its data folder>"))   # 'family'
Reproduction status

Reproduced locally

Strata version

Strata 0.2.15 through strata-nvfp4 0.2.15-nvfp4.7 (engine 0.1.61), where this was run. gguf_facts is byte-identical in v0.2.19, which was read, not run.

Graphics card, memory and system

RTX 5090 32 GB · 128 GB RAM · Windows 11

Model, size and settings

Unsloth Qwen3.8-27B UD-Q4_K_M and UD-Q4_K_XL, Gemma 4 31B Q4_0 (header read only); a Qwen3.8-Flash-Next ModelOpt NVFP4 checkpoint converted with tools/nvfp4_convert.py, served under its own model name

Logs
[strata] Drafting: MTP (DFlash2 is for Qwen3.8-Flash-Next only)
Lingua principale
C++
Stelle
11.6k
Fork
1k
Merge medio
17g 21h
PR unite (30g)
3

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Niko1221/Strata

Tutte le issue di Niko1221/Strata

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.