class_docstr: TextClassificationModel to be trained on two- or three-class textual entailment data, to be used for zero shot intent recognition.
class_docstr_tok: ["TextClassificationModel","to","be","trained","on","two-","or","three-class","textual","entailment","data",",","to","be","used","for","zero","shot","intent","recognition","."]
docstr: Lightning calls this inside the validation loop with the data from the validation dataloader
  passed in as `batch`.
docstr_tok: ["Lightning","calls","this","inside","the","validation","loop","with","the","data","from","the","validation","dataloader","passed","in","as","`","batch","`","."]
code: def validation_step(self, batch, batch_idx, split="val"):
      """
      Lightning calls this inside the validation loop with the data from the validation dataloader
      passed in as `batch`.
      """
      input_ids, input_type_ids, input_mask, labels = batch
      logits = self.forward(
          input_ids=input_ids,
          token_type_ids=input_type_ids,
          attention_mask=input_mask,
      )
  
      val_loss = self.loss(logits=logits, labels=labels)
  
      preds = torch.argmax(logits, axis=-1)
  
      tp, fn, fp, _ = self.classification_report(preds, labels)
  
      loss = {
          "val_loss": val_loss,
          "tp": tp,
          "fn": fn,
          "fp": fp,
          "logits": logits,
          "input_ids": input_ids,
          "labels": labels,
      }
      self.validation_step_outputs.append(loss)
      return loss
  
imports: import os
  from collections import defaultdict
  from typing import Dict, List, Optional, Union
  import numpy
  import torch
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
  from nemo.collections.nlp.data.dialogue import DialogueSGDDataProcessor
  from nemo.collections.nlp.data.dialogue.data_processor.assistant_data_processor import DialogueAssistantDataProcessor
  from nemo.collections.nlp.data.dialogue.data_processor.design_data_processor import DialogueDesignDataProcessor
  from nemo.collections.nlp.data.dialogue.dataset.dialogue_zero_shot_intent_dataset import DialogueZeroShotIntentDataset
  from nemo.collections.nlp.data.zero_shot_intent_recognition.zero_shot_intent_dataset import ZeroShotIntentInferenceDataset, calc_class_weights_from_dataloader
  from nemo.collections.nlp.metrics.classification_report import ClassificationReport
  from nemo.collections.nlp.metrics.dialogue_metrics import DialogueGenerationMetrics
  from nemo.collections.nlp.models import TextClassificationModel
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging
label_desc: Use image node_id 8 for calling the DialogueZeroShotIntentModel obj's underlying member method code with example usage: obj.validation_step(batch, batch_idx, split) and returns: loss