class_docstr: T5 Finetuning model in the same format as MegatronGPTSFTModel 
class_docstr_tok: ["T5","Finetuning","model","in","the","same","format","as","MegatronGPTSFTModel"]
docstr: Dataloader produces a global batch which is turned into a list of microbatches.
  The list of microbatches is then piped through the pipeline using Apex fwd/bwd functions.
docstr_tok: ["Dataloader","produces","a","global","batch","which","is","turned","into","a","list","of","microbatches",".","The","list","of","microbatches","is","then","piped","through","the","pipeline","using","Apex","fwd\/bwd","functions","."]
code: def fwd_bwd_step(self, dataloader_iter, batch_idx, forward_only):
      """
      Dataloader produces a global batch which is turned into a list of microbatches.
      The list of microbatches is then piped through the pipeline using Apex fwd/bwd functions.
      """
      batch = next(dataloader_iter)
      if isinstance(batch, dict):
          # convert to list if not already converted.
          batch = self._process_batch(batch)
  
      # Get seq length of batch
      encoder_seq_length = batch[0].size(1)
      decoder_seq_length = batch[1].size(1)
  
      tensor_shape = [
          encoder_seq_length,
          get_micro_batch_size(),
          self.cfg.encoder.hidden_size,
      ]
      data_iter = get_iterator_k_split(batch, get_num_microbatches())
  
      return self._execute_fwd_bwd_function(
          data_iterator=data_iter,
          forward_only=forward_only,
          tensor_shape=tensor_shape,
          decoder_seq_length=decoder_seq_length,
      )
  
imports: import itertools
  import json
  from typing import Dict, List
  import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.common.data import ConcatMapDataset
  from nemo.collections.common.metrics import MetricStringToTorchMetric
  from nemo.collections.common.metrics.classification_accuracy import ExactStringPerCategoryMatchMetric
  from nemo.collections.nlp.data.common.sequence_to_sequence_dataset import SequenceToSequenceDataset
  from nemo.collections.nlp.data.language_modeling.megatron.t5_sft_dataset import T5SFTDataset
  from nemo.collections.nlp.models.language_modeling.megatron_t5_model import MegatronT5Model, T5Sentinel
  from nemo.collections.nlp.modules.common.megatron.utils import get_iterator_k_split
  from nemo.collections.nlp.parts.mixins.nlp_adapter_mixins import NLPAdapterModelMixin
  from nemo.collections.nlp.parts.utils_funcs import get_last_rank
  from nemo.utils import AppState, logging
label_desc: Use image node_id 11 for calling the MegatronT5SFTModel obj's underlying member method code with example usage: obj.fwd_bwd_step(dataloader_iter, batch_idx, forward_only) and returns: self