class_docstr: The dataset class for prompt-tuning or p-tuning pretrained GPT 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
      virtual_prompt_source (Enum): Either VirtualPromptSource.NO_PROMPTS or VirtualPromptSource.PROMPT_ENCODER
      task_templates (dict): Dictionary containing all task template information needed to format prompts. Created in the GPTPromptLearningModel class.
      pseudo_tokens (list[strings]): A list of virtual prompt token placeholders e.g [<prompt_1>, <prompt_2>, ...] up to max num virtual tokens
      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
docstr: Try to truncate input text to fit into the max sequence length 
docstr_tok: ["Try","to","truncate","input","text","to","fit","into","the","max","sequence","length"]
code: def _truncate_input(
      self,
      truncation_field,
      input_ids,
      taskname,
      doc,
      prompt_template,
      prompt_template_fields,
      virtual_token_splits,
  ):
      """Try to truncate input text to fit into the max sequence length"""
      logging.info(
          f"Input greater than max sequence length. Attempting to truncate: '{truncation_field}' in task: '{taskname}'"
      )
  
      # Truncate the text ids in this part of input to try and fit max sequence length
      if (
          truncation_field is not None
          and truncation_field in doc.keys()
      ):
          truncation_length = (len(input_ids) - self.max_seq_length) + 1
          field_text = doc[truncation_field]
  
          # Truncate field text
          field_text_ids = self.tokenizer.text_to_ids(field_text)
          truncated_text_ids = field_text_ids[
              : -min(truncation_length, len(field_text_ids))
          ]
          truncated_field_text = self.tokenizer.ids_to_text(
              truncated_text_ids
          )
          doc[truncation_field] = truncated_field_text
  
          # Re-insert the truncated text string into the text prompt
          input_example = prompt_template
          input_example = self._insert_text_in_template(
              input_example, prompt_template_fields, doc
          )
          input_example = self._insert_virtual_token_placeholders(
              input_example, virtual_token_splits
          )
  
          # Re-tokenize the whole prompt
          input_ids = self.tokenizer.text_to_ids(input_example)
  
      return input_ids
  
imports: import json
  import os
  import pickle
  import torch
  from tqdm.auto import tqdm
  from nemo.collections.nlp.modules.common import VirtualPromptSource
  from nemo.collections.nlp.modules.common.megatron.utils import build_position_ids
  from nemo.core import Dataset
  from nemo.utils import AppState, logging
label_desc: Use image node_id 6 for calling the GPTPromptLearningDataset obj's underlying member method code with example usage: obj._truncate_input(truncation_field, input_ids, taskname, doc, prompt_template, prompt_template_fields, virtual_token_splits) and returns: input_ids