class_docstr: Text decoder model for a image-text [UniDiffuser](https://arxiv.org/pdf/2303.06555.pdf) model. This is used to
  generate text from the UniDiffuser image-text embedding.
  
  Parameters:
      prefix_length (`int`):
          Max number of prefix tokens that will be supplied to the model.
      prefix_inner_dim (`int`):
          The hidden size of the incoming prefix embeddings. For UniDiffuser, this would be the hidden dim of the
          CLIP text encoder.
      prefix_hidden_dim (`int`, *optional*):
          Hidden dim of the MLP if we encode the prefix.
      vocab_size (`int`, *optional*, defaults to 50257):
          Vocabulary size of the GPT-2 model. Defines the number of different tokens that can be represented by the
          `inputs_ids` passed when calling [`GPT2Model`] or [`TFGPT2Model`].
      n_positions (`int`, *optional*, defaults to 1024):
          The maximum sequence length that this model might ever be used with. Typically set this to something large
          just in case (e.g., 512 or 1024 or 2048).
      n_embd (`int`, *optional*, defaults to 768):
          Dimensionality of the embeddings and hidden states.
      n_layer (`int`, *optional*, defaults to 12):
          Number of hidden layers in the Transformer encoder.
      n_head (`int`, *optional*, defaults to 12):
          Number of attention heads for each attention layer in the Transformer encoder.
      n_inner (`int`, *optional*, defaults to None):
          Dimensionality of the inner feed-forward layers. `None` will set it to 4 times n_embd
      activation_function (`str`, *optional*, defaults to `"gelu"`):
          Activation function, to be selected in the list `["relu", "silu", "gelu", "tanh", "gelu_new"]`.
      resid_pdrop (`float`, *optional*, defaults to 0.1):
          The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
      embd_pdrop (`float`, *optional*, defaults to 0.1):
          The dropout ratio for the embeddings.
      attn_pdrop (`float`, *optional*, defaults to 0.1):
          The dropout ratio for the attention.
      layer_norm_epsilon (`float`, *optional*, defaults to 1e-5):
          The epsilon to use in the layer normalization layers.
      initializer_range (`float`, *optional*, defaults to 0.02):
          The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
      scale_attn_weights (`bool`, *optional*, defaults to `True`):
          Scale attention weights by dividing by sqrt(hidden_size)..
      use_cache (`bool`, *optional*, defaults to `True`):
          Whether or not the model should return the last key/values attentions (not used by all models).
      scale_attn_by_inverse_layer_idx (`bool`, *optional*, defaults to `False`):
          Whether to additionally scale attention weights by `1 / layer_idx + 1`.
      reorder_and_upcast_attn (`bool`, *optional*, defaults to `False`):
          Whether to scale keys (K) prior to computing attention (dot-product) and upcast attention
          dot-product/softmax to float() when training with mixed precision.
class_docstr_tok: ["Text","decoder","model","for","a","image-text","[","UniDiffuser","]","(","https",":","\/\/arxiv.org\/pdf\/2303.06555.pdf",")","model",".","This","is","used","to","generate","text","from","the","UniDiffuser","image-text","embedding",".","Parameters",":","prefix_length","(","`","int","`",")",":","Max","number","of","prefix","tokens","that","will","be","supplied","to","the","model",".","prefix_inner_dim","(","`","int","`",")",":","The","hidden","size","of","the","incoming","prefix","embeddings",".","For","UniDiffuser",",","this","would","be","the","hidden","dim","of","the","CLIP","text","encoder",".","prefix_hidden_dim","(","`","int","`",",","*","optional","*",")",":","Hidden","dim","of","the","MLP","if","we","encode","the","prefix",".","vocab_size","(","`","int","`",",","*","optional","*",",","defaults","to","50257",")",":","Vocabulary","size","of","the","GPT-2","model",".","Defines","the","number","of","different","tokens","that","can","be","represented","by","the","`","inputs_ids","`","passed","when","calling","[","`","GPT2Model","`","]","or","[","`","TFGPT2Model","`","]",".","n_positions","(","`","int","`",",","*","optional","*",",","defaults","to","1024",")",":","The","maximum","sequence","length","that","this","model","might","ever","be","used","with",".","Typically","set","this","to","something","large","just","in","case","(","e.g.",",","512","or","1024","or","2048",")",".","n_embd","(","`","int","`",",","*","optional","*",",","defaults","to","768",")",":","Dimensionality","of","the","embeddings","and","hidden","states",".","n_layer","(","`","int","`",",","*","optional","*",",","defaults","to","12",")",":","Number","of","hidden","layers","in","the","Transformer","encoder",".","n_head","(","`","int","`",",","*","optional","*",",","defaults","to","12",")",":","Number","of","attention","heads","for","each","attention","layer","in","the","Transformer","encoder",".","n_inner","(","`","int","`",",","*","optional","*",",","defaults","to","None",")",":","Dimensionality","of","the","inner","feed-forward","layers",".","`","None","`","will","set","it","to","4","times","n_embd","activation_function","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","gelu","''","`",")",":","Activation","function",",","to","be","selected","in","the","list","`","[","``","relu","''",",","``","silu","''",",","``","gelu","''",",","``","tanh","''",",","``","gelu_new","''","]","`",".","resid_pdrop","(","`","float","`",",","*","optional","*",",","defaults","to","0.1",")",":","The","dropout","probability","for","all","fully","connected","layers","in","the","embeddings",",","encoder",",","and","pooler",".","embd_pdrop","(","`","float","`",",","*","optional","*",",","defaults","to","0.1",")",":","The","dropout","ratio","for","the","embeddings",".","attn_pdrop","(","`","float","`",",","*","optional","*",",","defaults","to","0.1",")",":","The","dropout","ratio","for","the","attention",".","layer_norm_epsilon","(","`","float","`",",","*","optional","*",",","defaults","to","1e-5",")",":","The","epsilon","to","use","in","the","layer","normalization","layers",".","initializer_range","(","`","float","`",",","*","optional","*",",","defaults","to","0.02",")",":","The","standard","deviation","of","the","truncated_normal_initializer","for","initializing","all","weight","matrices",".","scale_attn_weights","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Scale","attention","weights","by","dividing","by","sqrt","(","hidden_size",")","..","use_cache","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","or","not","the","model","should","return","the","last","key\/values","attentions","(","not","used","by","all","models",")",".","scale_attn_by_inverse_layer_idx","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","additionally","scale","attention","weights","by","`","1","\/","layer_idx","+","1","`",".","reorder_and_upcast_attn","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","scale","keys","(","K",")","prior","to","computing","attention","(","dot-product",")","and","upcast","attention","dot-product\/softmax","to","float","(",")","when","training","with","mixed","precision","."]
code: def get_dummy_token(
      self, batch_size: int, device: torch.device
  ) -> torch.Tensor:
      return torch.zeros(
          batch_size,
          self.prefix_length,
          dtype=torch.int64,
          device=device,
      )
  
file_path: diffusers/src/diffusers/pipelines/unidiffuser/modeling_text_decoder.py
imports: from typing import Optional
  import numpy
  import torch
  from torch import nn
  from transformers import GPT2Config, GPT2LMHeadModel
  from transformers.modeling_utils import ModuleUtilsMixin
  from ...configuration_utils import ConfigMixin, register_to_config
  from ...models import ModelMixin
label_desc: Use image node_id 3 for calling the UniDiffuserTextDecoder obj's underlying member method code with example usage: obj.get_dummy_token(batch_size, device) and returns: torch