unslothai/unsloth · error · RuntimeError
Model {self.active_model_name} is not an audio model
Error message
Model {self.active_model_name} is not an audio model What it means
generate_audio reads audio_type from the active model's registry entry; if it is unset the active model is not an audio/TTS model, and the routine raises RuntimeError('Model X is not an audio model'). This prevents dispatching an LLM or diffusion model into SNAC/codec-specific generation branches.
Source
Thrown at studio/backend/core/inference/inference.py:2071
min_p: float = 0.0,
max_new_tokens: int = 2048,
repetition_penalty: float = 1.0,
use_adapter: Optional[Union[bool, str]] = None,
cancel_event = None,
) -> Tuple[bytes, int]:
"""Generate audio from text for TTS models.
Returns (wav_bytes, sample_rate). Blocking — full audio before return.
"""
if not self.active_model_name:
raise RuntimeError("No active model")
model_info = self.models[self.active_model_name]
audio_type = model_info.get("audio_type")
model = model_info["model"]
tokenizer = model_info.get("tokenizer")
if not audio_type:
raise RuntimeError(f"Model {self.active_model_name} is not an audio model")
top_k = self._normalize_top_k(top_k)
# Every codec below concatenates its prompt instead of templating it, so this
# is the one choke point for all four (#7066).
text = neutralize_tts_prompt_text(text, audio_type)
if cancel_event is not None and cancel_event.is_set():
raise RuntimeError("Audio generation cancelled")
with self._generation_lock:
if cancel_event is not None and cancel_event.is_set():
raise RuntimeError("Audio generation cancelled")
if use_adapter is not None:
self._apply_adapter_state(use_adapter)
stopping_criteria = self._cancel_stopping_criteria(cancel_event)
if audio_type == "snac":
result = self._generate_snac(
model,View on GitHub (pinned to 203007d190)
Solutions
- Load the TTS model (orboyloo/universe-tts, orpheus, etc.) and make it active before audio calls
- If the engine supports one active model, orchestrate load→TTS→restore between chat and audio workloads
- Check the model's config identified it as audio at load time (audio_type populated)
Example fix
// before
engine.load_model("qwen2.5-7b")
engine.generate_audio("hello")
// after
engine.load_model("orpheus-3b")
engine.generate_audio("hello") Defensive patterns
Strategy: validation
Validate before calling
info = engine.models.get(engine.active_model_name, {})
if not info.get("audio_type"):
raise HTTPException(409, f"Active model '{engine.active_model_name}' is not a TTS model") Type guard
def is_audio_model(engine) -> bool:
return bool(engine.models.get(engine.active_model_name, {}).get("audio_type")) Try / catch
try:
engine.generate_audio(text)
except RuntimeError as e:
if "is not an audio model" in str(e):
load_tts_model_and_retry()
raise Prevention
- Check audio_type on the active model before calling TTS endpoints
- Don't assume the last loaded model is the right kind for the request
- Surface model-type metadata in load responses so clients can route
When it happens
Trigger: Calling the audio-generation endpoint while an LLM (or any non-audio model) is the active model — e.g. after loading a chat model and then hitting the TTS endpoint without switching models.
Common situations: Single-active-model architecture where users forget to switch; a shared engine instance serving both chat and TTS clients; automation scripts assuming a TTS model is resident.
Related errors
- No valid audio codes found after START_OF_SPEECH token
- No bicodec_semantic tokens found in generated output
- No DAC code tokens (c1/c2) found in generated output
- Audio generation cancelled
- Unknown audio_type: {audio_type}
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/1e1f2814a278b5be.
Report an issue: GitHub.