{"record":{"id":"ae9ca89972e18f0a","repo":"2noise/ChatTTS","slug":"dtype-dtype-is-not-supported-in-rocm-supporte","errorCode":null,"errorMessage":"dtype '{dtype}' is not supported in ROCm. Supported dtypes are {rocm_supported_dtypes}","messagePattern":"dtype '(.+?)' is not supported in ROCm\\. Supported dtypes are (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"ChatTTS/model/velocity/configs.py","lineNumber":470,"sourceCode":"                torch_dtype = torch.float16\n            else:\n                torch_dtype = config_dtype\n        else:\n            if dtype not in _STR_DTYPE_TO_TORCH_DTYPE:\n                raise ValueError(f\"Unknown dtype: {dtype}\")\n            torch_dtype = _STR_DTYPE_TO_TORCH_DTYPE[dtype]\n    elif isinstance(dtype, torch.dtype):\n        torch_dtype = dtype\n    else:\n        raise ValueError(f\"Unknown dtype: {dtype}\")\n\n    if is_hip() and torch_dtype == torch.float32:\n        rocm_supported_dtypes = [\n            k\n            for k, v in _STR_DTYPE_TO_TORCH_DTYPE.items()\n            if (k not in _ROCM_NOT_SUPPORTED_DTYPE)\n        ]\n        raise ValueError(\n            f\"dtype '{dtype}' is not supported in ROCm. \"\n            f\"Supported dtypes are {rocm_supported_dtypes}\"\n        )\n\n    # Verify the dtype.\n    if torch_dtype != config_dtype:\n        if torch_dtype == torch.float32:\n            # Upcasting to float32 is allowed.\n            pass\n        elif config_dtype == torch.float32:\n            # Downcasting from float32 to float16 or bfloat16 is allowed.\n            pass\n        else:\n            # Casting between float16 and bfloat16 is allowed with a warning.\n            logger.warning(f\"Casting {config_dtype} to {torch_dtype}.\")\n\n    return torch_dtype\n","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/2noise/ChatTTS/blob/77b89ee281cd479f5b1a787ada330dc975ca1f2a/ChatTTS/model/velocity/configs.py#L452-L488","documentation":"vLLM-style engine config rejects float32 on ROCm (HIP) builds: the ROCm kernels in this fork only support a subset of dtypes, and float32 is explicitly excluded via _ROCM_NOT_SUPPORTED_DTYPE. The check happens in ModelConfig.__init__ while resolving the 'dtype' argument (default 'auto') against the torch dtype. The error message lists the dtypes that ARE allowed on ROCm.","triggerScenarios":"Calling the engine/model constructor on an AMD GPU with dtype='float32' or torch.float32 (or a config whose resolved auto dtype is float32) while is_hip() is True.","commonSituations":"Running vLLM-derived code on AMD MI GPUs; user copies a CUDA float32 recipe to an ROCm box; ChatTTS velocity engine loaded with explicit float32 for reproducibility.","solutions":["Pass a supported dtype such as dtype='float16' or dtype='bfloat16' when constructing the engine/model.","If you relied on 'auto', explicitly set a half-precision dtype because the resolved dtype became float32 on your ROCm build.","Verify you actually intended ROCm: on NVIDIA hardware is_hip() is False and float32 works; a ROCm torch build on an NVIDIA machine triggers this falsely - install a CUDA build instead."],"exampleFix":"# before\nengine = LLM(model=path, dtype='float32')\n\n# after\nengine = LLM(model=path, dtype='float16')","handlingStrategy":"validation","validationCode":"import torch\nfrom ChatTTS.model.velocity.configs import _ROCM_NOT_SUPPORTED_DTYPE, _STR_DTYPE_TO_TORCH_DTYPE\n\ndef resolve_rocm_dtype(dtype):\n    if not torch.version.hip:\n        return dtype\n    allowed = {k for k in _STR_DTYPE_TO_TORCH_DTYPE if k not in _ROCM_NOT_SUPPORTED_DTYPE}\n    return dtype if dtype in allowed else 'float16'","typeGuard":null,"tryCatchPattern":"try:\n    engine = LLM(model=path, dtype=dtype)\nexcept ValueError as e:\n    if 'not supported in ROCm' in str(e):\n        engine = LLM(model=path, dtype='float16')\n    else:\n        raise","preventionTips":["Decide dtype from torch.version.hip before constructing the engine.","Never hardcode float32 in configs shared across CUDA and ROCm machines."],"tags":["rocm","dtype","amd","gpu","configuration"],"backgroundTag":"unsupported-dtype-for-hardware","analyzedSha":"77b89ee281cd479f5b1a787ada330dc975ca1f2a","analyzedAt":"2026-08-26T17:48:24.233Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}