jamiepine/voicebox · error · ValueError
Unknown model size: {model_size}
Error message
Unknown model size: {model_size} What it means
Raised by PyTorchTTSBackend._get_model_path when model_size is not in hf_model_map, whose only keys are "1.7B" (Qwen/Qwen3-TTS-12Hz-1.7B-Base) and "0.6B" (Qwen/Qwen3-TTS-12Hz-0.6B-Base). The map maps a size token to the HuggingFace Hub repo for the PyTorch Qwen3-TTS base weights.
Source
Thrown at backend/backends/pytorch_backend.py:59
return self.model is not None
def _get_model_path(self, model_size: str) -> str:
"""
Get the HuggingFace Hub model ID.
Args:
model_size: Model size (1.7B or 0.6B)
Returns:
HuggingFace Hub model ID
"""
hf_model_map = {
"1.7B": "Qwen/Qwen3-TTS-12Hz-1.7B-Base",
"0.6B": "Qwen/Qwen3-TTS-12Hz-0.6B-Base",
}
if model_size not in hf_model_map:
raise ValueError(f"Unknown model size: {model_size}")
return hf_model_map[model_size]
def _is_model_cached(self, model_size: str) -> bool:
return is_model_cached(self._get_model_path(model_size))
async def load_model_async(self, model_size: Optional[str] = None):
"""
Lazy load the TTS model with automatic downloading from HuggingFace Hub.
Args:
model_size: Model size to load (1.7B or 0.6B)
"""
if model_size is None:
model_size = self.model_size
# If already loaded with correct size, return
if self.model is not None and self._current_model_size == model_size:View on GitHub (pinned to 51f49dea19)
Solutions
- Use "1.7B" or "0.6B" exactly.
- Whitelist/normalize at the API boundary so the backend only ever sees valid tokens.
- Keep TTS size constants separate from LLM size constants to avoid "4B" leaking through.
Example fix
// before backend.load_model_async(model_size="4B") // after backend.load_model_async(model_size="0.6B")
Defensive patterns
Strategy: validation
Validate before calling
PYTORCH_TTS_SIZES = {"1.7B", "0.6B"}
if model_size not in PYTORCH_TTS_SIZES:
raise ValueError(f"model_size must be one of {sorted(PYTORCH_TTS_SIZES)}")
await backend.load_model_async(model_size=model_size) Type guard
def is_pytorch_tts_size(value: str) -> bool:
return isinstance(value, str) and value in {"1.7B", "0.6B"} Try / catch
try:
await backend.load_model_async(model_size=model_size)
except ValueError as exc:
if "Unknown model size" in str(exc):
model_size = "1.7B"
await backend.load_model_async(model_size=model_size)
else:
raise Prevention
- Validate size at the MCP/engine boundary, not just inside the backend.
- Treat TTS and LLM size enums as separate constants.
- Surface the allowed set in the error message your caller sees.
When it happens
Trigger: Calling load_model_async or _get_model_path with a value other than "1.7B" or "0.6B" — e.g. "4B", lowercase "1.7b", or "large".
Common situations: Sharing one model-size constant across engines where only some accept it; passing the LLM backend's "4B" to the TTS backend; untrimmed UI input; mistaking whisper-style names ("base"/"turbo") for TTS sizes.
Related errors
- Unknown model size: {model_size}
- Unknown model size: {model_size}
- Unknown Qwen3 size: {model_size}
- Invalid STT model '{model_size}'. Must be one of: {', '.join
- RPC ${method}: ${json.error.message}
AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12).
Data as JSON: /api/errors/511c6d117a02d6f5.
Report an issue: GitHub.