Ë
    T^(h£  ã                   ó¨   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ  ej                  e«      Z G d	„ d
e«      Z G d„ de
«      Zd
dgZy)zMobileViT model configurationé    ©ÚOrderedDict)ÚMapping)Úversioné   )ÚPretrainedConfig)Ú
OnnxConfig)Úloggingc                   ó^   ‡ — e Zd ZdZdZdddg d¢g d¢dd	d
ddddddddddg d¢ddfˆ fd„	Zˆ xZS )ÚMobileViTConfigaë  
    This is the configuration class to store the configuration of a [`MobileViTModel`]. It is used to instantiate a
    MobileViT 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 MobileViT
    [apple/mobilevit-small](https://huggingface.co/apple/mobilevit-small) architecture.

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

    Args:
        num_channels (`int`, *optional*, defaults to 3):
            The number of input channels.
        image_size (`int`, *optional*, defaults to 256):
            The size (resolution) of each image.
        patch_size (`int`, *optional*, defaults to 2):
            The size (resolution) of each patch.
        hidden_sizes (`List[int]`, *optional*, defaults to `[144, 192, 240]`):
            Dimensionality (hidden size) of the Transformer encoders at each stage.
        neck_hidden_sizes (`List[int]`, *optional*, defaults to `[16, 32, 64, 96, 128, 160, 640]`):
            The number of channels for the feature maps of the backbone.
        num_attention_heads (`int`, *optional*, defaults to 4):
            Number of attention heads for each attention layer in the Transformer encoder.
        mlp_ratio (`float`, *optional*, defaults to 2.0):
            The ratio of the number of channels in the output of the MLP to the number of channels in the input.
        expand_ratio (`float`, *optional*, defaults to 4.0):
            Expansion factor for the MobileNetv2 layers.
        hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
            The non-linear activation function (function or string) in the Transformer encoder and convolution layers.
        conv_kernel_size (`int`, *optional*, defaults to 3):
            The size of the convolutional kernel in the MobileViT layer.
        output_stride (`int`, *optional*, defaults to 32):
            The ratio of the spatial resolution of the output to the resolution of the input image.
        hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
            The dropout probability for all fully connected layers in the Transformer encoder.
        attention_probs_dropout_prob (`float`, *optional*, defaults to 0.0):
            The dropout ratio for the attention probabilities.
        classifier_dropout_prob (`float`, *optional*, defaults to 0.1):
            The dropout ratio for attached classifiers.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        layer_norm_eps (`float`, *optional*, defaults to 1e-05):
            The epsilon used by the layer normalization layers.
        qkv_bias (`bool`, *optional*, defaults to `True`):
            Whether to add a bias to the queries, keys and values.
        aspp_out_channels (`int`, *optional*, defaults to 256):
            Number of output channels used in the ASPP layer for semantic segmentation.
        atrous_rates (`List[int]`, *optional*, defaults to `[6, 12, 18]`):
            Dilation (atrous) factors used in the ASPP layer for semantic segmentation.
        aspp_dropout_prob (`float`, *optional*, defaults to 0.1):
            The dropout ratio for the ASPP layer for semantic segmentation.
        semantic_loss_ignore_index (`int`, *optional*, defaults to 255):
            The index that is ignored by the loss function of the semantic segmentation model.

    Example:

    ```python
    >>> from transformers import MobileViTConfig, MobileViTModel

    >>> # Initializing a mobilevit-small style configuration
    >>> configuration = MobileViTConfig()

    >>> # Initializing a model from the mobilevit-small style configuration
    >>> model = MobileViTModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Ú	mobilevitr   é   é   )é�   éÀ   éð   )é   é    é@   é`   é€   é    i€  é   g       @g      @Úsilur   gš™™™™™¹?g        g{®Gáz”?gñhãˆµøä>T)é   é   é   éÿ   c                 óJ  •— t        ‰| �  di |¤Ž || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        y )N© )ÚsuperÚ__init__Únum_channelsÚ
image_sizeÚ
patch_sizeÚhidden_sizesÚneck_hidden_sizesÚnum_attention_headsÚ	mlp_ratioÚexpand_ratioÚ
hidden_actÚconv_kernel_sizeÚoutput_strideÚhidden_dropout_probÚattention_probs_dropout_probÚclassifier_dropout_probÚinitializer_rangeÚlayer_norm_epsÚqkv_biasÚaspp_out_channelsÚatrous_ratesÚaspp_dropout_probÚsemantic_loss_ignore_index)Úselfr#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   ÚkwargsÚ	__class__s                          €ús/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/mobilevit/configuration_mobilevit.pyr"   zMobileViTConfig.__init__e   sº   ø€ ô2 	‰ÑÑ"˜6Ò"à(ˆÔØ$ˆŒØ$ˆŒØ(ˆÔØ!2ˆÔØ#6ˆÔ Ø"ˆŒØ(ˆÔØ$ˆŒØ 0ˆÔØ*ˆÔØ#6ˆÔ Ø,HˆÔ)Ø'>ˆÔ$Ø!2ˆÔØ,ˆÔØ ˆŒð "3ˆÔØ(ˆÔØ!2ˆÔØ*DˆÕ'ó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer"   Ú__classcell__)r:   s   @r;   r   r      s^   ø„ ñBðH €Jð ØØÚ$Ú9ØØØØØØØØ%(Ø #ØØØØÚ ØØ#&÷-1Eñ 1Er<   r   c                   óš   — e Zd Z ej                  d«      Zedeeee	ef   f   fd„«       Z
edeeee	ef   f   fd„«       Zedefd„«       Zy)ÚMobileViTOnnxConfigz1.11Úreturnc                 ó(   — t        ddddddœfg«      S )NÚpixel_valuesÚbatchr#   ÚheightÚwidth)r   é   r   r   r   ©r8   s    r;   ÚinputszMobileViTOnnxConfig.inputsœ   s    € ä˜^°¸^ÐPXÐ]dÑ-eÐfÐgÓhÐhr<   c                 ój   — | j                   dk(  rt        dddifg«      S t        dddifdddifg«      S )Nzimage-classificationÚlogitsr   rH   Úlast_hidden_stateÚpooler_output)Útaskr   rL   s    r;   ÚoutputszMobileViTOnnxConfig.outputs    sL   € à�9‰9Ð.Ò.Ü ¨A¨w¨<Ð 8Ð9Ó:Ð:äÐ!4°q¸'°lÐ CÀoÐXYÐ[bÐWcÐEdÐeÓfÐfr<   c                  ó   — y)Ng-Cëâ6?r    rL   s    r;   Úatol_for_validationz'MobileViTOnnxConfig.atol_for_validation§   s   € àr<   N)r=   r>   r?   r   ÚparseÚtorch_onnx_minimum_versionÚpropertyr   ÚstrÚintrM   rS   ÚfloatrU   r    r<   r;   rD   rD   ™   sŽ   „ Ø!. §¡¨vÓ!6Ðàði˜  W¨S°#¨XÑ%6Ð 6Ñ7ò ió ðið ðg˜  g¨c°3¨hÑ&7Ð!7Ñ8ò gó ðgð ð Uò ó ñr<   rD   N)r@   Úcollectionsr   Útypingr   Ú	packagingr   Úconfiguration_utilsr   Úonnxr	   Úutilsr
   Ú
get_loggerr=   Úloggerr   rD   Ú__all__r    r<   r;   ú<module>re      s[   ðñ $å #Ý å å 3Ý Ý ð 
ˆ×	Ñ	˜HÓ	%€ôxEÐ&ô xEôv˜*ô ð& Ð3Ð
4�r<   