Ë
    ©sgY  ã                   ór   — d Z ddlZddlmZ ddlmZ ddlmZmZ  ej                  e
«      Z G d„ d	e«      Zy)
zPaliGemmamodel configurationé    Né   )ÚPretrainedConfig)Úloggingé   )ÚCONFIG_MAPPINGÚ
AutoConfigc                   ó~   ‡ — e Zd ZdZdZeedœZ	 	 	 	 	 	 	 dˆ fd„	Zed„ «       Z	e	j                  d„ «       Z	ˆ fd„Zˆ xZS )	ÚPaliGemmaConfiga	  
    This is the configuration class to store the configuration of a [`PaliGemmaForConditionalGeneration`]. It is used to instantiate an
    PaliGemmamodel according to the specified arguments, defining the model architecture. Instantiating a configuration
    with the defaults will yield a similar configuration to that of the PaliGemma-2B.

    e.g. [paligemma-hf/paligemma-2b](https://huggingface.co/paligemma-hf/paligemma-2b)

    Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PretrainedConfig`] for more information.

    Args:
        vision_config (`PaliGemmaVisionConfig`,  *optional*):
            Custom vision config or dict
        text_config (`Union[AutoConfig, dict]`, *optional*):
            The config object of the text backbone. Can be any of `LlamaConfig` or `MistralConfig`.
        ignore_index (`int`, *optional*, defaults to -100):
            The ignore index for the loss function.
        image_token_index (`int`, *optional*, defaults to 256000):
            The image token index to encode the image prompt.
        vocab_size (`int`, *optional*, defaults to 257152):
            Vocabulary size of the PaliGemmamodel. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`~PaliGemmaForConditionalGeneration`]
        projection_dim (`int`, *optional*, defaults to 2048):
            Dimension of the multimodal projection space.
        hidden_size (`int`, *optional*, defaults to 2048):
            Dimension of the hidden layer of the Language model.

    Example:

    ```python
    >>> from transformers import PaliGemmaForConditionalGeneration, PaliGemmaConfig, SiglipVisionConfig, GemmaConfig

    >>> # Initializing a Siglip-like vision config
    >>> vision_config = SiglipVisionConfig()

    >>> # Initializing a PaliGemma config
    >>> text_config = GemmaConfig()

    >>> # Initializing a PaliGemma paligemma-3b-224 style configuration
    >>> configuration = PaliGemmaConfig(vision_config, text_config)

    >>> # Initializing a model from the paligemma-3b-224 style configuration
    >>> model = PaliGemmaForConditionalGeneration(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Ú	paligemma)Útext_configÚvision_configc           
      ó¢  •— || _         || _        || _        || _        || _        || _        d| _        t        | j
                  t        «      r%d|v r|d   nd|d<   t        |d      di |¤Ž| _        n|€t        d   dddddd	d
d¬«      | _        || _
        t        | j                  t        «      r%d|v r|d   nd|d<   t        |d      di |¤Ž| _
        n|€t        d   dddddd|¬«      | _
        | j
                  j                  | j
                  j                  z  dz  | j                  _        || j
                  _        t        ‰	| <  di |¤Ž y )NFÚ
model_typeÚsiglip_vision_modeli   i€  é   éà   é   é   é€ì )Úintermediate_sizeÚhidden_sizeÚ
patch_sizeÚ
image_sizeÚnum_hidden_layersÚnum_attention_headsÚ
vocab_sizeÚvision_use_headÚgemmaé   é   i @  é   é   )r   r   r   r   Únum_key_value_headsÚis_encoder_decoderr   r   © )Ú_ignore_indexÚimage_token_indexÚ_vocab_sizeÚprojection_dimr   r   r$   Ú
isinstanceÚdictr   r   r   r   Únum_image_tokensÚsuperÚ__init__)
Úselfr   r   Úignore_indexr'   r   r)   r   ÚkwargsÚ	__class__s
            €úh/var/www/html/venv/lib/python3.12/site-packages/transformers/models/paligemma/configuration_paligemma.pyr.   zPaliGemmaConfig.__init__N   s‚  ø€ ð *ˆÔØ!2ˆÔØ%ˆÔØ,ˆÔØ&ˆÔØ*ˆÔØ"'ˆÔäd×(Ñ(¬$Ô/à/;¸}Ñ/L˜lÒ+ÐRgð ˜,Ñ'ô "0°¸lÑ0KÑ!LÑ!]È}Ñ!]ˆDÕØÐ"Ü!/Ð0EÑ!FØ"&Ø ØØØ"$Ø$&Ø!Ø %ô	"ˆDÔð 'ˆÔÜd×&Ñ&¬Ô-ØEQÐU`ÑE`¨°LÒ(AÐfmˆK˜Ñ%Ü-¨k¸,Ñ.GÑHÑWÈ;ÑWˆDÕØÐ Ü-¨gÑ6Ø Ø"$Ø"'Ø$%Ø$%Ø#(Ø%ô ˆDÔð .2×-?Ñ-?×-JÑ-JÈd×N`ÑN`×NkÑNkÑ-kÐpqÑ,qˆ×ÑÔ)Ø,:ˆ×ÑÔ)Ü‰ÑÑ"˜6Ó"ó    c                 óN   — t        j                  dt        «       | j                  S )NzHThe `ignore_index` attribute is deprecated and will be removed in v4.47.)ÚwarningsÚwarnÚFutureWarningr&   )r/   s    r3   r0   zPaliGemmaConfig.ignore_index„   s"   € ä‰ØVÜô	
ð ×!Ñ!Ð!r4   c                 ó   — || _         y )N)r&   )r/   Úvalues     r3   r0   zPaliGemmaConfig.ignore_indexŒ   s
   € à"ˆÕr4   c                 óH   •— t         ‰|   «       }|j                  dd «       |S )Nr&   )r-   Úto_dictÚpop)r/   Úoutputr2   s     €r3   r<   zPaliGemmaConfig.to_dict   s"   ø€ Ü‘‘Ó"ˆØ
‰
? DÔ)Øˆr4   )NNiœÿÿÿi è r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úsub_configsr.   Úpropertyr0   Úsetterr<   Ú__classcell__)r2   s   @r3   r
   r
      so   ø„ ñ.ð` €JØ",¸zÑJ€Kð ØØØ ØØØõ4#ðl ñ"ó ð"ð ×Ññ#ó ð#÷ð r4   r
   )rB   r6   Úconfiguration_utilsr   Úutilsr   Úautor   r   Ú
get_loggerr?   Úloggerr
   r%   r4   r3   ú<module>rL      s9   ðñ #ã å 3Ý ß -ð 
ˆ×	Ñ	˜HÓ	%€ôyÐ&õ yr4   