class_docstr: The dataset class for fine tune RETRO models.
  
  Args:
      data (list[strings], list[dicts]): (1) paths to .jsonl or .json files, (2) dict objects corresponding to each input example
      tokenizer (tokenizer): Tokenizer from frozen language model
      task_templates (dict): Dictionary containing all task template information needed to format prompts. Created in the GPTPromptLearningModel class.
      pad_token_id (int): ID of pad token from tokenizer
      max_seq_length (int): maximum sequence length for each dataset examples. Examples will either be truncated to fit this length or dropped if they cannot be truncated.
      min_seq_length (int): min length of each data example in the dataset. Data examples will be dropped if they do not meet the min length requirements. 
      add_bos (bool): Whether to add a beginning of sentence token to each data example
      add_eos (bool): Whether to add an end of sentence token to each data example
      for_train (bool): Whether you're creating a dataset for training or inference
      tokens_to_generate (int): (inference only) Number of tokens to generate during inference
code: def __init__(
      self,
      data,
      tokenizer,
      answer_only_loss: bool,
      pad_token_id: int,
      max_seq_length: int,
      add_bos: bool = False,
      add_eos: bool = True,
      max_num_samples: int = None,
      seed: int = 1234,
      neighbors: int = 20,
  ):
      self.tokenizer = tokenizer
      self.pad_token_id = pad_token_id
      self.max_seq_length = max_seq_length
      self.add_bos = add_bos
      self.add_eos = add_eos
      self.answer_only_loss = answer_only_loss
      self.max_num_samples = max_num_samples
      self.seed = seed
      self.neighbors = neighbors
  
      assert (
          self.max_seq_length > 0
      ), "Max sequence length should be greater than 0"
  
      logging.info("Loading and tokenizing dataset ... ")
  
      self.indexed_dataset = JSONLMemMapDataset(
          dataset_paths=[data],
          tokenizer=None,
          header_lines=0,
          workers=12,
      )
      # Will be None after this call if `max_num_samples` is None
      self._build_samples_mapping(data)
  
file_path: NeMo/nemo/collections/nlp/data/language_modeling/megatron/retro_fine_tune_dataset.py
imports: from random import sample
  import numpy
  import torch
  from nemo.collections.nlp.data.language_modeling.megatron.dataset_utils import get_samples_mapping
  from nemo.collections.nlp.data.language_modeling.text_memmap_dataset import JSONLMemMapDataset
  from nemo.core import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new RetroQAFineTuneDataset object from inherited base classes: Dataset with example: obj = RetroQAFineTuneDataset(data, tokenizer, answer_only_loss, pad_token_id, max_seq_length, add_bos, add_eos, max_num_samples, seed, neighbors)