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
Load speech-to-text models (Voxtral, Qwen2-Audio) through FastModel (#12127)
Daniel Hane3e0a2138a5e
diff --git a/tests/test_speech_to_text_auto_class.py b/tests/test_speech_to_text_auto_class.pynew file mode 100644index 00000000000..9d4ef5b9a59--- /dev/null+++ b/tests/test_speech_to_text_auto_class.py@@ -0,0 +1,40 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved.++"""Voxtral / Qwen2-Audio are not mapped under AutoModelForImageTextToText on transformers 5."""++import pytest++transformers = pytest.importorskip("transformers")++from unsloth.models.loader import _resolve_omni_auto_model, resolve_model_class # noqa: E402+from unsloth.models.vision import _multimodal_auto_classes # noqa: E402++try:+ from transformers import AutoModelForImageTextToText as IMAGE_TEXT_CLASS+except ImportError: # transformers 4.x+ from transformers import AutoModelForVision2Seq as IMAGE_TEXT_CLASS+++def _config(name):+ cls = getattr(transformers, name, None)+ if cls is None:+ pytest.skip(f"this transformers has no {name}")+ if getattr(transformers, "AutoModelForMultimodalLM", None) is None:+ pytest.skip("this transformers has no AutoModelForMultimodalLM")+ return cls()++[email protected]("name", ["VoxtralConfig", "VoxtralRealtimeConfig", "Qwen2AudioConfig"])+def test_speech_to_text_models_resolve_to_a_class_that_maps(name):+ config = _config(name)+ assert resolve_model_class(IMAGE_TEXT_CLASS, config) is None+ resolved = _resolve_omni_auto_model(config)+ assert resolved is not None+ assert resolve_model_class(resolved, config) is not None+ assert resolved in _multimodal_auto_classes()+++def test_qwen3_omni_keeps_text_to_waveform():+ config = _config("Qwen3OmniMoeConfig")+ assert _resolve_omni_auto_model(config) is transformers.AutoModelForTextToWaveformdiff --git a/unsloth/models/loader.py b/unsloth/models/loader.pyindex 82b2ed62524..44b14338867 100644--- a/unsloth/models/loader.py+++ b/unsloth/models/loader.py@@ -349,6 +349,8 @@ def _has_sequence_classification_architecture(config):_OMNI_AUTO_CLASS_NAMES = ("AutoModelForImageTextToText","AutoModelForTextToWaveform",+ # transformers 5 maps speech-to-text models (Voxtral, Qwen2-Audio) only here.+ "AutoModelForMultimodalLM",)diff --git a/unsloth/models/vision.py b/unsloth/models/vision.pyindex 7137b515421..c2dc47efa59 100644--- a/unsloth/models/vision.py+++ b/unsloth/models/vision.py@@ -58,6 +58,7 @@ def _multimodal_auto_classes():for name in ("AutoModelForImageTextToText","AutoModelForTextToWaveform",+ "AutoModelForMultimodalLM",):extra = getattr(transformers, name, None)if extra is not None and extra not in classes: