Ë
    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MobileViTV2 model configurationé    ©ÚOrderedDict)ÚMapping)Úversioné   )ÚPretrainedConfig)Ú
OnnxConfig)Úloggingc                   ó\   ‡ — e Zd ZdZdZdddddddd	d
ddg d¢d	dg d¢g d¢ddddfˆ fd„	Zˆ xZS )ÚMobileViTV2Configa°  
    This is the configuration class to store the configuration of a [`MobileViTV2Model`]. It is used to instantiate a
    MobileViTV2 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 MobileViTV2
    [apple/mobilevitv2-1.0](https://huggingface.co/apple/mobilevitv2-1.0) 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.
        expand_ratio (`float`, *optional*, defaults to 2.0):
            Expansion factor for the MobileNetv2 layers.
        hidden_act (`str` or `function`, *optional*, defaults to `"swish"`):
            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 MobileViTV2 layer.
        output_stride (`int`, *optional*, defaults to 32):
            The ratio of the spatial resolution of the output to the resolution of the input image.
        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.
        aspp_out_channels (`int`, *optional*, defaults to 512):
            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.
        n_attn_blocks (`List[int]`, *optional*, defaults to `[2, 4, 3]`):
            The number of attention blocks in each MobileViTV2Layer
        base_attn_unit_dims (`List[int]`, *optional*, defaults to `[128, 192, 256]`):
            The base multiplier for dimensions of attention blocks in each MobileViTV2Layer
        width_multiplier (`float`, *optional*, defaults to 1.0):
            The width multiplier for MobileViTV2.
        ffn_multiplier (`int`, *optional*, defaults to 2):
            The FFN multiplier for MobileViTV2.
        attn_dropout (`float`, *optional*, defaults to 0.0):
            The dropout in the attention layer.
        ffn_dropout (`float`, *optional*, defaults to 0.0):
            The dropout between FFN layers.

    Example:

    ```python
    >>> from transformers import MobileViTV2Config, MobileViTV2Model

    >>> # Initializing a mobilevitv2-small style configuration
    >>> configuration = MobileViTV2Config()

    >>> # Initializing a model from the mobilevitv2-small style configuration
    >>> model = MobileViTV2Model(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úmobilevitv2r   é   é   g       @Úswishé    gš™™™™™¹?g{®Gáz”?gñhãˆµøä>i   )é   é   é   éÿ   )r   é   r   )é€   éÀ   r   g      ð?g        c                 ó<  •— t        ‰| �  di |¤Ž || _        || _        || _        || _        || _        || _        || _        |	| _	        |
| _
        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        y )N© )ÚsuperÚ__init__Únum_channelsÚ
image_sizeÚ
patch_sizeÚexpand_ratioÚ
hidden_actÚconv_kernel_sizeÚoutput_strideÚinitializer_rangeÚlayer_norm_epsÚn_attn_blocksÚbase_attn_unit_dimsÚwidth_multiplierÚffn_multiplierÚffn_dropoutÚattn_dropoutÚclassifier_dropout_probÚ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   r&   r'   r(   r)   r+   r*   ÚkwargsÚ	__class__s                         €úw/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/mobilevitv2/configuration_mobilevitv2.pyr   zMobileViTV2Config.__init__c   s´   ø€ ô0 	‰ÑÑ"˜6Ò"à(ˆÔØ$ˆŒØ$ˆŒØ(ˆÔØ$ˆŒØ 0ˆÔØ*ˆÔØ!2ˆÔØ,ˆÔØ*ˆÔØ#6ˆÔ Ø 0ˆÔØ,ˆÔØ&ˆÔØ(ˆÔØ'>ˆÔ$ð "3ˆÔØ(ˆÔØ!2ˆÔØ*DˆÕ'ó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer   Ú__classcell__)r3   s   @r4   r   r      s[   ø„ ñ@ðD €Jð ØØØØØØØ #ØØØÚ ØØ#&ÚÚ+ØØØØ÷+/Eñ /Er5   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)ÚMobileViTV2OnnxConfigz1.11Úreturnc                 ó(   — t        ddddddœfg«      S )NÚpixel_valuesÚbatchr   ÚheightÚwidth)r   é   r   r   r   ©r1   s    r4   ÚinputszMobileViTV2OnnxConfig.inputs˜   s    € ä˜^°¸^ÐPXÐ]dÑ-eÐfÐgÓhÐhr5   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   rA   Úlast_hidden_stateÚpooler_output)Útaskr   rE   s    r4   ÚoutputszMobileViTV2OnnxConfig.outputsœ   sL   € à�9‰9Ð.Ò.Ü ¨A¨w¨<Ð 8Ð9Ó:Ð:äÐ!4°q¸'°lÐ CÀoÐXYÐ[bÐWcÐEdÐeÓfÐfr5   c                  ó   — y)Ng-Cëâ6?r   rE   s    r4   Úatol_for_validationz)MobileViTV2OnnxConfig.atol_for_validation£   s   € àr5   N)r6   r7   r8   r   ÚparseÚtorch_onnx_minimum_versionÚpropertyr   ÚstrÚintrF   rL   ÚfloatrN   r   r5   r4   r=   r=   •   sŽ   „ Ø!. §¡¨vÓ!6Ðàði˜  W¨S°#¨XÑ%6Ð 6Ñ7ò ió ðið ðg˜  g¨c°3¨hÑ&7Ð!7Ñ8ò gó ðgð ð Uò ó ñr5   r=   N)r9   Úcollectionsr   Útypingr   Ú	packagingr   Úconfiguration_utilsr   Úonnxr	   Úutilsr
   Ú
get_loggerr6   Úloggerr   r=   Ú__all__r   r5   r4   ú<module>r^      s[   ðñ &å #Ý å å 3Ý Ý ð 
ˆ×	Ñ	˜HÓ	%€ôtEÐ(ô tEôn˜Jô ð& Ð 7Ð
8�r5   