docstr: Lightning calls this inside the training loop with the data from the training dataloader
  passed in as `batch`.
docstr_tok: ["Lightning","calls","this","inside","the","training","loop","with","the","data","from","the","training","dataloader","passed","in","as","`","batch","`","."]
code: def training_step(self, batch, batch_idx):
      """
      Lightning calls this inside the training loop with the data from the training dataloader
      passed in as `batch`.
      """
      # forward pass
      (
          input_ids,
          input_type_ids,
          input_mask,
          loss_mask,
          subtokens_mask,
          intent_labels,
          slot_labels,
      ) = batch
      intent_logits, slot_logits = self(
          input_ids=input_ids,
          token_type_ids=input_type_ids,
          attention_mask=input_mask,
      )
  
      # calculate combined loss for intents and slots
      intent_loss = self.intent_loss(
          logits=intent_logits, labels=intent_labels
      )
      slot_loss = self.slot_loss(
          logits=slot_logits, labels=slot_labels, loss_mask=loss_mask
      )
      train_loss = self.total_loss(loss_1=intent_loss, loss_2=slot_loss)
      lr = self._optimizer.param_groups[0]["lr"]
  
      self.log("train_loss", train_loss)
      self.log("lr", lr, prog_bar=True)
  
      return {
          "loss": train_loss,
          "lr": lr,
      }
  
imports: import os
  from typing import Dict, List, Optional
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from torch.utils.data import DataLoader
  from nemo.collections.common.losses import AggregatorLoss, CrossEntropyLoss
  from nemo.collections.nlp.data.dialogue.data_processor.assistant_data_processor import DialogueAssistantDataProcessor
  from nemo.collections.nlp.data.dialogue.dataset.dialogue_bert_dataset import DialogueBERTDataset, DialogueIntentSlotInferenceDataset
  from nemo.collections.nlp.data.intent_slot_classification import IntentSlotDataDesc
  from nemo.collections.nlp.metrics.classification_report import ClassificationReport
  from nemo.collections.nlp.metrics.dialogue_metrics import DialogueClassificationMetrics
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.collections.nlp.modules.common import SequenceTokenClassifier
  from nemo.collections.nlp.parts.utils_funcs import tensor2list
  from nemo.core.classes import typecheck
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging
label_desc: Use image node_id 9 for calling the IntentSlotClassificationModel obj's underlying member method code with example usage: obj.training_step(batch, batch_idx) and returns: dict