
    i                     x    d Z ddlmZ ddlmZ ddlmZ ddlmZ  ed      e G d	 d
ee                    Z	d
gZ
y)zFocalNet model configuration    )strict   )BackboneConfigMixin)PreTrainedConfig)auto_docstringzmicrosoft/focalnet-tiny)
checkpointc                       e Zd ZU dZdZdZeee   z  eeef   z  e	d<   dZ
eee   z  eeef   z  e	d<   dZee	d<   d	Zee	d
<   dZee	d<   dZee   eedf   z  e	d<   dZee   eedf   z  e	d<   dZee   eedf   z  e	d<   dZee   eedf   z  e	d<   dZee	d<   dZee	d<   dZeez  e	d<   dZeez  e	d<   dZee	d<   dZee	d <   dZee	d!<   dZee	d"<   dZee	d#<   d$Zee	d%<   d&Zee	d'<   d(Z ee	d)<   d*Z!ee   d*z  e	d+<   d*Z"ee   d*z  e	d,<    fd-Z# xZ$S ).FocalNetConfiga  
    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.
    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_dropout_prob (`float`, *optional*, defaults to 0.0):
        The dropout probability for all fully connected layers in the embeddings and encoder.
    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.
    encoder_stride (`int`, *optional*, defaults to 32):
        Factor to increase the spatial resolution by in the decoder head for masked image modeling.

    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   
image_size   
patch_sizer   num_channels`   	embed_dimFuse_conv_embed)   i     r   .hidden_sizes)   r      r   depths)r   r   r   r   focal_levels)r   r   r   r   focal_windowsgelu
hidden_actg      @	mlp_ratiog        hidden_dropout_probg?drop_path_rateuse_layerscaleg-C6?layerscale_valueuse_post_layernorm use_post_layernorm_in_modulationnormalize_modulatorg{Gz?initializer_rangegh㈵>layer_norm_eps    encoder_strideN_out_features_out_indicesc                    dgt        dt        | j                        dz         D cg c]  }d| 	 c}z   | _        | j	                  |j                  dd       |j                  dd              t        |   di | y c c}w )Nstem   stageout_indicesout_features)r0   r1    )rangelenr   stage_names"set_output_features_output_indicespopsuper__post_init__)selfkwargsidx	__class__s      /var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/transformers/models/focalnet/configuration_focalnet.pyr9   zFocalNetConfig.__post_init__Z   s    "8aT[[IY\]I]@^&_se}&__//

=$7fjjQ_aeFf 	0 	
 	''	 '`s   B)%__name__
__module____qualname____doc__
model_typer   intlisttuple__annotations__r   r   r   r   boolr   r   r   r   r   strr   floatr   r    r!   r"   r#   r$   r%   r&   r'   r)   r*   r+   r9   __classcell__)r=   s   @r>   r
   r
      s   $L J47Jd3i%S/1745Jd3i%S/15L#Is ND 0DL$s)eCHo-D*6FDIc3h'60<L$s)eCHo-<1=M49uS#X.=JIu'**"%NECK% ND "e"$$-2$d2 %%#u# NE NC&*M49t#*%)L$s)d")( (    r
   N)rB   huggingface_hub.dataclassesr   backbone_utilsr   configuration_utilsr   utilsr   r
   __all__r2   rL   r>   <module>rR      sQ    # . 1 3 # 45F((*: F(  6F(R 
rL   