Ë
    T^(h®$  ã                   ó„   — 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
 G d„ de«      ZddgZy	)
é   )ÚPretrainedConfig)Úloggingé   )ÚCONFIG_MAPPINGÚ
AutoConfigc                   óB   ‡ — e Zd ZdZdZdZ	 	 	 	 	 	 	 	 	 	 	 dˆ fd„	Zˆ xZS )ÚSmolVLMVisionConfiga¿  
    This is the configuration class to store the configuration of a [`SmolVLMVisionModel`]. It is used to instantiate a
    SmolVLM vision encoder according to the specified arguments, defining the model architecture. Instantiating a
    configuration with the defaults will yield a similar configuration to that of the SigLIP checkpoint
    [google/siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384) used in SmolVLM
    [HuggingFaceTB/SmolVLM2-2.2B-Instruct](https://huggingface.co/HuggingFaceTB/SmolVLM2-2.2B-Instruct).

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

    Args:
        hidden_size (`int`, *optional*, defaults to 1152):
            Dimensionality of the encoder layers and the pooler layer.
        intermediate_size (`int`, *optional*, defaults to 3072):
            Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
        num_hidden_layers (`int`, *optional*, defaults to 12):
            Number of hidden layers in the Transformer encoder.
        num_attention_heads (`int`, *optional*, defaults to 16):
            Number of attention heads for each attention layer in the Transformer encoder.
        num_channels (`int`, *optional*, defaults to 3):
            Number of channels in the input images.
        image_size (`int`, *optional*, defaults to 224):
            The size (resolution) of each image.
        patch_size (`int`, *optional*, defaults to 32):
            The size (resolution) of each patch.
        hidden_act (`str` or `function`, *optional*, defaults to `"gelu_pytorch_tanh"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"selu"` and `"gelu_new"` `"quick_gelu"` are supported.
        layer_norm_eps (`float`, *optional*, defaults to 1e-06):
            The epsilon used by the layer normalization layers.
        attention_dropout (`float`, *optional*, defaults to 0.0):
            The dropout ratio for the attention probabilities.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.

    Example:

    ```python
    >>> from transformers.models.smolvlm.modeling_smolvlm import SmolVLMVisionTransformer
    >>> from transformers.models.smolvlm.configuration_smolvlm import SmolVLMVisionConfig

    >>> # Initializing a SmolVLMVisionConfig with google/siglip-so400m-patch14-384 style configuration
    >>> configuration = SmolVLMVisionConfig()

    >>> # Initializing a SmolVLMVisionTransformer (with random weights) from the google/siglip-so400m-patch14-384 style configuration
    >>> model = SmolVLMVisionTransformer(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úsmolvlm_visionÚvision_configc                 ó¾   •— t        ‰| �  di |¤Ž || _        || _        || _        || _        || _        || _        || _        |
| _	        |	| _
        || _        || _        y )N© )ÚsuperÚ__init__Úhidden_sizeÚintermediate_sizeÚnum_hidden_layersÚnum_attention_headsÚnum_channelsÚ
patch_sizeÚ
image_sizeÚattention_dropoutÚlayer_norm_epsÚ
hidden_actÚinitializer_range)Úselfr   r   r   r   r   r   r   r   r   r   r   ÚkwargsÚ	__class__s                €úo/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/smolvlm/configuration_smolvlm.pyr   zSmolVLMVisionConfig.__init__U   sj   ø€ ô 	‰ÑÑ"˜6Ò"à&ˆÔØ!2ˆÔØ!2ˆÔØ#6ˆÔ Ø(ˆÔØ$ˆŒØ$ˆŒØ!2ˆÔØ,ˆÔØ$ˆŒØ!2ˆÕó    )i€  i   é   é   r   éà   é    Úgelu_pytorch_tanhg�íµ ÷Æ°>g        g{®Gáz”?)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typeÚbase_config_keyr   Ú__classcell__©r   s   @r   r	   r	      sB   ø„ ñ1ðf "€JØ%€Oð ØØØØØØØ&ØØØ÷3ñ 3r   r	   c                   ó@   ‡ — e Zd ZdZdZeedœZ	 	 	 	 	 	 	 dˆ fd„	Zˆ xZ	S )ÚSmolVLMConfigaÃ  
    This is the configuration class to store the configuration of a [`SmolVLMModel`]. It is used to instantiate a
    SmolVLM model according to the specified arguments, defining the model architecture. Instantiating a
    configuration with the defaults will yield a similar configuration to that of the model of the SmolVLM
    [HuggingFaceTB/SmolVLM2-2.2B-Instruct](https://huggingface.co/HuggingFaceTB/SmolVLM2-2.2B-Instruct) architecture.

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

    Args:
        use_cache (`bool`, *optional*, defaults to `True`):
            Whether or not the model should cache the key/value pairs of the attention mechanism. Only
            relevant if `config.is_decoder=True`.
        image_token_id (`int`, *optional*, defaults to 128257):
            The id of the "image" token.
        tie_word_embeddings (`bool`, *optional*, defaults to `False`):
            Whether or not to tie the word embeddings with the token embeddings.
        vision_config (`IdeficsVisionConfig` or `dict`, *optional*, defaults to `IdeficsVisionConfig`):
            Custom vision config or dict for the vision tower
        text_config (`PretrainedConfig` or `dict`, *optional*, defaults to `LlamaConfig`):
            Custom text config or dict for the text model
        scale_factor (`int`, *optional*, defaults to 2):
            The scale factor for the image encoder.
        pad_token_id (`int`, *optional*, defaults to 128002):
            The id of the padding token.

    Example:
    ```python
    >>> from transformers import SmolVLMModel, SmolVLMConfig
    >>> # Initializing configuration
    >>> configuration = SmolVLMConfig()
    >>> # Initializing a model from the configuration
    >>> model = SmolVLMModel(configuration)
    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úsmolvlm)Útext_configr   c                 óâ  •— || _         || _        || _        |€%t        «       | _        t
        j                  d«       n8t        |t        «      rt        d	i |¤Ž| _        nt        |t        «      r|| _        t        |t        «      r d|v r|d   nd|d<   t        |d      d	i |¤Ž}n(|€&t
        j                  d«       t        d   d|d¬«      }|| _
        || _        t        ‰	| �4  d	i |¤||dœ¤Ž y )
