Ë
    S^(hy  ã                   ór   — d 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e«      ZdgZy)zFocalNet model configurationé   )ÚPretrainedConfig)Úlogging)ÚBackboneConfigMixinÚ*get_aligned_output_features_output_indicesc                   óf   ‡ — e Zd ZdZdZdddddg d¢g d	¢g d
¢g d¢ddddddddddddddfˆ fd„	Zˆ xZS )ÚFocalNetConfiga–  
    This is the configuration class to store the configuration of a [`FocalNetModel`]. It is used to instantiate a
    FocalNet 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 FocalNet
    [microsoft/focalnet-tiny](https://huggingface.co/microsoft/focalnet-tiny) architecture.

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

    Args:
        image_size (`int`, *optional*, defaults to 224):
            The size (resolution) of each image.
        patch_size (`int`, *optional*, defaults to 4):
            The size (resolution) of each patch in the embeddings layer.
        num_channels (`int`, *optional*, defaults to 3):
            The number of input channels.
        embed_dim (`int`, *optional*, defaults to 96):
            Dimensionality of patch embedding.
        use_conv_embed (`bool`, *optional*, defaults to `False`):
            Whether to use convolutional embedding. The authors noted that using convolutional embedding usually
            improve the performance, but it's not used by default.
        hidden_sizes (`List[int]`, *optional*, defaults to `[192, 384, 768, 768]`):
            Dimensionality (hidden size) at each stage.
        depths (`list(int)`, *optional*, defaults to `[2, 2, 6, 2]`):
            Depth (number of layers) of each stage in the encoder.
        focal_levels (`list(int)`, *optional*, defaults to `[2, 2, 2, 2]`):
            Number of focal levels in each layer of the respective stages in the encoder.
        focal_windows (`list(int)`, *optional*, defaults to `[3, 3, 3, 3]`):
            Focal window size in each layer of the respective stages in the encoder.
        hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder. If string, `"gelu"`, `"relu"`,
            `"selu"` and `"gelu_new"` are supported.
        mlp_ratio (`float`, *optional*, defaults to 4.0):
            Ratio of MLP hidden dimensionality to embedding dimensionality.
        hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
            The dropout probability for all fully connected layers in the embeddings and encoder.
        drop_path_rate (`float`, *optional*, defaults to 0.1):
            Stochastic depth rate.
        use_layerscale (`bool`, *optional*, defaults to `False`):
            Whether to use layer scale in the encoder.
        layerscale_value (`float`, *optional*, defaults to 0.0001):
            The initial value of the layer scale.
        use_post_layernorm (`bool`, *optional*, defaults to `False`):
            Whether to use post layer normalization in the encoder.
        use_post_layernorm_in_modulation (`bool`, *optional*, defaults to `False`):
            Whether to use post layer normalization in the modulation layer.
        normalize_modulator (`bool`, *optional*, defaults to `False`):
            Whether to normalize the modulator.
        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.
        encoder_stride (`int`, *optional*, defaults to 32):
            Factor to increase the spatial resolution by in the decoder head for masked image modeling.
        out_features (`List[str]`, *optional*):
            If used as backbone, list of features to output. Can be any of `"stem"`, `"stage1"`, `"stage2"`, etc.
            (depending on how many stages the model has). If unset and `out_indices` is set, will default to the
            corresponding stages. If unset and `out_indices` is unset, will default to the last stage. Must be in the
            same order as defined in the `stage_names` attribute.
        out_indices (`List[int]`, *optional*):
            If used as backbone, list of indices of features to output. Can be any of 0, 1, 2, etc. (depending on how
            many stages the model has). If unset and `out_features` is set, will default to the corresponding stages.
            If unset and `out_features` is unset, will default to the last stage. Must be in the
            same order as defined in the `stage_names` attribute.

    Example:

    ```python
    >>> from transformers import FocalNetConfig, FocalNetModel

    >>> # Initializing a FocalNet microsoft/focalnet-tiny style configuration
    >>> configuration = FocalNetConfig()

    >>> # Initializing a model (with random weights) from the microsoft/focalnet-tiny style configuration
    >>> model = FocalNetModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Úfocalnetéà   é   r   é`   F)éÀ   i€  é   r   )é   r   é   r   )r   r   r   r   )r   r   r   r   Úgelug      @g        gš™™™™™¹?g-Cëâ6?g{®Gáz”?gñhãˆµøä>é    Nc                 ó  •— t        ‰| �  di |¤Ž || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        dgt/        dt1        | j                  «      dz   «      D �cg c]  }d|› �‘Œ	 c}z   | _        t5        ||| j2                  ¬«      \  | _        | _        y c c}w )NÚstemé   Ústage)Úout_featuresÚout_indicesÚstage_names© )ÚsuperÚ__init__Ú
image_sizeÚ
patch_sizeÚnum_channelsÚ	embed_dimÚuse_conv_embedÚhidden_sizesÚdepthsÚfocal_levelsÚfocal_windowsÚ
hidden_actÚ	mlp_ratioÚhidden_dropout_probÚdrop_path_rateÚuse_layerscaleÚlayerscale_valueÚuse_post_layernormÚ use_post_layernorm_in_modulationÚnormalize_modulatorÚinitializer_rangeÚlayer_norm_epsÚencoder_strideÚrangeÚlenr   r   Ú_out_featuresÚ_out_indices)Úselfr   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r   r   ÚkwargsÚidxÚ	__class__s                             €úq/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/focalnet/configuration_focalnet.pyr   zFocalNetConfig.__init__l   s  ø€ ô6 	‰ÑÑ"˜6Ò"à$ˆŒØ$ˆŒØ(ˆÔØ"ˆŒØ,ˆÔØ(ˆÔØˆŒØ(ˆÔØ*ˆÔØ$ˆŒØ"ˆŒØ#6ˆÔ Ø,ˆÔØ,ˆÔØ 0ˆÔØ"4ˆÔØ0PˆÔ-Ø#6ˆÔ Ø!2ˆÔØ,ˆÔØ,ˆÔØ"˜8ÄÀaÌÈTÏ[É[ÓIYÐ\]ÑI]Ó@^Ö&_¸¨¨s¨e¢}Ò&_Ñ_ˆÔÜ0ZØ%°;ÈD×L\ÑL\ô1
Ñ-ˆÔ˜DÕ-ùò '`s   Ã
D)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer   Ú__classcell__)r9   s   @r:   r   r      sb   ø„ ñNð` €Jð ØØØØÚ)ÚÚ!Ú"ØØØØØØØ Ø).Ø!ØØØØØ÷15
ñ 5
ó    r   N)r>   Úconfiguration_utilsr   Úutilsr   Úutils.backbone_utilsr   r   Ú
get_loggerr;   Úloggerr   Ú__all__r   rA   r:   ú<module>rH      sD   ðñ #å 3Ý ß cð 
ˆ×	Ñ	˜HÓ	%€ôH
Ð(Ð*:ô H
ðV Ð
�rA   