§
    ‚Štjž  ã                   ó’   — 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
dS )zFocalNet model configurationé    )Ústricté   )ÚBackboneConfigMixin)ÚPreTrainedConfig)Úauto_docstringzmicrosoft/focalnet-tiny)Ú
checkpointc                   ór  ‡ — 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{®Gáz”?Úinitializer_rangegñhãˆµøä>Úlayer_norm_epsé    Úencoder_strideNÚ_out_featuresÚ_out_indicesc                 ó(  •— dgd„ t          dt          | j        ¦  «        dz   ¦  «        D ¦   «         z   | _        |                      |                     dd ¦  «        |                     dd ¦  «        ¬¦  «          t          ¦   «         j        di |¤Ž d S )NÚstemc                 ó   — g | ]}d |› �‘ŒS )Ústage© )Ú.0Úidxs     úq/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/focalnet/configuration_focalnet.pyú
<listcomp>z0FocalNetConfig.__post_init__.<locals>.<listcomp>[   s   € Ð&_Ð&_Ð&_¸ }¨s } }Ð&_Ð&_Ð&_ó    é   Úout_indicesÚout_features)r7   r8   r0   )ÚrangeÚlenr   Ústage_namesÚ"set_output_features_output_indicesÚpopÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s     €r3   r?   zFocalNetConfig.__post_init__Z   s    ø€ Ø"˜8Ð&_Ð&_ÅÀaÍÈTÌ[ÑIYÔIYÐ\]ÑI]Ñ@^Ô@^Ð&_Ñ&_Ô&_Ñ_ˆÔØ×/Ò/ØŸ
š
 =°$Ñ7Ô7ÀfÇjÂjÐQ_ÐaeÑFfÔFfð 	0ñ 	
ô 	
ð 	
ð 	�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'r5   )%Ú__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+   r?   Ú__classcell__)rB   s   @r3   r
   r
      sJ  ø€ € € € € € ð$ð $ðL €Jà47€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð7Ð7Ñ7Ø45€J��d˜3”i‘ %¨¨S¨¤/Ñ1Ð5Ð5Ñ5Ø€L�#ÐÐÑØ€IˆsÐÐÑØ €N�DÐ Ð Ñ Ø0D€L�$�s”)˜e C¨ HœoÑ-ÐDÐDÑDØ*6€FˆD�ŒI˜˜c 3˜hœÑ'Ð6Ð6Ñ6Ø0<€L�$�s”)˜e C¨ HœoÑ-Ð<Ð<Ñ<Ø1=€M�4˜”9˜u S¨# XœÑ.Ð=Ð=Ñ=Ø€J�ÐÐÑØ€IˆuÐÐÑØ'*Ð˜ ™Ð*Ð*Ñ*Ø"%€N�E˜C‘KÐ%Ð%Ñ%Ø €N�DÐ Ð Ñ Ø"Ð�eÐ"Ð"Ñ"Ø$Ð˜Ð$Ð$Ñ$Ø-2Ð$ dÐ2Ð2Ñ2Ø %Ð˜Ð%Ð%Ñ%Ø#Ð�uÐ#Ð#Ñ#Ø €N�EÐ Ð Ñ Ø€N�CÐÐÑØ&*€M�4˜”9˜tÑ#Ð*Ð*Ñ*Ø%)€L�$�s”)˜dÑ"Ð)Ð)Ñ)ð(ð (ð (ð (ð (ð (ð (ð (ð (r5   r
   N)rF   Úhuggingface_hub.dataclassesr   Úbackbone_utilsr   Úconfiguration_utilsr   Úutilsr   r
   Ú__all__r0   r5   r3   ú<module>rU      s¿   ðð #Ð "à .Ð .Ð .Ð .Ð .Ð .à 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø #Ð #Ð #Ð #Ð #Ð #ð €Ð4Ð5Ñ5Ô5ØðF(ð F(ð F(ð F(ð F(Ð(Ð*:ñ F(ô F(ñ „ñ 6Ô5ðF(ðR Ð
€€€r5   