class_docstr: The dataset class for prompt-tuning or p-tuning pretrained T5 models.
class_docstr_tok: ["The","dataset","class","for","prompt-tuning","or","p-tuning","pretrained","T5","models","."]
code: def __init__(
      self,
      datasets,
      tokenizer,
      virtual_prompt_source: VirtualPromptSource,
      task_templates: dict,
      pseudo_tokens,
      pad_token_id: str,
      max_seq_length: int,
      min_seq_length: int = 1,
      add_bos: bool = False,
      add_eos: bool = True,
      for_train: bool = True,
      decoder_starts_with_pad: bool = False,
      add_eos_to_decoder_output: bool = True,
      add_sentinel_to_input: bool = True,
      ul2_prompt_token: str = None,
  ):
      # These two variables need to be set before calling super().__init__() because the parent class calls `load_data()` which requires these attributes.
      self.decoder_starts_with_pad = decoder_starts_with_pad
      self.add_eos_to_decoder_output = add_eos_to_decoder_output
      self.add_sentinel_to_input = add_sentinel_to_input
      self.ul2_prompt_token = ul2_prompt_token
      super().__init__(
          datasets=datasets,
          tokenizer=tokenizer,
          virtual_prompt_source=virtual_prompt_source,
          task_templates=task_templates,
          pseudo_tokens=pseudo_tokens,
          pad_token_id=pad_token_id,
          max_seq_length=max_seq_length,
          min_seq_length=min_seq_length,
          add_bos=add_bos,
          add_eos=add_eos,
          for_train=for_train,
      )
  
file_path: NeMo/nemo/collections/nlp/data/language_modeling/megatron/t5_prompt_learning_dataset.py
imports: import json
  import torch
  from tqdm.auto import tqdm
  from nemo.collections.nlp.data.language_modeling.megatron.base_prompt_learning_dataset import BasePromptLearningDataset
  from nemo.collections.nlp.models.language_modeling.megatron_t5_model import T5Sentinel
  from nemo.collections.nlp.modules.common import VirtualPromptSource
  from nemo.collections.nlp.modules.common.megatron.utils import build_position_ids
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new T5PromptLearningDataset object from inherited base classes: BasePromptLearningDataset with example: obj = T5PromptLearningDataset(datasets, tokenizer, virtual_prompt_source, task_templates, pseudo_tokens, pad_token_id, max_seq_length, min_seq_length, add_bos, add_eos, for_train, decoder_starts_with_pad, add_eos_to_decoder_output, add_sentinel_to_input, ul2_prompt_token)