{"record":{"id":"940656c8b6827c4c","repo":"Lightning-AI/pytorch-lightning","slug":"the-modelparallelstrategy-does-not-support-fabr-940656","errorCode":null,"errorMessage":"The `ModelParallelStrategy` does not support `Fabric(..., precision={self._precision_flag!r})`. Choose a different precision among: {', '.join(mp_precision_supported)}.","messagePattern":"The `ModelParallelStrategy` does not support `Fabric\\(\\.\\.\\., precision=(.+?)\\)`\\. Choose a different precision among: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/trainer/connectors/accelerator_connector.py","lineNumber":505,"sourceCode":"                f\"Using {'16bit' if self._precision_flag == '16-mixed' else 'bfloat16'} Automatic Mixed Precision (AMP)\"\n            )\n            device = self._accelerator_flag if self._accelerator_flag in (\"cpu\", \"mps\") else \"cuda\"\n            return MixedPrecision(self._precision_flag, device)\n\n        raise RuntimeError(\"No precision set\")\n\n    def _validate_precision_choice(self) -> None:\n        \"\"\"Validate the combination of choices for precision, AMP type, and accelerator.\"\"\"\n        if isinstance(self._precision_plugin_flag, BitsandbytesPrecision) and not isinstance(\n            self.accelerator, CUDAAccelerator\n        ):\n            raise RuntimeError(\"Bitsandbytes is only supported on CUDA GPUs.\")\n        mp_precision_supported = (\"32-true\", \"bf16-mixed\", \"bf16-true\", \"16-true\")\n        if (\n            isinstance(self._strategy_flag, ModelParallelStrategy)\n            and self._precision_flag not in mp_precision_supported\n        ):\n            raise ValueError(\n                f\"The `ModelParallelStrategy` does not support `Fabric(..., precision={self._precision_flag!r})`.\"\n                f\" Choose a different precision among: {', '.join(mp_precision_supported)}.\"\n            )\n\n    def _lazy_init_strategy(self) -> None:\n        \"\"\"Lazily set missing attributes on the previously instantiated strategy.\"\"\"\n        self.strategy.accelerator = self.accelerator\n        if self.precision_plugin:\n            self.strategy.precision_plugin = self.precision_plugin\n        if self.checkpoint_io:\n            self.strategy.checkpoint_io = self.checkpoint_io\n        if hasattr(self.strategy, \"cluster_environment\"):\n            if self.strategy.cluster_environment is None:\n                self.strategy.cluster_environment = self.cluster_environment\n            self.cluster_environment = self.strategy.cluster_environment\n        if hasattr(self.strategy, \"parallel_devices\"):\n            if self.strategy.parallel_devices:\n                self._parallel_devices = self.strategy.parallel_devices","sourceCodeStart":487,"sourceCodeEnd":523,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/trainer/connectors/accelerator_connector.py#L487-L523","documentation":"ModelParallelStrategy (used for large-model sharding like FSDP2/torch distributed tensor flows) only supports a restricted precision set: '32-true', 'bf16-mixed', 'bf16-true', '16-true'. Requesting e.g. '16-mixed' or '64-true' raises ValueError. The message mistakenly references Fabric but applies to Trainer.","triggerScenarios":"Trainer(strategy=ModelParallelStrategy(), precision='16-mixed') or precision='64-true' with the model-parallel strategy selected.","commonSituations":"Adapting mixed-precision training scripts to model-parallel sharding; combining fp16 AMP configs with new-style model parallel strategies.","solutions":["Switch precision to a supported value, typically 'bf16-mixed' (recommended for model parallel)","If fp16 AMP is required, use a different strategy (e.g. FSDPStrategy) that supports '16-mixed'"],"exampleFix":"# before\ntrainer = Trainer(strategy=ModelParallelStrategy(), precision=\"16-mixed\")\n# after\ntrainer = Trainer(strategy=ModelParallelStrategy(), precision=\"bf16-mixed\")","handlingStrategy":"validation","validationCode":"MP_SUPPORTED = (\"32-true\", \"bf16-mixed\", \"bf16-true\", \"16-true\")\nif isinstance(strategy, ModelParallelStrategy) and precision not in MP_SUPPORTED:\n    precision = \"bf16-mixed\"\ntrainer = Trainer(strategy=strategy, precision=precision)","typeGuard":"def model_parallel_precision_ok(strategy, precision) -> bool:\n    MP = (\"32-true\", \"bf16-mixed\", \"bf16-true\", \"16-true\")\n    from lightning.pytorch.strategies import ModelParallelStrategy\n    return not isinstance(strategy, ModelParallelStrategy) or precision in MP","tryCatchPattern":null,"preventionTips":["Default to bf16-mixed when using model parallel strategies","Validate precision against strategy requirements in your config loader"],"tags":["pytorch-lightning","model-parallel","precision","unsupported-combination"],"backgroundTag":"strategy-precision-incompatible","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}