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.

Add UnlimitedOcrTextModel to the fused-MoE conversion snapshot (#13867)

Daniel Hancc483b38523f
diff --git a/tests/version_compat/test_peft_conversion_symbol_backfill.py b/tests/version_compat/test_peft_conversion_symbol_backfill.py
index 5881e7764bd..d34121250d4 100644
--- a/tests/version_compat/test_peft_conversion_symbol_backfill.py
+++ b/tests/version_compat/test_peft_conversion_symbol_backfill.py
@@ -939,6 +939,15 @@ def test_a_fused_moe_model_is_still_refused():
stand_in.get(model_type)
+def test_a_fused_class_name_alias_is_refused_in_its_own_case():
+ """Upstream keys some fused entries by class name (UnlimitedOcrTextModel), which says nothing
+ about MoE: lowercasing it before the snapshot lookup let it fall through to a silent None."""
+ stand_in = F._UnavailableConversionPatternMap()
+ assert F._PEFT_MOE_CONVERSION_PATTERNS["UnlimitedOcrTextModel"] == "qwen2_moe"
+ with pytest.raises(RuntimeError, match = "conversion map"):
+ stand_in.get("UnlimitedOcrTextModel")
+
+
def test_an_unknown_moe_name_is_still_refused():
"""The hint stays for a fused type added after the snapshot: silently
returning the default there mis-converts the adapter."""
diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py
index f4c5354d77e..12da2bc8777 100644
--- a/unsloth/import_fixes.py
+++ b/unsloth/import_fixes.py
@@ -9023,6 +9023,9 @@ _PEFT_MOE_CONVERSION_PATTERNS = {
"qwen3_omni_moe": "qwen2_moe",
"qwen3_omni_moe_thinker": "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.
+ "UnlimitedOcrTextModel": "qwen2_moe",
}
# MoE-named types whose conversion family is NOT one of the two fused ones, so peft's
@@ -9124,7 +9127,8 @@ class _UnavailableConversionPatternMap(dict):
def _is_moe(self, key):
name = str(key).lower()
- if name in _PEFT_MOE_CONVERSION_PATTERNS:
+ # 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:
return False