def test_fabric_boring_lightning_module_automatic():
    """Test that basic LightningModules written for 'automatic optimization' work with Fabric."""
    fabric = Fabric(accelerator="cpu", devices=1)

    module = BoringModel()
    parameters_before = deepcopy(list(module.parameters()))

    optimizers, _ = module.configure_optimizers()
    dataloader = module.train_dataloader()

    model, optimizer = fabric.setup(module, optimizers[0])
    dataloader = fabric.setup_dataloaders(dataloader)

    batch = next(iter(dataloader))
    output = model.training_step(batch, 0)
    fabric.backward(output["loss"])
    optimizer.step()

    assert all(not torch.equal(before, after) for before, after in zip(parameters_before, model.parameters()))
Test that basic LightningModules written for 'automatic optimization' work with Fabric.
tests/tests_pytorch/models/test_fabric_integration.py