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 from_pretrained(
      cls,
      pretrained_model_name_or_path: Union[str, os.PathLike],
      **kwargs,
  ) -> "PretrainedConfig":
      cls._set_token_in_kwargs(kwargs)
  
      config_dict, kwargs = cls.get_config_dict(
          pretrained_model_name_or_path, **kwargs
      )
  
      # get the text config dict if we are loading from Kosmos2Config
      if config_dict.get("model_type") == "kosmos-2":
          config_dict = config_dict["text_config"]
  
      if (
          "model_type" in config_dict
          and hasattr(cls, "model_type")
          and config_dict["model_type"] != cls.model_type
      ):
          logger.warning(
              f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
              f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."
          )
  
      return cls.from_dict(config_dict, **kwargs)
  
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 2 for calling the Kosmos2TextConfig obj's underlying member method code with example usage: obj.from_pretrained(cls, pretrained_model_name_or_path) and returns: cls