From 1743d9805706fba86e89bff1de0b6410dd56252d Mon Sep 17 00:00:00 2001 From: Saba Fallah <10401143+sfallah@users.noreply.github.com> Date: Fri, 27 Mar 2026 00:07:55 +0100 Subject: [PATCH] mtmd: fix "v.patch_embd" quant and unsupported im2col ops on Metal for deepseek-ocr (#21027) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * mtmd: fix "v.patch_embd" quant and unsupported im2col ops on Metal for deepseek-ocr * Update src/llama-quant.cpp Co-authored-by: Sigbjørn Skjæret --------- Co-authored-by: Sigbjørn Skjæret --- convert_hf_to_gguf.py | 2 ++ src/llama-quant.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index 82d1004c65..bcf98cfae7 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -7150,6 +7150,8 @@ class DeepseekOCRVisionModel(MmprojModel): return gguf.GGMLQuantizationType.F32 if ".rel_pos_h" in name or '.rel_pos_w' in name: return gguf.GGMLQuantizationType.F32 + if ".neck." in name or ".net_" in name: + return gguf.GGMLQuantizationType.F32 return super().tensor_force_quant(name, new_name, bid, n_dims) def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iterable[tuple[str, Tensor]]: diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp index a1f87b3b35..3c8b32be08 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -345,9 +345,12 @@ static bool tensor_allows_quantization(const llama_model_quantize_params * param // do not quantize specific multimodal tensors quantize &= name.find(".position_embd") == std::string::npos; - quantize &= name.find("sam.patch_embd") == std::string::npos; quantize &= name.find("sam.pos_embd") == std::string::npos; + quantize &= name.find("sam.neck.") == std::string::npos; + quantize &= name.find("sam.net_") == std::string::npos; quantize &= name.find(".rel_pos") == std::string::npos; + quantize &= name.find(".patch_embd") == std::string::npos; + quantize &= name.find(".patch_merger") == std::string::npos; return quantize; }