code: def train_dataloader(
      model, data_loader, optimizer, fabric, epoch, hparams, fold
  ):
      # TRAINING LOOP
      model.train()
      for batch_idx, (data, target) in enumerate(data_loader):
          # NOTE: no need to call `.to(device)` on the data, target
          optimizer.zero_grad()
          output = model(data)
          loss = F.nll_loss(output, target)
          fabric.backward(loss)  # instead of loss.backward()
  
          optimizer.step()
          if (batch_idx == 0) or (
              (batch_idx + 1) % hparams.log_interval == 0
          ):
              print(
                  "Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}".format(
                      epoch,
                      batch_idx * len(data),
                      len(data_loader.dataset),
                      100.0 * batch_idx / len(data_loader),
                      loss.item(),
                  )
              )
  
          if hparams.dry_run:
              break
  
file_path: pytorch-lightning/examples/fabric/kfold_cv/train_fabric.py
imports: import argparse
  from os import path
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import torchvision.transforms
  from lightning.fabric import Fabric, seed_everything
  from sklearn import model_selection
  from torch.utils.data import DataLoader, SubsetRandomSampler
  from torchmetrics.classification import Accuracy
  from torchvision.datasets import MNIST
label_desc: Use image node_id 1 for calling a global function with example usage: train_dataloader(model, data_loader, optimizer, fabric, epoch, hparams, fold) without return types