{"record":{"id":"abbc06fd3492caef","repo":"jamiepine/voicebox","slug":"unknown-model-size-model-size","errorCode":null,"errorMessage":"Unknown model size: {model_size}","messagePattern":"Unknown model size: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/backends/mlx_backend.py","lineNumber":53,"sourceCode":"        return self.model is not None\n\n    def _get_model_path(self, model_size: str) -> str:\n        \"\"\"\n        Get the MLX model path.\n\n        Args:\n            model_size: Model size (1.7B or 0.6B)\n\n        Returns:\n            HuggingFace Hub model ID for MLX\n        \"\"\"\n        mlx_model_map = {\n            \"1.7B\": \"mlx-community/Qwen3-TTS-12Hz-1.7B-Base-bf16\",\n            \"0.6B\": \"mlx-community/Qwen3-TTS-12Hz-0.6B-Base-bf16\",\n        }\n\n        if model_size not in mlx_model_map:\n            raise ValueError(f\"Unknown model size: {model_size}\")\n\n        hf_model_id = mlx_model_map[model_size]\n        logger.info(\"Will download MLX model from HuggingFace Hub: %s\", hf_model_id)\n\n        return hf_model_id\n\n    def _is_model_cached(self, model_size: str) -> bool:\n        return is_model_cached(\n            self._get_model_path(model_size),\n            weight_extensions=(\".safetensors\", \".bin\", \".npz\"),\n        )\n\n    async def load_model_async(self, model_size: Optional[str] = None):\n        \"\"\"\n        Lazy load the MLX TTS model.\n\n        Args:\n            model_size: Model size to load (1.7B or 0.6B)","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/jamiepine/voicebox/blob/51f49dea198384b4eb6087b72c17057c6eb1c1cd/backend/backends/mlx_backend.py#L35-L71","documentation":"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.","triggerScenarios":"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\".","commonSituations":"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.","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."],"exampleFix":"// before\nawait mlx_backend.load_model_async(model_size=\"4B\")\n// after\nawait mlx_backend.load_model_async(model_size=\"1.7B\")","handlingStrategy":"validation","validationCode":"MLX_TTS_SIZES = {\"1.7B\", \"0.6B\"}\nif model_size not in MLX_TTS_SIZES:\n    raise ValueError(f\"model_size must be one of {sorted(MLX_TTS_SIZES)}; got {model_size!r}\")\nawait mlx_backend.load_model_async(model_size=model_size)","typeGuard":"def is_mlx_tts_size(value: str) -> bool:\n    return isinstance(value, str) and value in {\"1.7B\", \"0.6B\"}","tryCatchPattern":"try:\n    path = mlx_backend._get_model_path(model_size)\nexcept ValueError as exc:\n    if \"Unknown model size\" in str(exc):\n        # fall back to a known-good size or surface to the user\n        model_size = \"1.7B\"\n        path = mlx_backend._get_model_path(model_size)\n    else:\n        raise","preventionTips":["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."],"tags":["mlx","model-selection","validation","apple-silicon","qwen-tts"],"backgroundTag":null,"analyzedSha":"51f49dea198384b4eb6087b72c17057c6eb1c1cd","analyzedAt":"2026-08-12T16:51:42.824Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}