{"record":{"id":"76077e7bf5767234","repo":"OpenBMB/VoxCPM","slug":"unsupported-device-device-supported-values-ar","errorCode":null,"errorMessage":"Unsupported device '{device}'. Supported values are 'auto', 'cpu', 'mps', 'cuda', or indexed CUDA devices like 'cuda:0'.","messagePattern":"Unsupported device '(.+?)'\\. Supported values are 'auto', 'cpu', 'mps', 'cuda', or indexed CUDA devices like 'cuda:0'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/voxcpm/model/utils.py","lineNumber":239,"sourceCode":"    if explicit is None or explicit == \"auto\":\n        return auto_select_device(configured_device)\n\n    if explicit.startswith(\"cuda\"):\n        if not torch.cuda.is_available():\n            raise ValueError(\n                f\"Requested device '{device}', but CUDA is not available. \" \"Use device='auto' for automatic fallback.\"\n            )\n        return explicit\n    if explicit == \"mps\":\n        if not _has_mps():\n            raise ValueError(\n                \"Requested device 'mps', but MPS is not available. \" \"Use device='auto' for automatic fallback.\"\n            )\n        return \"mps\"\n    if explicit == \"cpu\":\n        return \"cpu\"\n\n    raise ValueError(\n        f\"Unsupported device '{device}'. Supported values are 'auto', 'cpu', 'mps', \"\n        \"'cuda', or indexed CUDA devices like 'cuda:0'.\"\n    )\n","sourceCodeStart":221,"sourceCodeEnd":243,"githubUrl":"https://github.com/OpenBMB/VoxCPM/blob/f5a1c6a6b901bc732e20f0d59a369f6829ad717a/src/voxcpm/model/utils.py#L221-L243","documentation":"The final else of resolve_runtime_device: any device string that is not 'auto', 'cpu', 'mps', 'cuda', or 'cuda:<index>' raises ValueError listing the supported forms.","triggerScenarios":"Passing device='gpu', 'CUDA', 'cuda-0', 'metal', or 'cuda:' (empty index).","commonSituations":"Porting code from other frameworks with different device naming (e.g. 'gpu'), or trailing whitespace/case typos in config files.","solutions":["Use exactly 'auto','cpu','mps','cuda', or 'cuda:0'-style strings, lowercase","Strip/normalize config-provided device strings before passing them","Validate device values against the supported set at config load time"],"exampleFix":"# before\nmodel = VoxCPM(..., device=\"GPU\")\n# after\nmodel = VoxCPM(..., device=\"auto\")","handlingStrategy":"validation","validationCode":"SUPPORTED = {\"auto\", \"cpu\", \"mps\", \"cuda\"}\nd = device.strip().lower()\nif d not in SUPPORTED and not (d.startswith(\"cuda:\") and d[5:].isdigit()):\n    d = \"auto\"","typeGuard":"def is_valid_device(s: str) -> bool:\n    s = s.strip().lower()\n    return s in {\"auto\",\"cpu\",\"mps\",\"cuda\"} or (s.startswith(\"cuda:\") and s[5:].isdigit())","tryCatchPattern":null,"preventionTips":["Normalize device strings at config load","Keep a whitelist of devices per deployment target"],"tags":["device-selection","value-error","configuration"],"backgroundTag":"unsupported-enum-value","analyzedSha":"f5a1c6a6b901bc732e20f0d59a369f6829ad717a","analyzedAt":"2026-08-27T05:54:30.617Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}