jamiepine/voicebox · error · ValueError
Unknown model size: {model_size}
Error message
Unknown model size: {model_size} What it means
Raised by MlxTTSBackend._get_model_path when model_size is not a key of mlx_model_map, whose only entries are "1.7B" (mlx-community/Qwen3-TTS-12Hz-1.7B-Base-bf16) and "0.6B" (mlx-community/Qwen3-TTS-12Hz-0.6B-Base-bf16). The map resolves the Apple-Silicon MLX weight repo on HuggingFace Hub, so an unknown size cannot be turned into a download path.
Source
Thrown at backend/backends/mlx_backend.py:53
return self.model is not None
def _get_model_path(self, model_size: str) -> str:
"""
Get the MLX model path.
Args:
model_size: Model size (1.7B or 0.6B)
Returns:
HuggingFace Hub model ID for MLX
"""
mlx_model_map = {
"1.7B": "mlx-community/Qwen3-TTS-12Hz-1.7B-Base-bf16",
"0.6B": "mlx-community/Qwen3-TTS-12Hz-0.6B-Base-bf16",
}
if model_size not in mlx_model_map:
raise ValueError(f"Unknown model size: {model_size}")
hf_model_id = mlx_model_map[model_size]
logger.info("Will download MLX model from HuggingFace Hub: %s", hf_model_id)
return hf_model_id
def _is_model_cached(self, model_size: str) -> bool:
return is_model_cached(
self._get_model_path(model_size),
weight_extensions=(".safetensors", ".bin", ".npz"),
)
async def load_model_async(self, model_size: Optional[str] = None):
"""
Lazy load the MLX TTS model.
Args:
model_size: Model size to load (1.7B or 0.6B)View on GitHub (pinned to 51f49dea19)
Solutions
- Pass one of the supported literals: "1.7B" (default, higher quality) or "0.6B" (faster, lighter).
- Normalize caller input before forwarding: value.strip() and uppercase the size token.
- If "4B" is required it is not supported by the MLX TTS engine — pick a different engine instead of retrying.
Example fix
// before await mlx_backend.load_model_async(model_size="4B") // after await mlx_backend.load_model_async(model_size="1.7B")
Defensive patterns
Strategy: validation
Validate before calling
MLX_TTS_SIZES = {"1.7B", "0.6B"}
if model_size not in MLX_TTS_SIZES:
raise ValueError(f"model_size must be one of {sorted(MLX_TTS_SIZES)}; got {model_size!r}")
await mlx_backend.load_model_async(model_size=model_size) Type guard
def is_mlx_tts_size(value: str) -> bool:
return isinstance(value, str) and value in {"1.7B", "0.6B"} Try / catch
try:
path = mlx_backend._get_model_path(model_size)
except ValueError as exc:
if "Unknown model size" in str(exc):
# fall back to a known-good size or surface to the user
model_size = "1.7B"
path = mlx_backend._get_model_path(model_size)
else:
raise Prevention
- Keep a single module-level constant for allowed MLX TTS sizes and validate against it everywhere.
- Normalize size strings (strip + uppercase the B) at the API boundary.
- Do not reuse LLM size constants for TTS — their valid sets differ.
When it happens
Trigger: Calling load_model_async(model_size=...) or _get_model_path(model_size) with anything other than the literal strings "1.7B" or "0.6B" — e.g. "4B", "1.7b", "base", "1.7B\n".
Common situations: Reusing a size string valid for the Qwen LLM backend (which also accepts "4B") against the TTS backend; case mismatch from user input; trailing whitespace from config; copying the engine default of a different engine.
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/abbc06fd3492caef.
Report an issue: GitHub.