Repository: Lightning-AI/pytorch-lightning
File: src/lightning/fabric/fabric.py (Python)

Code before:
from lightning.fabric.utilities.rank_zero import rank_zero_deprecation, rank_zero_warn
from lightning.fabric.utilities.registry import _load_external_callbacks
from lightning.fabric.utilities.seed import seed_everything
from lightning.fabric.utilities.types import ReduceOp
from lightning.fabric.utilities.warnings import PossibleUserWarning
from lightning.fabric.wrappers import (
    _FabricDataLoader,
    _FabricModule,
    _FabricOptimizer,
    _to_compiled,
    _unwrap_compiled,
    _unwrap_objects,
)

if TYPE_CHECKING:
    from torch.optim.lr_scheduler import _LRScheduler


def _do_nothing(*_: Any) -> None:
    pass


class Fabric:
    r"""Fabric accelerates your PyTorch training or inference code with minimal changes required.

    Features:
        - Automatic placement of models and data onto the device.
        - Automatic support for mixed and double precision (smaller memory footprint).
        - Seamless switching between hardware (CPU, GPU, TPU) and distributed training strategies
          (data-parallel training, sharded training, etc.).
        - Automated spawning of processes, no launch utilities required.
        - Multi-node support.

    Args:
        accelerator: The hardware to run on. Possible choices are:
            ``"cpu"``, ``"cuda"``, ``"mps"``, ``"gpu"``, ``"tpu"``, ``"auto"``.
            Defaults to ``"auto"``.
        strategy: Strategy for how to run across multiple devices. Possible choices are:
            ``"dp"``, ``"ddp"``, ``"ddp_spawn"``, ``"deepspeed"``, ``"fsdp"``, ``"auto"``.
            Defaults to ``"auto"``.
        devices: Number of devices to train on (``int``), which GPUs to train on (``list`` or ``str``), or ``"auto"``.
            The value applies per node. Defaults to ``"auto"``.
        num_nodes: Number of GPU nodes for distributed training. Defaults to ``1``.
        precision: Double precision (``"64"``), full precision (``"32"``), half precision AMP (``"16-mixed"``),
            or bfloat16 precision AMP (``"bf16-mixed"``). If ``None``, defaults will be used based on the device.
        plugins: One or several custom plugins as a single plugin or list of plugins.
        callbacks: A single callback or a list of callbacks. A callback can contain any arbitrary methods that
            can be invoked through :meth:`~lightning.fabric.fabric.Fabric.call` by the user.
        loggers: A single logger or a list of loggers. See :meth:`~lightning.fabric.fabric.Fabric.log` for more
            information.


Review comment (suggestion):
[nitpick] Consider using a more descriptive header like 'Key Features:' or 'Capabilities:' to better distinguish this section from the general class description.
```suggestion
    Key Features:
```

Code after:
from lightning.fabric.utilities.rank_zero import rank_zero_deprecation, rank_zero_warn
from lightning.fabric.utilities.registry import _load_external_callbacks
from lightning.fabric.utilities.seed import seed_everything
from lightning.fabric.utilities.types import ReduceOp
from lightning.fabric.utilities.warnings import PossibleUserWarning
from lightning.fabric.wrappers import (
    _FabricDataLoader,
    _FabricModule,
    _FabricOptimizer,
    _to_compiled,
    _unwrap_compiled,
    _unwrap_objects,
)

if TYPE_CHECKING:
    from torch.optim.lr_scheduler import _LRScheduler


def _do_nothing(*_: Any) -> None:
    pass


class Fabric:
    r"""Fabric accelerates your PyTorch training or inference code with minimal changes required.

    Key Features:
        - Automatic placement of models and data onto the device.
        - Automatic support for mixed and double precision (smaller memory footprint).
        - Seamless switching between hardware (CPU, GPU, TPU) and distributed training strategies
          (data-parallel training, sharded training, etc.).
        - Automated spawning of processes, no launch utilities required.
        - Multi-node support.

    Args:
        accelerator: The hardware to run on. Possible choices are:
            ``"cpu"``, ``"cuda"``, ``"mps"``, ``"gpu"``, ``"tpu"``, ``"auto"``.
            Defaults to ``"auto"``.
        strategy: Strategy for how to run across multiple devices. Possible choices are:
            ``"dp"``, ``"ddp"``, ``"ddp_spawn"``, ``"deepspeed"``, ``"fsdp"``, ``"auto"``.
            Defaults to ``"auto"``.
        devices: Number of devices to train on (``int``), which GPUs to train on (``list`` or ``str``), or ``"auto"``.
            The value applies per node. Defaults to ``"auto"``.
        num_nodes: Number of GPU nodes for distributed training. Defaults to ``1``.
        precision: Double precision (``"64"``), full precision (``"32"``), half precision AMP (``"16-mixed"``),
            or bfloat16 precision AMP (``"bf16-mixed"``). If ``None``, defaults will be used based on the device.
        plugins: One or several custom plugins as a single plugin or list of plugins.
        callbacks: A single callback or a list of callbacks. A callback can contain any arbitrary methods that
            can be invoked through :meth:`~lightning.fabric.fabric.Fabric.call` by the user.
        loggers: A single logger or a list of loggers. See :meth:`~lightning.fabric.fabric.Fabric.log` for more
            information.