mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
mtp: --mtp-q4 head/all fails at bind when no draft head subset is installed
make_q4_head() was only reachable inside the draft_vocab.bin branch, so the flag silently drafted over the full head (and the 10-27 mtpq4 head-arm A/B measured nothing). bind() now errors with the fix instead. Still open in upstream v0.2.7 (same call shape at mtp.cpp:777).
This commit is contained in:
1 parent
c775728069
commit
9da37ce3e4
3 files changed
+11
-2
No files matched your search
@@ -63,7 +63,8 @@ public:
|
||||
bool hnorm_per_stream() const { return hnorm_stream_; }
|
||||
/// --mtp-q4 (opt-in; before load): the draft layer's Q8_0 projections and its draft head run from 4-bit (Q4_0)
|
||||
/// copies made at load/bind - fewer bytes per draft step; drafts only, the verify window decides every token.
|
||||
/// (The prompt path's batched K/V pass keeps the Q8_0 originals.)
|
||||
/// (The prompt path's batched K/V pass keeps the Q8_0 originals.) head/all need the draft head's subset;
|
||||
/// bind() fails without one instead of silently drafting over the full head.
|
||||
void set_q4(bool proj, bool head) { q4_ = proj; q4_head_ = head; }
|
||||
/// --mtp-draft-vocab FILE (opt-in; before bind): the draft head's token subset from FILE instead of
|
||||
/// rt/draft_vocab.bin (e.g. data/draft_vocab_en.bin, 40K tokens)
|
||||
|
||||
@@ -881,6 +881,12 @@ bool MtpDrafter::bind(const WeightTable& wt, const NativeHead* head, const float
|
||||
}
|
||||
}
|
||||
}
|
||||
if (q4_head_ && dhead_ == nullptr) {
|
||||
err = "mtp: --mtp-q4 head/all requantizes the draft head's subset, but no subset is installed - "
|
||||
"rt/draft_vocab.bin (or --mtp-draft-vocab FILE) is absent or empty, or STRATA_MTP_FULL_HEAD=1 "
|
||||
"excludes it; install one (tools/draft_vocab.py) or use --mtp-q4 proj";
|
||||
return false;
|
||||
}
|
||||
if (coupled_draft_env() && cparams_ == nullptr && !setup_coupled(err)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1135,7 +1135,8 @@ struct Options {
|
||||
/// --mtp-hnorm stream (opt-in): the draft layer's pre_fc_norm_hidden normalizes each hyper-connection stream on
|
||||
/// its own (llama.cpp's qwen4exp MTP graph) instead of one RMS over all four (the default, tools/mtp_probe.py).
|
||||
bool mtp_hnorm_stream = false;
|
||||
/// --mtp-q4 (opt-in): the draft layer's projections and draft head from 4-bit copies (fewer bytes per draft step)
|
||||
/// --mtp-q4 (opt-in): the draft layer's projections and draft head from 4-bit copies (fewer bytes per draft
|
||||
/// step); head/all need the draft head's subset (--mtp-draft-vocab FILE or rt/draft_vocab.bin) and fail without one
|
||||
std::string mtp_q4; ///< "" (off), all, proj (the projections only) or head (the draft head only)
|
||||
/// --mtp-draft-vocab FILE (opt-in): the draft head's token subset from FILE instead of <mtp>/draft_vocab.bin
|
||||
std::string mtp_draft_vocab;
|
||||
@@ -1309,6 +1310,7 @@ void usage() {
|
||||
" --mtp-hnorm pooled|stream the draft layer's hidden-input norm: one RMS over all four streams\n"
|
||||
" (default) or one per stream (llama.cpp's MTP graph)\n"
|
||||
" --mtp-q4 all|proj|head opt-in: the draft layer's projections and/or draft head as 4-bit copies\n"
|
||||
" (head/all need the draft head's subset: --mtp-draft-vocab / rt/draft_vocab.bin)\n"
|
||||
" --mtp-draft-vocab FILE opt-in: the draft head's token subset (default <mtp>/draft_vocab.bin)\n"
|
||||
" --draft mtp|dflash2 the draft source (default mtp); dflash2 needs --draft-model PACK (tools/dflash2_pack.py)\n"
|
||||
" and loads no MTP layer (--draft-fallback mtp keeps it as the fallback) (opt-in, Flash-Next, CUDA / HIP)\n"
|
||||
|
||||
Reference in new issue
Block a user