code: def _step(self, batch: dict) -> Tuple:
      pad_token_id = self.tokenizer.pad_token_id
      src_ids, src_mask = batch["input_ids"], batch["attention_mask"]
      tgt_ids = batch["labels"]
      if isinstance(self.model, T5ForConditionalGeneration):
          decoder_input_ids = self.model._shift_right(tgt_ids)
      else:
          decoder_input_ids = shift_tokens_right(tgt_ids, pad_token_id)
      if (
          not self.already_saved_batch
      ):  # This would be slightly better if it only happened on rank zero
          batch["decoder_input_ids"] = decoder_input_ids
          self.save_readable_batch(batch)
  
      outputs = self(
          src_ids,
          attention_mask=src_mask,
          decoder_input_ids=decoder_input_ids,
          use_cache=False,
      )
      lm_logits = outputs["logits"]
      if self.hparams.label_smoothing == 0:
          # Same behavior as modeling_bart.py, besides ignoring pad_token_id
          ce_loss_fct = nn.CrossEntropyLoss(ignore_index=pad_token_id)
  
          assert lm_logits.shape[-1] == self.vocab_size
          loss = ce_loss_fct(
              lm_logits.view(-1, lm_logits.shape[-1]), tgt_ids.view(-1)
          )
      else:
          lprobs = nn.functional.log_softmax(lm_logits, dim=-1)
          loss, nll_loss = label_smoothed_nll_loss(
              lprobs,
              tgt_ids,
              self.hparams.label_smoothing,
              ignore_index=pad_token_id,
          )
      return (loss,)
  
imports: import argparse
  import glob
  import logging
  import os
  import sys
  import time
  from collections import defaultdict
  from pathlib import Path
  from typing import Dict, List, Tuple
  import numpy
  import pytorch_lightning
  import torch
  from torch import nn
  from torch.utils.data import DataLoader
  from callbacks import Seq2SeqLoggingCallback, get_checkpoint_callback, get_early_stopping_callback
  from transformers import MBartTokenizer, T5ForConditionalGeneration
  from transformers.models.bart.modeling_bart import shift_tokens_right
  from utils import ROUGE_KEYS, LegacySeq2SeqDataset, Seq2SeqDataset, assert_all_frozen, calculate_bleu, calculate_rouge, check_output_dir, flatten_list, freeze_embeds, freeze_params, get_git_info, label_smoothed_nll_loss, lmap, pickle_save, save_git_info, save_json, use_task_specific_params
  from lightning_base import BaseTransformer, add_generic_args, generic_train
label_desc: Use image node_id 5 for calling the SummarizationModule obj's underlying member method code with example usage: obj._step(batch) and returns: loss