
    ij                     f    d dl mZ ddlmZ ddlmZ  ed      e G d de                    ZdgZy	)
    )strict   )PreTrainedConfig)auto_docstringzzju-community/efficientloftr)
checkpointc                       e Zd ZU dZdZdZee   dz  ed<   dZ	ee   dz  ed<   dZ
ee   d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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 dz  ed#<   dZ!eed$<   d%Z"eed&<   d'Z#eed(<    fd)Z$d* Z% xZ&S )+EfficientLoFTRConfiga^
  
    stage_num_blocks (`List`, *optional*, defaults to [1, 2, 4, 14]):
        The number of blocks in each stages
    stage_stride (`List`, *optional*, defaults to [2, 1, 2, 2]):
        The stride used in each stage
    q_aggregation_kernel_size (`int`, *optional*, defaults to 4):
        The kernel size of the aggregation of query states in the fusion network
    kv_aggregation_kernel_size (`int`, *optional*, defaults to 4):
        The kernel size of the aggregation of key and value states in the fusion network
    q_aggregation_stride (`int`, *optional*, defaults to 4):
        The stride of the aggregation of query states in the fusion network
    kv_aggregation_stride (`int`, *optional*, defaults to 4):
        The stride of the aggregation of key and value states in the fusion network
    num_attention_layers (`int`, *optional*, defaults to 4):
        Number of attention layers in the LocalFeatureTransformer
    mlp_activation_function (`str`, *optional*, defaults to `"leaky_relu"`):
        Activation function used in the attention mlp layer.
    coarse_matching_skip_softmax (`bool`, *optional*, defaults to `False`):
        Whether to skip softmax or not at the coarse matching step.
    coarse_matching_threshold (`float`, *optional*, defaults to 0.2):
        The threshold for the minimum score required for a match.
    coarse_matching_temperature (`float`, *optional*, defaults to 0.1):
        The temperature to apply to the coarse similarity matrix
    coarse_matching_border_removal (`int`, *optional*, defaults to 2):
        The size of the border to remove during coarse matching
    fine_kernel_size (`int`, *optional*, defaults to 8):
        Kernel size used for the fine feature matching
    batch_norm_eps (`float`, *optional*, defaults to 1e-05):
        The epsilon used by the batch normalization layers
    fine_matching_slice_dim (`int`, *optional*, defaults to 8):
        The size of the slice used to divide the fine features for the first and second fine matching stages.
    fine_matching_regress_temperature (`float`, *optional*, defaults to 10.0):
        The temperature to apply to the fine similarity matrix

    Examples:
        ```python
        >>> from transformers import EfficientLoFTRConfig, EfficientLoFTRForKeypointMatching

        >>> # Initializing a EfficientLoFTR configuration
        >>> configuration = EfficientLoFTRConfig()

        >>> # Initializing a model from the EfficientLoFTR configuration
        >>> model = EfficientLoFTRForKeypointMatching(configuration)

        >>> # Accessing the model configuration
        >>> configuration = model.config
        ```
    efficientloftrNstage_num_blocksout_featuresstage_stride   hidden_sizereluactivation_function   q_aggregation_kernel_sizekv_aggregation_kernel_sizeq_aggregation_stridekv_aggregation_stridenum_attention_layers   num_attention_headsg        attention_dropoutFattention_bias
leaky_relumlp_activation_functioncoarse_matching_skip_softmaxg?coarse_matching_thresholdg?coarse_matching_temperature   coarse_matching_border_removalfine_kernel_sizegh㈵>batch_norm_epsrope_parametersfine_matching_slice_dimg      $@!fine_matching_regress_temperatureg{Gz?initializer_rangec                    | j                   | j                   ng d| _         | j                  | j                  ng d| _        | j                  | j                  ng d| _        dg| j                  d d z   | _        t	        | j                  | j                         D cg c]  \  }}|gdg|dz
  z  z    c}}| _        t        | j                         D cg c]  \  }}| j                  |   g|z   c}}| _        t        t        | j                               D cg c]%  }| j                  |   g| j                  |   d d z   ' c}| _
        | j                  | _        t        t        | j                              d d | _        | j                   dz  | _        |j%                  dd       t'        | P  d	i | y c c}}w c c}}w c c}w )
N)   r!   r      )r!   r*   r!   r!   )@   r,      r   r*   r!   partial_rotary_factorg      @ )r   r   r   stage_in_channelszipstage_block_stride	enumeratestage_block_out_channelsrangelenstage_block_in_channelsr   num_key_value_headslistreversedfine_fusion_dimsr   intermediate_size
setdefaultsuper__post_init__)selfkwargsstride
num_blocks	stage_idx	__class__s        /var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/transformers/models/efficientloftr/configuration_efficientloftr.pyr@   z"EfficientLoFTRConfig.__post_init__e   s   9=9N9N9Z 5 5`m151B1B1ND--T`151B1B1ND--Tf"#t'8'8"'=!= ILDL]L]_c_t_tHu#
2D&*VHsj1n--#
 V__c_t_tUu)
<QIzTy)*Z7)
%
 #3t'<'<#=>(
 ##I./$2O2OPY2Z[^\^2__(
$
 $(#;#;  $Xd.?.?%@ A#2 F!%!1!1A!5137''#
)
(
s    F=G*G	c                     | j                   | j                  d   k7  r(t        d| j                    d| j                  d          y)zOPart of `@strict`-powered validation. Validates the architecture of the config.r.   zMhidden_size should be equal to the last value in out_features. hidden_size = z, out_features = N)r   r   
ValueError)rA   s    rG   validate_architecturez*EfficientLoFTRConfig.validate_architecture~   ss    t0044_`d`p`p_q  rC  DH  DU  DU  VX  DY  CZ  [  5    )'__name__
__module____qualname____doc__
model_typer   r:   int__annotations__r   r   r   r   strr   r   r   r   r   r   r   floatr   boolr   r   r   r    r"   r#   r$   r%   dictr&   r'   r(   r@   rJ   __classcell__)rF   s   @rG   r	   r	      s?   /b "J)-d3i$&-%)L$s)d")%)L$s)d")K%%%&s&&'' !#!!"3" !#!  %(us{( ND #/S/). $.'*u*),,*+"C+c NE #'OTD['#$S$/3%u3#u#(2rK   r	   N)huggingface_hub.dataclassesr   configuration_utilsr   utilsr   r	   __all__r0   rK   rG   <module>r\      sH     / 3 # 9:k+ k  ;k\ "
"rK   