From 6c8850eb561e1a9b086ec938cacbfbc29aa1a97f Mon Sep 17 00:00:00 2001 From: yoshphys Date: Mon, 16 Mar 2026 22:04:10 +0900 Subject: [PATCH] fix(fish_qwen3_omni): support loading quantized/converted models in sanitize() sanitize() was skipping all keys that did not start with "text_model.model." or "audio_decoder.", including keys already in MLX format ("model.*"). This caused quantized models produced by mlx_audio.convert to fail to load with "Missing N parameters" error, because sanitize() returned an empty dict for such models. Fix: pass through "model.*" keys unchanged so that both the original HuggingFace weights and previously converted/quantized MLX weights are handled correctly. Co-Authored-By: Claude Sonnet 4.6 --- mlx_audio/tts/models/fish_qwen3_omni/fish_speech.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mlx_audio/tts/models/fish_qwen3_omni/fish_speech.py b/mlx_audio/tts/models/fish_qwen3_omni/fish_speech.py index 47ccdd96..1ef75f89 100644 --- a/mlx_audio/tts/models/fish_qwen3_omni/fish_speech.py +++ b/mlx_audio/tts/models/fish_qwen3_omni/fish_speech.py @@ -418,17 +418,19 @@ def load_weights(self, weights, strict: bool = True): def sanitize(self, weights: dict[str, mx.array]) -> dict[str, mx.array]: remapped = {} for key, value in weights.items(): - if key.startswith("text_model.model."): + if key.startswith("model."): + # Already in MLX format (e.g., previously converted/quantized model) + remapped[key] = value + elif key.startswith("text_model.model."): new_key = key[len("text_model.model.") :] + remapped[f"model.{new_key}"] = value elif key.startswith("audio_decoder."): suffix = key[len("audio_decoder.") :] if suffix.startswith("codebook_embeddings."): new_key = suffix else: new_key = f"fast_{suffix}" - else: - continue - remapped[f"model.{new_key}"] = value + remapped[f"model.{new_key}"] = value return remapped def _build_conversation(