code: def train_epoch(fabric, model, optimizer, train_dataloader, epoch):
      for batch_idx, batch in enumerate(train_dataloader):
          input, target = batch
          output = model(input, target)
          loss = F.nll_loss(output, target.view(-1))
          fabric.backward(loss)
          fabric.clip_gradients(model, optimizer, clip_val=0.25)
          optimizer.step()
          optimizer.zero_grad()
  
          if batch_idx % 200 == 0:
              fabric.print(
                  f"epoch: {epoch} - iteration: {batch_idx} - loss {loss.item():.4f}"
              )
  
file_path: pytorch-lightning/examples/fabric/language_model/train.py
imports: import lightning
  import torch
  import torch.nn.functional
  from lightning.pytorch.demos import Transformer, WikiText2
  from torch.utils.data import DataLoader, random_split
label_desc: Use image node_id 3 for calling a global function with example usage: train_epoch(fabric, model, optimizer, train_dataloader, epoch) without return types