class_docstr: A dataset class that converts from raw data to
  a dataset that can be used by DataLayerNM.
  Args:
      input_file: file to sequence + label.
          the first line is header (sentence [tab] label)
          each line should be [sentence][tab][label]
      tokenizer: tokenizer object such as AutoTokenizer
      max_seq_length: max sequence length minus 2 for [CLS] and [SEP]
      num_samples: number of samples you want to use for the dataset.
          If -1, use all dataset. Useful for testing.
      shuffle: Shuffles the dataset after loading.
      use_cache: Enables caching to use pickle format to store and read data from
code: def __init__(
      self,
      tokenizer: TokenizerSpec,
      input_file: str = None,
      queries: List[str] = None,
      max_seq_length: int = -1,
      num_samples: int = -1,
      shuffle: bool = False,
      use_cache: bool = False,
  ):
      if not input_file and not queries:
          raise ValueError(
              "Either input_file or queries should be passed to the text classification dataset."
          )
  
      if input_file and not os.path.exists(input_file):
          raise FileNotFoundError(
              f"Data file `{input_file}` not found! Each line of the data file should contain text sequences, where "
              f"words are separated with spaces and the label separated by [TAB] following this format: "
              f"[WORD][SPACE][WORD][SPACE][WORD][TAB][LABEL]"
          )
  
      self.input_file = input_file
      self.tokenizer = tokenizer
      self.max_seq_length = max_seq_length
      self.num_samples = num_samples
      self.shuffle = shuffle
      self.use_cache = use_cache
      self.vocab_size = self.tokenizer.vocab_size
      self.pad_id = tokenizer.pad_id
  
      self.features = None
      labels, all_sents = [], []
      if input_file:
          data_dir, filename = os.path.split(input_file)
          vocab_size = getattr(tokenizer, "vocab_size", 0)
          tokenizer_name = tokenizer.name
          cached_features_file = os.path.join(
              data_dir,
              f"cached_{filename}_{tokenizer_name}_{max_seq_length}_{vocab_size}_{num_samples}_{self.pad_id}_{shuffle}.pkl",
          )
  
          if get_envint("LOCAL_RANK", 0) == 0:
              if use_cache and os.path.exists(cached_features_file):
                  logging.warning(
                      f"Processing of {input_file} is skipped as caching is enabled and a cache file "
                      f"{cached_features_file} already exists."
                  )
                  logging.warning(
                      f"You may need to delete the cache file if any of the processing parameters (eg. tokenizer) or "
                      f"the data are updated."
                  )
              else:
                  with open(input_file, "r") as f:
                      lines = f.readlines()
                      logging.info(
                          f"Read {len(lines)} examples from {input_file}."
                      )
                      if num_samples > 0:
                          lines = lines[:num_samples]
                          logging.warning(
                              f"Parameter 'num_samples' is set, so just the first {len(lines)} examples are kept."
                          )
  
                      if shuffle:
                          random.shuffle(lines)
  
                      for index, line in enumerate(lines):
                          if index % 20000 == 0:
                              logging.debug(
                                  f"Processing line {index}/{len(lines)}"
                              )
                          line_splited = line.strip().split()
                          try:
                              label = int(line_splited[-1])
                          except ValueError:
                              logging.debug(f"Skipping line {line}")
                              continue
                          labels.append(label)
                          sent_words = line_splited[:-1]
                          all_sents.append(sent_words)
                  verbose = True
  
                  self.features = self.get_features(
                      all_sents=all_sents,
                      tokenizer=tokenizer,
                      max_seq_length=max_seq_length,
                      labels=labels,
                      verbose=verbose,
                  )
                  with open(cached_features_file, "wb") as out_file:
                      pickle.dump(
                          self.features,
                          out_file,
                          protocol=pickle.HIGHEST_PROTOCOL,
                      )
      else:
          for query in queries:
              all_sents.append(query.strip().split())
          labels = [-1] * len(all_sents)
          verbose = False
          self.features = self.get_features(
              all_sents=all_sents,
              tokenizer=tokenizer,
              max_seq_length=max_seq_length,
              labels=labels,
              verbose=verbose,
          )
  
      # wait until the master process writes to the processed data files
      if torch.distributed.is_initialized():
          torch.distributed.barrier()
  
      if input_file:
          with open(cached_features_file, "rb") as input_file:
              self.features = pickle.load(input_file)
  
imports: import os
  import pickle
  import random
  from typing import Dict, List, Optional
  import numpy
  import torch
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.data.data_utils.data_preprocessing import fill_class_weights, get_freq_weights, get_label_stats, get_stats
  from nemo.collections.nlp.parts.utils_funcs import list2str
  from nemo.core.classes import Dataset
  from nemo.core.neural_types import ChannelType, LabelsType, MaskType, NeuralType
  from nemo.utils import logging
  from nemo.utils.env_var_parsing import get_envint
label_desc: Use image node_id 2 to create a new TextClassificationDataset object from inherited base classes: Dataset with example: obj = TextClassificationDataset(tokenizer, input_file, queries, max_seq_length, num_samples, shuffle, use_cache)