Nz2vision_config is None, using default vision configr)   Úllamaz.text_config is None, using default text configgñhãˆµøä>F)Úrms_norm_epsÚpad_token_idÚtie_word_embeddings)r4   r5   r   )Úimage_token_idÚ	use_cacher5   r	   r   ÚloggerÚinfoÚ
isinstanceÚdictr   r0   Úscale_factorr   r   )
r   r7   r6   r5   r   r0   r<   r4   r   r   s
            €r   r   zSmolVLMConfig.__init__œ   s÷   ø€ ð -ˆÔØ"ˆŒØ#6ˆÔ àÐ Ü!4Ó!6ˆDÔÜ�K‰KÐLÕMÜ˜¤tÔ,Ü!4Ñ!E°}Ñ!EˆDÕÜ˜Ô':Ô;Ø!.ˆDÔä�k¤4Ô(ØEQÐU`ÑE`¨°LÒ(AÐfmˆK˜Ñ%Ü(¨°\Ñ)BÑCÑRÀkÑR‰KØÐ Ü�K‰KÐHÔIÜ(¨Ñ1Ø!Ø)Ø$)ôˆKð 'ˆÔØ(ˆÔä‰ÑÑf˜6Ðf°ÐReÕfr   )Tiõ FNNr   iô )
r%   r&   r'   r(   r)   r   r	   Úsub_configsr   r+   r,   s   @r   r.   r.   s   s>   ø„ ñ#ðJ €JØ",Ð?RÑS€Kð ØØ!ØØØØ÷%gñ %gr   r.   N)Úconfiguration_utilsr   Úutilsr   Úautor   r   Ú
get_loggerr%   r8   r	   r.   Ú__all__r   r   r   ú<module>rC      sR   ðõ, 4Ý ß -ð 
ˆ×	Ñ	˜HÓ	%€ôR3Ð*ô R3ôjNgÐ$ô Ngðb ! /Ð
2�r   