U
    ,È-eF  ã                   @   s†   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ e e¡Zd	d
iZG dd„ de	ƒZG dd„ deƒZdS )z! EfficientNet model configurationé    ©ÚOrderedDict)ÚListÚMapping)Úversioné   )ÚPretrainedConfig)Ú
OnnxConfig)Úloggingzgoogle/efficientnet-b7zFhttps://huggingface.co/google/efficientnet-b7/resolve/main/config.jsonc                       sî   e Zd ZdZdZddddddddddddgd	d
dddddgd
ddddddgg dddddddgdddddddgdddddddgdddddddddfeeeeeee ee ee ee ee ee ee eeeeeeeeedœ‡ fdd „Z	‡  Z
S )!ÚEfficientNetConfiga#  
    This is the configuration class to store the configuration of a [`EfficientNetModel`]. It is used to instantiate an
    EfficientNet 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 EfficientNet
    [google/efficientnet-b7](https://huggingface.co/google/efficientnet-b7) 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 600):
            The input image size.
        width_coefficient (`float`, *optional*, defaults to 2.0):
            Scaling coefficient for network width at each stage.
        depth_coefficient (`float`, *optional*, defaults to 3.1):
            Scaling coefficient for network depth at each stage.
        depth_divisor `int`, *optional*, defaults to 8):
            A unit of network width.
        kernel_sizes (`List[int]`, *optional*, defaults to `[3, 3, 5, 3, 5, 5, 3]`):
            List of kernel sizes to be used in each block.
        in_channels (`List[int]`, *optional*, defaults to `[32, 16, 24, 40, 80, 112, 192]`):
            List of input channel sizes to be used in each block for convolutional layers.
        out_channels (`List[int]`, *optional*, defaults to `[16, 24, 40, 80, 112, 192, 320]`):
            List of output channel sizes to be used in each block for convolutional layers.
        depthwise_padding (`List[int]`, *optional*, defaults to `[]`):
            List of block indices with square padding.
        strides (`List[int]`, *optional*, defaults to `[1, 2, 2, 2, 1, 2, 1]`):
            List of stride sizes to be used in each block for convolutional layers.
        num_block_repeats (`List[int]`, *optional*, defaults to `[1, 2, 2, 3, 3, 4, 1]`):
            List of the number of times each block is to repeated.
        expand_ratios (`List[int]`, *optional*, defaults to `[1, 6, 6, 6, 6, 6, 6]`):
            List of scaling coefficient of each block.
        squeeze_expansion_ratio (`float`, *optional*, defaults to 0.25):
            Squeeze expansion ratio.
        hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
            The non-linear activation function (function or string) in each block. If string, `"gelu"`, `"relu"`,
            `"selu", `"gelu_new"`, `"silu"` and `"mish"` are supported.
        hiddem_dim (`int`, *optional*, defaults to 1280):
            The hidden dimension of the layer before the classification head.
        pooling_type (`str` or `function`, *optional*, defaults to `"mean"`):
            Type of final pooling to be applied before the dense classification head. Available options are [`"mean"`,
            `"max"`]
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        batch_norm_eps (`float`, *optional*, defaults to 1e-3):
            The epsilon used by the batch normalization layers.
        batch_norm_momentum (`float`, *optional*, defaults to 0.99):
            The momentum used by the batch normalization layers.
        dropout_rate (`float`, *optional*, defaults to 0.5):
            The dropout rate to be applied before final classifier layer.
        drop_connect_rate (`float`, *optional*, defaults to 0.2):
            The drop rate for skip connections.

    Example:
    ```python
    >>> from transformers import EfficientNetConfig, EfficientNetModel

    >>> # Initializing a EfficientNet efficientnet-b7 style configuration
    >>> configuration = EfficientNetConfig()

    >>> # Initializing a model (with random weights) from the efficientnet-b7 style configuration
    >>> model = EfficientNetModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Zefficientnetr   iX  g       @gÍÌÌÌÌÌ@é   é   é    é   é   é(   éP   ép   éÀ   i@  é   é   é   é   g      Ð?Zswishi 
  Zmeang{®Gáz”?gü©ñÒMbP?g®Gáz®ï?g      à?gš™™™™™É?)Únum_channelsÚ
image_sizeÚwidth_coefficientÚdepth_coefficientÚdepth_divisorÚkernel_sizesÚin_channelsÚout_channelsÚdepthwise_paddingÚstridesÚnum_block_repeatsÚexpand_ratiosÚsqueeze_expansion_ratioÚ
hidden_actÚ
hidden_dimÚpooling_typeÚinitializer_rangeÚbatch_norm_epsÚbatch_norm_momentumÚdropout_rateÚdrop_connect_ratec                    sž   t ƒ jf |Ž || _|| _|| _|| _|| _|| _|| _|| _	|	| _
|
| _|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _|| _t|ƒd | _d S )Nr   )ÚsuperÚ__init__r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   ÚsumZnum_hidden_layers)Úselfr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   Úkwargs©Ú	__class__© ú|/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/transformers/models/efficientnet/configuration_efficientnet.pyr/   i   s.    zEfficientNetConfig.__init__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Z
model_typeÚintÚfloatr   Ústrr/   Ú__classcell__r5   r5   r3   r6   r   "   s\   Dêêr   c                   @   sJ   e Zd Ze d¡Zeeeee	ef f dœdd„ƒZ
eedœdd„ƒZdS )ÚEfficientNetOnnxConfigz1.11)Úreturnc                 C   s   t ddddddœfgƒS )NZpixel_valuesÚbatchr   ÚheightÚwidth)r   r   r   r   r   ©r1   r5   r5   r6   ÚinputsŸ   s    ÿÿzEfficientNetOnnxConfig.inputsc                 C   s   dS )Ngñhãˆµøä>r5   rD   r5   r5   r6   Úatol_for_validation§   s    z*EfficientNetOnnxConfig.atol_for_validationN)r7   r8   r9   r   ÚparseZtorch_onnx_minimum_versionÚpropertyr   r=   r;   rE   r<   rF   r5   r5   r5   r6   r?   œ   s
   
 r?   N)r:   Úcollectionsr   Útypingr   r   Ú	packagingr   Zconfiguration_utilsr   Zonnxr	   Úutilsr
   Z
get_loggerr7   ÚloggerZ*EFFICIENTNET_PRETRAINED_CONFIG_ARCHIVE_MAPr   r?   r5   r5   r5   r6   Ú<module>   s   
 ÿz