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
code: def _input_sanity_checks(
      self,
      total_virtual_tokens,
      virtual_token_splits,
      prompt_template,
      prompt_template_fields,
      truncation_field,
      answer_only_loss,
      answer_field,
      doc,
  ):
      # Sanity check amount of virtual token
      assert (
          total_virtual_tokens < self.max_seq_length
      ), "virtual prompt tokens should not exceed max sequence length"
  
      # Make sure virtual token splits add up to the total number of virtual tokens
      assert (
          sum(virtual_token_splits) == total_virtual_tokens
      ), "Sum of prompt token split values must equal total number of prompt tokens"
  
      # Make sure number of virtual prompt locations match the number of virtual prompt splits
      assert prompt_template.count("<|VIRTUAL_PROMPT_") == len(
          virtual_token_splits
      ), "The number of '<|VIRTUAL_PROMPT_n|>' markers and the number of prompt token splits must match"
  
      # Check if input example has fields not present in template
      keys_not_in_template = list(
          set(doc.keys())
          - set(prompt_template_fields)
          - set(["taskname"])
      )
      assert (
          len(keys_not_in_template) == 0
      ), f"Examples in your dataset contain the fields: {keys_not_in_template} that are not in the task template."
  
      # Answer field checks
      if answer_only_loss and self.for_train:
          assert (
              answer_field is not None
          ), "If answer_only_loss=True, an answer_field must be given"
          assert (
              answer_field in doc.keys()
          ), f"answer_only_loss=True but the given answer_field '{answer_field}' is not in data json"
          assert (
              truncation_field != answer_field
          ), "Answer field and truncation field should not match"
  
          answer_placeholder = "{" + answer_field + "}"
          answer_placeholder_len = len(answer_placeholder)
          placeholder_start = (
              len(prompt_template) - answer_placeholder_len
          )
          assert (
              prompt_template[placeholder_start:] == answer_placeholder
          ), "Answer field must be at prompt end"
  
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 3 for calling the GPTPromptLearningDataset obj's underlying member method code with example usage: obj._input_sanity_checks(total_virtual_tokens, virtual_token_splits, prompt_template, prompt_template_fields, truncation_field, answer_only_loss, answer_field, doc) without return types