class_docstr: The base dataset class for prompt-tuning or p-tuning.
  TODO: (@adithyare) should be merged into GPTPromptLearningDataset
class_docstr_tok: ["The","base","dataset","class","for","prompt-tuning","or","p-tuning",".","TODO",":","(","@","adithyare",")","should","be","merged","into","GPTPromptLearningDataset"]
code: def pad_taskname_ids(self, taskname_ids):
      # Pad taskname_ids to be the same length for the prompt encoder
      if (
          self.virtual_prompt_source
          == VirtualPromptSource.PROMPT_ENCODER
      ):
          max_taskname_length = max(len(ids) for ids in taskname_ids)
          taskname_ids = [
              ids
              + [self.pad_token_id] * (max_taskname_length - len(ids))
              for ids in taskname_ids
          ]
          taskname_ids = torch.tensor(taskname_ids)
  
      # Task ids are just used for a look up embeddings for prompt-table
      elif self.virtual_prompt_source == VirtualPromptSource.NO_PROMPT:
          taskname_ids = torch.tensor(taskname_ids)
  
      return taskname_ids
  
file_path: NeMo/nemo/collections/nlp/data/language_modeling/megatron/base_prompt_learning_dataset.py
imports: import torch
  from nemo.collections.nlp.modules.common import VirtualPromptSource
  from nemo.core import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 8 for calling the BasePromptLearningDataset obj's underlying member method code with example usage: obj.pad_taskname_ids(taskname_ids) and returns: taskname_ids