From 34097fbb02efdcc0498e235e5ff77809cd73446b Mon Sep 17 00:00:00 2001 From: Trevor Strieber Date: Tue, 28 Jul 2026 14:08:08 -0700 Subject: [PATCH] quant : do not require imatrix when the tensor keeps its type A tensor whose target type equals its current type is copied verbatim by the quantize loop (cur_type != new_type short-circuit), so the imatrix data is unused by construction. Only set requires_imatrix when the type actually changes, so that --tensor-type pins holding IQ-class tensors at their source type no longer abort a partial requantization with "this quantization requires an importance matrix!" (and no longer trigger the spurious --dry-run imatrix warning). --- src/llama-quant.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp index 92ebc11b99f..0742c9299b6 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -1050,7 +1050,9 @@ static void llama_model_quantize_impl(const std::string & fname_inp, const std:: metadata[i].target_type = tensor->type; } - metadata[i].requires_imatrix = tensor_requires_imatrix(tensor->name, metadata[i].target_type, ftype); + // tensors that keep their type are copied as-is and do not require an imatrix + metadata[i].requires_imatrix = metadata[i].target_type != tensor->type && + tensor_requires_imatrix(tensor->name, metadata[i].target_type, ftype); if (params->imatrix) { metadata[i].remapped_imatrix_name = remap_imatrix(tensor->name, mapped);