
    fThy                     r    S r SSKJr  SSKJr  SSKJrJr  \R                  " \	5      r
 " S S\\5      rS/rg)zFocalNet model configuration   )PretrainedConfig)logging)BackboneConfigMixin*get_aligned_output_features_output_indicesc                   r   ^  \ rS rSrSrSrSSSSS/ S	Q/ S
Q/ SQ/ SQSSSSSSSSSSSSSS4U 4S jjrSrU =r$ )FocalNetConfig   az  
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{Gz?gh㈵>    Nc                   > [         TU ]  " S0 UD6  Xl        X l        X0l        X@l        XPl        X`l        Xpl        Xl	        Xl
        Xl        Xl        Xl        Xl        Xl        Xl        UU l        UU l        UU l        UU l        UU l        UU l        S/[/        S[1        U R                  5      S-   5       Vs/ s H  nSU 3PM
     sn-   U l        [5        UUU R2                  S9u  U l        U l        g s  snf )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/   r0   r1   r2   r   r   kwargsidx	__class__s                             k/var/www/auris/envauris/lib/python3.13/site-packages/transformers/models/focalnet/configuration_focalnet.pyr   FocalNetConfig.__init__l   s    6 	"6"$$(",((*$"#6 ,, 0"40P-#6 !2,,"8aT[[IY\]I]@^&_@^se}@^&__0Z%;DL\L\1
-D- '`s   <C8)r5   r6   r$   r*   r!   r2   r%   r&   r'   r)   r#   r   r0   r1   r,   r(   r/   r    r   r   r"   r+   r-   r.   )	__name__
__module____qualname____firstlineno____doc__
model_typer   __static_attributes____classcell__)r:   s   @r;   r   r      sb    N` J )!" ).!15
 5
    r   N)rA   configuration_utilsr   utilsr   utils.backbone_utilsr   r   
get_loggerr=   loggerr   __all__r   rE   r;   <module>rL      sB    # 3  c 
		H	%H
(*: H
V 
rE   