class_docstr: Generate a Prompt and concatenate it with the input.
  
  This is the training time version of prompting a model. Calling the injected `prompt` module will generate your
  unbatched prompt. This model then replicates it for the batched input and concatenates them together.
  
  Attributes:
      prompt: The module that actually generates the unbatched prompt.
      combine: A function that combines the prompt and the embedded input.
code: def __init__(
      self,
      adapter_name: str,
      prompt_tuning_config: PromptTuningConfig,
      model_config: PretrainedConfig,
      base_model_embeddings: nn.Module,
  ):
      super().__init__()
  
      self.name = adapter_name
      self.model_config = model_config
      self.prompt_tuning_config = prompt_tuning_config
  
      embedding_size = getattr(
          model_config, "embedding_size", model_config.hidden_size
      )
  
      self.prompt_embedding = nn.Embedding(
          num_embeddings=prompt_tuning_config.prompt_length,
          embedding_dim=embedding_size,
      )
      # Initialize prompt tokens
      self.prompt_tokens = torch.arange(
          prompt_tuning_config.prompt_length
      ).long()
  
      self._init_prompt_embedding(base_model_embeddings)
  
      if prompt_tuning_config.combine == "prefix":
          self.combination_fn = (
              lambda prompt, embedded_input: torch.cat(
                  [prompt, embedded_input], dim=1
              )
          )
      elif prompt_tuning_config.combine == "prefix_after_bos":
          self.combination_fn = (
              lambda prompt, embedded_input: torch.cat(
                  [
                      embedded_input[:, 0, np.newaxis],
                      prompt,
                      embedded_input[:, 1:],
                  ],
                  dim=1,
              )
          )
      else:
          raise ValueError(
              f"Unknown combination function: {prompt_tuning_config.combine}. "
              "Must be one of 'prefix' or 'prefix_after_bos'."
          )
  
imports: import math
  from typing import Callable, Dict, List, Union
  import numpy
  import torch
  from torch import nn
  from transformers import AutoTokenizer
  from transformers.configuration_utils import PretrainedConfig
  from ..composition import AdapterCompositionBlock
  from ..configuration import ModelAdaptersConfig, PromptTuningConfig
  from ..context import ForwardContext
  from .adapter_layer_base import AdapterLayerBase
label_desc: Use image node_id 1 to create a new PromptTuning object from inherited base classes: nn with example: obj = PromptTuning(adapter_name, prompt_tuning_config, model_config, base_model_embeddings)