From 889f2ec96deacbc2d8a9a67dbe181eaa43a2fb3b Mon Sep 17 00:00:00 2001 From: Tarek Dakhran Date: Fri, 30 Oct 2026 11:52:59 +0100 Subject: [PATCH] quant : allow quantization for LFM3-Audio codec decoder (#31386) * quantize : quantize the LFM3-Audio codec decoder, it is Q4_0 QAT * quantize : drop the QAT note from the LFM3-Audio comment --- conversion/lfm3.py | 3 --- src/llama-quant.cpp | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/conversion/lfm3.py b/conversion/lfm3.py index 435edd3de..a0287d4bb 100644 --- a/conversion/lfm3.py +++ b/conversion/lfm3.py @@ -453,9 +453,6 @@ class LFM3AudioMmprojModel(MmprojModel): def tensor_force_quant(self, name, new_name, bid, n_dims): if new_name.startswith("a.conv1d.") or "conv_dw" in new_name or new_name.startswith("a.gen.wav.quant."): return gguf.GGMLQuantizationType.F32 - # the codec decoder is small and its log-magnitude/phase output does not survive quantization - if new_name.startswith("a.gen.wav."): - return gguf.GGMLQuantizationType.F16 return super().tensor_force_quant(name, new_name, bid, n_dims) def generate_extra_tensors(self) -> Iterable[tuple[str, Tensor]]: diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp index 85da3831e..34c247858 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -352,10 +352,10 @@ static bool tensor_allows_quantization(const llama_model_quantize_params * param // do not quantize LFM3-VL's depthwise conv kernels, CONV_2D_DW takes F32 kernels quantize &= name.find("conv2d_spatial.weight") == std::string::npos; - // do not quantize LFM3-Audio's encoder convs and codec, the codec output does not survive quantization + // do not quantize LFM3-Audio's encoder convs, depthwise convs and the codec FSQ quantize &= name.rfind("a.conv1d.", 0) != 0; quantize &= name.find("conv_dw") == std::string::npos; - quantize &= name.rfind("a.gen.wav.", 0) != 0; + quantize &= name.rfind("a.gen.wav.quant.", 0) != 0; // do not quantize MiniMax's indexer projection weights, they are tiny quantize &= name.find("indexer.k_proj.weight") == std::string::npos;