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","."]
docstr: Prepares enc_input, dec_input, labels, loss_mask, enc_mask, dec_mask, position_ids, taskname_ids for global batch 
docstr_tok: ["Prepares","enc_input",",","dec_input",",","labels",",","loss_mask",",","enc_mask",",","dec_mask",",","position_ids",",","taskname_ids","for","global","batch"]
code: def collate_fn(self, batch):
      """Prepares enc_input, dec_input, labels, loss_mask, enc_mask, dec_mask, position_ids, taskname_ids for global batch"""
  
      taskname_ids, enc_input, dec_input, dec_labels = zip(*batch)
  
      taskname_ids = self.pad_taskname_ids(taskname_ids)
  
      (
          enc_input,
          dec_input,
          labels,
          loss_mask,
          enc_mask,
          dec_mask,
      ) = self.pad_batch_and_build_loss_mask(
          enc_input, dec_input, dec_labels
      )
  
      position_ids = build_position_ids(enc_input).contiguous()
  
      return (
          enc_input,
          dec_input,
          labels,
          loss_mask,
          enc_mask,
          dec_mask,
          position_ids,
          taskname_ids,
      )
  
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 4 for calling the T5PromptLearningDataset obj's underlying member method code with example usage: obj.collate_fn(batch) and returns: enc_input,  dec_input,  labels,  loss_mask,  enc_mask,  dec_mask,  position_ids,  taskname_ids