{"record":{"id":"124e0522c61656b9","repo":"Lightning-AI/pytorch-lightning","slug":"precision-precision-r-is-not-supported-in-dee","errorCode":null,"errorMessage":"`precision={precision!r})` is not supported in DeepSpeed. `precision` must be one of: {supported_precision}.","messagePattern":"`precision=(.+?)\\)` is not supported in DeepSpeed\\. `precision` must be one of: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/plugins/precision/deepspeed.py","lineNumber":49,"sourceCode":"\n\nclass DeepSpeedPrecision(Precision):\n    \"\"\"Precision plugin for DeepSpeed integration.\n\n    Args:\n        precision: Full precision (32-true), half precision (16-true, bf16-true) or\n            mixed precision (16-mixed, bf16-mixed).\n\n    Raises:\n        ValueError:\n            If unsupported ``precision`` is provided.\n\n    \"\"\"\n\n    def __init__(self, precision: _PRECISION_INPUT) -> None:\n        supported_precision = get_args(_PRECISION_INPUT)\n        if precision not in supported_precision:\n            raise ValueError(\n                f\"`precision={precision!r})` is not supported in DeepSpeed.\"\n                f\" `precision` must be one of: {supported_precision}.\"\n            )\n        self.precision = precision\n\n        precision_to_type = {\n            \"bf16-mixed\": torch.bfloat16,\n            \"16-mixed\": torch.float16,\n            \"bf16-true\": torch.bfloat16,\n            \"16-true\": torch.float16,\n            \"32-true\": torch.float32,\n        }\n        self._desired_dtype = precision_to_type[self.precision]\n\n    @override\n    def convert_module(self, module: Module) -> Module:\n        if \"true\" in self.precision:\n            return module.to(dtype=self._desired_dtype)","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/plugins/precision/deepspeed.py#L31-L67","documentation":"DeepSpeedPrecision.__init__ validates the precision argument against the _PRECISION_INPUT literal tuple (e.g. '32-true', '16-true', '16-mixed', 'bf16-true', 'bf16-mixed', '64-true'). If the string you passed is not one of those exact values (typo, old format like 'fp16', or None), it raises this ValueError before the plugin is constructed.","triggerScenarios":"Creating DeepSpeedPrecision(precision=...) or DeepSpeedStrategy(precision=...) with a value outside get_args(_PRECISION_INPUT), e.g. 'fp16', 'bf16', 16, or 'mixed-precision'.","commonSituations":"Porting old PyTorch Lightning configs that used 'fp16'/'bf16' precision strings, or passing a raw torch.dtype instead of the string literal; typos like '16-mix'.","solutions":["Set precision to one of the supported string literals, e.g. '16-mixed' for fp16 mixed precision or 'bf16-mixed' for bfloat16 mixed precision","Check the value at runtime with typing.get_args(lightning.fabric.plugins.precision.deepspeed._PRECISION_INPUT) to see the exact accepted set","If you take precision from user config, validate/normalize it before passing it to DeepSpeedStrategy/DeepSpeedPrecision"],"exampleFix":"// before\nstrategy = DeepSpeedStrategy(precision=\"fp16\")\n// after\nstrategy = DeepSpeedStrategy(precision=\"16-mixed\")","handlingStrategy":"validation","validationCode":"from typing import get_args\nfrom lightning.fabric.plugins.precision.deepspeed import _PRECISION_INPUT\nassert precision in get_args(_PRECISION_INPUT), f\"bad precision: {precision!r}\"","typeGuard":"from typing import get_args\nfrom lightning.fabric.plugins.precision.deepspeed import _PRECISION_INPUT\n\ndef is_valid_precision(p: object) -> bool:\n    return isinstance(p, str) and p in get_args(_PRECISION_INPUT)","tryCatchPattern":"try:\n    strategy = DeepSpeedStrategy(precision=precision)\nexcept ValueError as e:\n    raise ConfigError(f\"fix precision setting: {e}\") from e","preventionTips":["Centralize precision strings in constants/enums in your config layer","Add a config schema check for precision before building strategies"],"tags":["deepspeed","precision","config-validation","pytorch-lightning"],"backgroundTag":"invalid-argument-value","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}