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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Add longcat_flash_lsa to the fused-MoE conversion snapshot (#12018)
Daniel Han76b6cabcae04
diff --git a/tests/version_compat/test_peft_conversion_symbol_backfill.py b/tests/version_compat/test_peft_conversion_symbol_backfill.pyindex c2ccc67bfe1..62a30fcffe5 100644--- a/tests/version_compat/test_peft_conversion_symbol_backfill.py+++ b/tests/version_compat/test_peft_conversion_symbol_backfill.py@@ -986,6 +986,22 @@ def test_the_moe_snapshot_matches_the_installed_transformers():assert not missing, f"fused MoE model types missing from the snapshot: {sorted(missing)}"+def test_the_snapshot_covers_the_types_unsloth_registers_itself():+ """Unsloth adds its own model types to the live map at runtime, so whether the comparison+ above sees them depends on which tests ran first in the worker. Checked here directly, so+ a registration the snapshot does not know about fails every time, not only in some orders.+ """+ source = (+ Path(__file__).resolve().parents[2] / "unsloth" / "models" / "longcat_lsa.py"+ ).read_text(encoding = "utf-8")+ assert 'LONGCAT_LSA_MODEL_TYPE = "longcat_flash_lsa"' in source+ assert 'table.setdefault(LONGCAT_LSA_MODEL_TYPE, table["longcat_flash"])' in source+ assert (+ F._PEFT_MOE_CONVERSION_PATTERNS["longcat_flash_lsa"]+ == (F._PEFT_MOE_CONVERSION_PATTERNS["longcat_flash"])+ )++def test_an_unrelated_string_dictionary_is_not_installed_as_the_map(fake_modules):"""Shape alone selects the biggest `dict[str, str]`, not the right one.diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.pyindex e4a8b86c748..ddb0162deac 100644--- a/unsloth/import_fixes.py+++ b/unsloth/import_fixes.py@@ -7490,6 +7490,10 @@ _PEFT_MOE_CONVERSION_PATTERNS = {"glm_moe_dsa": "qwen2_moe","hunyuan_v1_moe": "qwen2_moe","longcat_flash": "qwen2_moe",+ # Not a transformers type: unsloth/models/longcat_lsa.py registers it into transformers' and+ # peft's tables with longcat_flash's family, so once that has run in a process the live map+ # carries it and the snapshot has to agree.+ "longcat_flash_lsa": "qwen2_moe","mellum": "qwen2_moe","olmoe": "qwen2_moe","qwen3_moe": "qwen2_moe",