Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

PEFT MoE conversion snapshot: add the Qwen3-Omni MoE text type and thinker aliases (#14344)

Daniel Hanc200c08be8a0
diff --git a/tests/version_compat/test_peft_conversion_symbol_backfill.py b/tests/version_compat/test_peft_conversion_symbol_backfill.py
index d34121250d4..f2fba070013 100644
--- a/tests/version_compat/test_peft_conversion_symbol_backfill.py
+++ b/tests/version_compat/test_peft_conversion_symbol_backfill.py
@@ -931,6 +931,15 @@ def test_a_moe_named_model_that_is_not_fused_still_loads():
assert stand_in.get(model_type, "fallback") == "fallback", model_type
+def test_a_not_fused_class_name_alias_loads_in_its_own_case():
+ """Upstream keys the Qwen3-Omni MoE thinker aliases by class name, mapped to the dense
+ Qwen2.5-Omni thinker. Matching the carve-out only in lowercase refused them on the "moe" hint."""
+ stand_in = F._UnavailableConversionPatternMap()
+ for alias in ("Qwen3OmniMoeThinkerModel", "Qwen3OmniMoeThinkerForConditionalGeneration"):
+ assert alias in F._PEFT_MOE_NAMED_NOT_FUSED, alias
+ assert stand_in.get(alias) is None, alias
+
+
def test_a_fused_moe_model_is_still_refused():
"""The carve-out must not reach the types that really do need the rewrite."""
stand_in = F._UnavailableConversionPatternMap()
diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py
index 5878c8f9919..49fd819d8ae 100644
--- a/unsloth/import_fixes.py
+++ b/unsloth/import_fixes.py
@@ -9081,6 +9081,7 @@ _PEFT_MOE_CONVERSION_PATTERNS = {
"qwen3_next": "qwen2_moe",
"qwen3_omni_moe": "qwen2_moe",
"qwen3_omni_moe_thinker": "qwen2_moe",
+ "qwen3_omni_moe_text": "qwen2_moe",
"solar_open": "qwen2_moe",
# Keyed by class name, not model type: transformers (main, October 2026) aliases the
# unlimited_ocr text model's class to qwen2_moe, and the lookup keeps its case.
@@ -9089,13 +9090,17 @@ _PEFT_MOE_CONVERSION_PATTERNS = {
# MoE-named types whose conversion family is NOT one of the two fused ones, so peft's
# _convert_peft_config_moe finds no mapping entry and returns without a rewrite. The substring
-# hint below raised for all three on the name alone. Checked before the hint, never instead of
+# hint below raised for these on the name alone. Checked before the hint, never instead of
# the snapshot above.
_PEFT_MOE_NAMED_NOT_FUSED = frozenset(
(
"granitemoehybrid",
"granitemoeshared",
"qwen3_5_moe_text",
+ # Keyed by class name: transformers (main, October 2026) aliases the Qwen3-Omni MoE
+ # thinker classes to the dense Qwen2.5-Omni thinker, which peft does not rewrite.
+ "Qwen3OmniMoeThinkerForConditionalGeneration",
+ "Qwen3OmniMoeThinkerModel",
)
)
@@ -9189,7 +9194,9 @@ class _UnavailableConversionPatternMap(dict):
# Both spellings: model types are lowercase, the class-name aliases are not.
if key in _PEFT_MOE_CONVERSION_PATTERNS or name in _PEFT_MOE_CONVERSION_PATTERNS:
return True
- if name in _PEFT_MOE_NAMED_NOT_FUSED or name in _PEFT_MOE_NAMED_NOT_CONVERTED:
+ if key in _PEFT_MOE_NAMED_NOT_FUSED or name in _PEFT_MOE_NAMED_NOT_FUSED:
+ return False
+ if name in _PEFT_MOE_NAMED_NOT_CONVERTED:
return False
return any(hint in name for hint in self._MOE_HINTS)