class_docstr: Dataset for training a NLI model for zero shot intent recognition. Similar to GLUE/MNLI
  dataset, but allows the user to specify which columns in the data files contain the
  premise, hypothesis, and gold label.
class_docstr_tok: ["Dataset","for","training","a","NLI","model","for","zero","shot","intent","recognition",".","Similar","to","GLUE\/MNLI","dataset",",","but","allows","the","user","to","specify","which","columns","in","the","data","files","contain","the","premise",",","hypothesis",",","and","gold","label","."]
docstr: Args:
      file_path: path to file
      tokenizer: such as AutoTokenizer
      max_seq_length: max sequence length including [CLS] and [SEP]
      sent1_col: the index of the column containing the premise (or sentence 1)
      sent2_col: the index of the column containing the hypothesis (or sentence 2)
      label_col: the index of the column containing the label
      num_classes: number of classes in the data (should be either 2 or 3, corresponding to
      labels ['entailment', 'not_entailment'] or ["contradiction", "entailment", "neutral"])
      use_cache: whether to use data cache
docstr_tok: ["Args",":","file_path",":","path","to","file","tokenizer",":","such","as","AutoTokenizer","max_seq_length",":","max","sequence","length","including","[","CLS","]","and","[","SEP","]","sent1_col",":","the","index","of","the","column","containing","the","premise","(","or","sentence","1",")","sent2_col",":","the","index","of","the","column","containing","the","hypothesis","(","or","sentence","2",")","label_col",":","the","index","of","the","column","containing","the","label","num_classes",":","number","of","classes","in","the","data","(","should","be","either","2","or","3",",","corresponding","to","labels","[","'entailment","'",",","'not_entailment","'","]","or","[","``","contradiction","''",",","``","entailment","''",",","``","neutral","''","]",")","use_cache",":","whether","to","use","data","cache"]
code: def __init__(
      self,
      file_path: str,
      tokenizer: TokenizerSpec,
      max_seq_length: str,
      sent1_col: int,
      sent2_col: int,
      label_col: int,
      num_classes: int,
      use_cache: bool = True,
  ):
      """
      Args:
          file_path: path to file
          tokenizer: such as AutoTokenizer
          max_seq_length: max sequence length including [CLS] and [SEP]
          sent1_col: the index of the column containing the premise (or sentence 1)
          sent2_col: the index of the column containing the hypothesis (or sentence 2)
          label_col: the index of the column containing the label
          num_classes: number of classes in the data (should be either 2 or 3, corresponding to
          labels ['entailment', 'not_entailment'] or ["contradiction", "entailment", "neutral"])
          use_cache: whether to use data cache
      """
      self.task_name = "mnli"  # for compatibility with parent class
      data_dir, file_name = os.path.split(file_path)
      logging.info(f"Processing {file_name}")
      self.tokenizer = tokenizer
      evaluate = False if "train" in file_name else True
      processor = ZeroShotIntentProcessor(
          sent1_col, sent2_col, label_col, num_classes
      )
      self.label_list = processor.get_labels()
      if not evaluate:
          self.examples = processor.get_train_examples(file_path)
  
          # check the labels found in the training set
          all_train_labels = [
              example.label for example in self.examples
          ]
          unique_labels = set(all_train_labels)
          if len(unique_labels) != num_classes:
              raise ValueError(
                  "Number of classes specified in config doesn't match the number found in the training data!"
              )
          elif len(unique_labels) == 2:
              if not unique_labels == set(self.label_list):
                  raise ValueError(
                      f"Found unexpected labels! For a two-class model, labels are expected to be {self.label_list}"
                  )
          elif len(unique_labels) == 3:
              if not unique_labels == set(self.label_list):
                  raise ValueError(
                      f"Found unexpected labels! For a three-class model, labels are expected to be {self.label_list}"
                  )
  
          # save the label map for reference
          label_file = os.path.join(data_dir, "label_ids.csv")
          with open(label_file, "w") as out:
              out.write("\n".join(self.label_list))
          logging.info(f"Labels: {self.label_list}")
          logging.info(f"Label mapping saved to : {label_file}")
  
      else:
          self.examples = processor.get_dev_examples(file_path)
  
      processor_name = type(processor).__name__
      vocab_size = getattr(tokenizer, "vocab_size", 0)
      cached_features_file = os.path.join(
          data_dir,
          "cached_{}_{}_{}_{}_{}".format(
              processor_name,
              file_name,
              tokenizer.name,
              str(max_seq_length),
              str(vocab_size),
          ),
      )
  
      if use_cache and os.path.exists(cached_features_file):
          logging.info(f"loading from {cached_features_file}")
          with open(cached_features_file, "rb") as reader:
              self.features = pickle.load(reader)
      else:
          token_params = {
              "bos_token": None,
              "eos_token": tokenizer.eos_token,
              "pad_token": tokenizer.pad_token,
              "cls_token": tokenizer.cls_token,
              "sep_token_extra": tokenizer.eos_token
              if "roberta" in tokenizer.name.lower()
              else None,
          }
  
          self.features = self.convert_examples_to_features(
              self.examples,
              self.label_list,
              max_seq_length,
              tokenizer,
              output_mode="classification",
              **token_params,
          )
          master_device = (
              not torch.distributed.is_initialized()
              or torch.distributed.get_rank() == 0
          )
          if master_device:
              logging.info(
                  f"Saving train features into {cached_features_file}"
              )
              with open(cached_features_file, "wb") as writer:
                  pickle.dump(self.features, writer)
  
imports: import os
  import pickle
  from typing import Dict, List, Optional
  import torch
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.data.data_utils.data_preprocessing import DataProcessor, fill_class_weights, get_freq_weights, get_label_stats
  from nemo.collections.nlp.data.glue_benchmark.data_processors import InputExample
  from nemo.collections.nlp.data.glue_benchmark.glue_benchmark_dataset import GLUEDataset
  from nemo.collections.nlp.parts.utils_funcs import tensor2list
  from nemo.core.neural_types import CategoricalValuesType, ChannelType, MaskType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 2 to create a new ZeroShotIntentDataset object from inherited base classes: GLUEDataset with example: obj = ZeroShotIntentDataset(file_path, tokenizer, max_seq_length, sent1_col, sent2_col, label_col, num_classes, use_cache)