From d646c9d15500a702425e8a90c19d2400deecbd0c Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 3 Sep 2026 10:37:23 +0300 Subject: [PATCH] convert : skip bias_vl tensor in DeepSeek-V4 DSpark conversion (#28294) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * convert : skip bias_vl tensor in DeepSeek-V4 DSpark conversion The DFLASH arch does not include FFN_EXP_PROBS_B_VL, so the DSpark conversion failed when it tried to write the mtmd-only hash routing tensor ffn.gate.bias_vl. Drop it like the tid2eid tensor; the DFLASH draft only consumes ffn.gate.bias via FFN_EXP_PROBS_B. Assisted-by: pi:llama.cpp/DeepSeek-V4-Flash-0731 * cont : fix Co-authored-by: Sigbjørn Skjæret --------- Co-authored-by: Sigbjørn Skjæret --- conversion/deepseek.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/conversion/deepseek.py b/conversion/deepseek.py index abaed7880b..817eb76128 100644 --- a/conversion/deepseek.py +++ b/conversion/deepseek.py @@ -1007,6 +1007,13 @@ class DeepseekV4DSparkModel(DeepseekV4Model): return self._DSPARK_ROOT_MAP[name] return super()._map_dsv4_tensor_name(name, bid) + def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iterable[tuple[str, Tensor]]: + # the DFlash draft uses the plain exp-probs bias (ffn.gate.bias -> FFN_EXP_PROBS_B); + # the mtmd-only hash routing tensors (bias_vl, tid2eid) are not part of the DFLASH arch + if name.endswith(".ffn.gate.bias_vl"): + return + yield from super().modify_tensors(data_torch, name, bid) + def set_vocab(self): if self.target_model_dir is None: raise ValueError("DeepSeek-V4 DSpark requires --target-model-dir with the target tokenizer")