class_docstr: This is the configuration class to store the configuration of a [`Kosmos2TextModel`]. It is used to instantiate a
  KOSMOS-2 text decoder according to the specified arguments, defining the model architecture. Instantiating a
  configuration with the defaults will yield a similar configuration to that of the text decoder of the KOSMOS-2
  [microsoft/kosmos-2-patch14-224](https://huggingface.co/microsoft/kosmos-2-patch14-224) architecture.
  
  Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
  documentation from [`PretrainedConfig`] for more information.
  
  Args:
      vocab_size (`int`, *optional*, defaults to 65037):
          Vocabulary size of the Kosmos2 model. Defines the number of different tokens that can be represented by the
          `inputs_ids` passed when calling [`Kosmos2Model`].
      max_position_embeddings (`int`, *optional*, defaults to 2048):
          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).
      embed_dim (`int`, *optional*, defaults to 2048):
          Dimensionality of the layers and the pooler layer.
      layers (`int`, *optional*, defaults to 24):
          Number of hidden layers in the Transformer encoder.
      ffn_dim (`int`, *optional*, defaults to 8192):
          Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
      attention_heads (`int`, *optional*, defaults to 32):
          Number of attention heads for each attention layer in the Transformer encoder.
      activation_function (`str` or `function`, *optional*, defaults to `"gelu"`):
          The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
          `"relu"`, `"silu"` and `"gelu_new"` are supported.
      dropout (`float`, *optional*, defaults to 0.1):
          The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
      attention_dropout (`float`, *optional*, defaults to 0.1):
          The dropout ratio for the attention probabilities.
      activation_dropout (`float`, *optional*, defaults to 0.0):
          The dropout ratio for activations inside the fully connected layer.
      layerdrop (`float`, *optional*, defaults to 0.0):
          The LayerDrop probability for the decoder. See the [LayerDrop paper](see https://arxiv.org/abs/1909.11556)
          for more details.
      layer_norm_eps (`float`, *optional*, defaults to 1e-5):
          The epsilon used by the layer normalization layers.
      init_std (`float`, *optional*, defaults to 0.02):
          The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
      scale_embedding (`bool`, *optional*, defaults to `True`):
          Scale embeddings by diving by sqrt(embed_dim).
      use_cache (`bool`, *optional*, defaults to `True`):
          Whether or not the model should return the last key/values attentions (not used by all models).
  ```
class_docstr_tok: ["This","is","the","configuration","class","to","store","the","configuration","of","a","[","`","Kosmos2TextModel","`","]",".","It","is","used","to","instantiate","a","KOSMOS-2","text","decoder","according","to","the","specified","arguments",",","defining","the","model","architecture",".","Instantiating","a","configuration","with","the","defaults","will","yield","a","similar","configuration","to","that","of","the","text","decoder","of","the","KOSMOS-2","[","microsoft\/kosmos-2-patch14-224","]","(","https",":","\/\/huggingface.co\/microsoft\/kosmos-2-patch14-224",")","architecture",".","Configuration","objects","inherit","from","[","`","PretrainedConfig","`","]","and","can","be","used","to","control","the","model","outputs",".","Read","the","documentation","from","[","`","PretrainedConfig","`","]","for","more","information",".","Args",":","vocab_size","(","`","int","`",",","*","optional","*",",","defaults","to","65037",")",":","Vocabulary","size","of","the","Kosmos2","model",".","Defines","the","number","of","different","tokens","that","can","be","represented","by","the","`","inputs_ids","`","passed","when","calling","[","`","Kosmos2Model","`","]",".","max_position_embeddings","(","`","int","`",",","*","optional","*",",","defaults","to","2048",")",":","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",")",".","embed_dim","(","`","int","`",",","*","optional","*",",","defaults","to","2048",")",":","Dimensionality","of","the","layers","and","the","pooler","layer",".","layers","(","`","int","`",",","*","optional","*",",","defaults","to","24",")",":","Number","of","hidden","layers","in","the","Transformer","encoder",".","ffn_dim","(","`","int","`",",","*","optional","*",",","defaults","to","8192",")",":","Dimensionality","of","the","``","intermediate","''","(","often","named","feed-forward",")","layer","in","the","Transformer","encoder",".","attention_heads","(","`","int","`",",","*","optional","*",",","defaults","to","32",")",":","Number","of","attention","heads","for","each","attention","layer","in","the","Transformer","encoder",".","activation_function","(","`","str","`","or","`","function","`",",","*","optional","*",",","defaults","to","`","``","gelu","''","`",")",":","The","non-linear","activation","function","(","function","or","string",")","in","the","encoder","and","pooler",".","If","string",",","`","``","gelu","''","`",",","`","``","relu","''","`",",","`","``","silu","''","`","and","`","``","gelu_new","''","`","are","supported",".","dropout","(","`","float","`",",","*","optional","*",",","defaults","to","0.1",")",":","The","dropout","probability","for","all","fully","connected","layers","in","the","embeddings",",","encoder",",","and","pooler",".","attention_dropout","(","`","float","`",",","*","optional","*",",","defaults","to","0.1",")",":","The","dropout","ratio","for","the","attention","probabilities",".","activation_dropout","(","`","float","`",",","*","optional","*",",","defaults","to","0.0",")",":","The","dropout","ratio","for","activations","inside","the","fully","connected","layer",".","layerdrop","(","`","float","`",",","*","optional","*",",","defaults","to","0.0",")",":","The","LayerDrop","probability","for","the","decoder",".","See","the","[","LayerDrop","paper","]","(","see","https",":","\/\/arxiv.org\/abs\/1909.11556",")","for","more","details",".","layer_norm_eps","(","`","float","`",",","*","optional","*",",","defaults","to","1e-5",")",":","The","epsilon","used","by","the","layer","normalization","layers",".","init_std","(","`","float","`",",","*","optional","*",",","defaults","to","0.02",")",":","The","standard","deviation","of","the","truncated_normal_initializer","for","initializing","all","weight","matrices",".","scale_embedding","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Scale","embeddings","by","diving","by","sqrt","(","embed_dim",")",".","use_cache","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","or","not","the","model","should","return","the","last","key\/values","attentions","(","not","used","by","all","models",")",".","``","`"]
code: def __init__(
      self,
      vocab_size=65037,
      max_position_embeddings=2048,
      embed_dim=2048,
      layers=24,
      ffn_dim=8192,
      attention_heads=32,
      activation_function="gelu",
      dropout=0.1,
      attention_dropout=0.1,
      activation_dropout=0.0,
      layerdrop=0.0,
      layer_norm_eps=1e-5,
      init_std=0.02,
      scale_embedding=True,
      use_cache=True,
      pad_token_id=1,
      bos_token_id=0,
      eos_token_id=2,
      **kwargs,
  ):
      super().__init__(
          pad_token_id=pad_token_id,
          bos_token_id=bos_token_id,
          eos_token_id=eos_token_id,
          **kwargs,
      )
  
      self.vocab_size = vocab_size
      self.max_position_embeddings = max_position_embeddings
      self.embed_dim = embed_dim
      self.layers = layers
      self.ffn_dim = ffn_dim
      self.attention_heads = attention_heads
      self.activation_function = activation_function
      self.dropout = dropout
      self.attention_dropout = attention_dropout
      self.activation_dropout = activation_dropout
      self.layerdrop = layerdrop
      self.layer_norm_eps = layer_norm_eps
      self.init_std = init_std
      self.scale_embedding = scale_embedding
      self.use_cache = use_cache
  
file_path: transformers/src/transformers/models/kosmos2/configuration_kosmos2.py
imports: import os
  from typing import Union
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
label_desc: Use image node_id 1 to create a new Kosmos2TextConfig object from inherited base classes: PretrainedConfig with example: obj = Kosmos2TextConfig(vocab_size, max_position_embeddings, embed_dim, layers, ffn_dim, attention_heads, activation_function, dropout, attention_dropout, activation_dropout, layerdrop, layer_norm_eps, init_std, scale_embedding, use_cache, pad_token_id, bos_token_id, eos_token_id)