jamiepine/voicebox · error · ValueError
Unknown Qwen3 size: {model_size}
Error message
Unknown Qwen3 size: {model_size} What it means
Raised by the PyTorch Qwen LLM backend's _get_model_path when model_size is not a key of PYTORCH_HF_REPOS, which contains "0.6B" (Qwen/Qwen3-0.6B), "1.7B" (Qwen/Qwen3-1.7B), and "4B" (Qwen/Qwen3-4B). Note this is the Qwen3 LLM (text) model, not the TTS model — the valid set differs from the TTS backends.
Source
Thrown at backend/backends/qwen_llm_backend.py:77
class PyTorchQwenLLMBackend:
"""Qwen3 LLM backend using HuggingFace transformers."""
def __init__(self, model_size: str = "0.6B"):
self.model = None
self.tokenizer = None
self.model_size = model_size
self._current_model_size: Optional[str] = None
self.device = self._get_device()
def _get_device(self) -> str:
return get_torch_device(allow_xpu=True, allow_directml=True, allow_mps=True)
def is_loaded(self) -> bool:
return self.model is not None
def _get_model_path(self, model_size: str) -> str:
if model_size not in PYTORCH_HF_REPOS:
raise ValueError(f"Unknown Qwen3 size: {model_size}")
return PYTORCH_HF_REPOS[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(self, model_size: Optional[str] = None) -> None:
if model_size is None:
model_size = self.model_size
if self.model is not None and self._current_model_size == model_size:
return
if self.model is not None and self._current_model_size != model_size:
self.unload_model()
await asyncio.to_thread(self._load_model_sync, model_size)
def _load_model_sync(self, model_size: str) -> None:View on GitHub (pinned to 51f49dea19)
Solutions
- Pass "0.6B", "1.7B", or "4B".
- Confirm you are calling the LLM backend, not a TTS backend, before assuming "4B" is valid.
- Normalize/case-fold the value where it enters the system.
Example fix
// before llm_backend.load_model(model_size="base") // after llm_backend.load_model(model_size="0.6B")
Defensive patterns
Strategy: validation
Validate before calling
from backend.backends.qwen_llm_backend import PYTORCH_HF_REPOS
if model_size not in PYTORCH_HF_REPOS:
raise ValueError(f"size must be one of {sorted(PYTORCH_HF_REPOS)}")
await llm_backend.load_model(model_size=model_size) Type guard
def is_qwen_llm_pytorch_size(value: str) -> bool:
from backend.backends.qwen_llm_backend import PYTORCH_HF_REPOS
return isinstance(value, str) and value in PYTORCH_HF_REPOS Try / catch
try:
await llm_backend.load_model(model_size=model_size)
except ValueError as exc:
if "Unknown Qwen3 size" in str(exc):
await llm_backend.load_model(model_size="0.6B")
else:
raise Prevention
- Remember this LLM backend also accepts "4B"; the TTS backends do not — keep them separate.
- Validate against PYTORCH_HF_REPOS keys rather than a hardcoded list.
- Normalize casing/whitespace before forwarding user input.
When it happens
Trigger: Calling load_model on the Qwen LLM backend with a string outside {"0.6B","1.7B","4B"} — e.g. "base", "1.7b", or a TTS-only token like "12Hz".
Common situations: Confusing the LLM size set with the TTS size set (TTS does not accept "4B"; this backend does); forwarding a whisper model name; case mismatch.
Related errors
- Unknown model size: {model_size}
- Unknown model size: {model_size}
- Unknown model 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/81286a1da9a33942.
Report an issue: GitHub.