Ë
    ÛÓ^jj  ã                   ó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_sizegñhãˆµøä>Úbatch_norm_epsÚrope_parametersÚfine_matching_slice_dimg      $@Ú!fine_matching_regress_temperatureg{®Gáz”?Ú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/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/efficientloftr/configuration_efficientloftr.pyr@   z"EfficientLoFTRConfig.__post_init__e   s¿  ø€ à9=×9NÑ9NÐ9Z × 5Ò 5Ò`mˆÔØ15×1BÑ1BÐ1N˜D×-Ò-ÒT`ˆÔØ15×1BÑ1BÐ1N˜D×-Ò-ÒTfˆÔØ"#  t×'8Ñ'8¸¸"Ð'=Ñ!=ˆÔô ILÈD×L]ÑL]Ð_c×_tÑ_tÓHu÷#
Ù2D°&¸*ˆVˆH˜�s˜j¨1™nÑ-Ó-ó#
ˆÔô V_Ð_c×_tÑ_tÓUu÷)
Ù<Q¸IÀzˆT×Ñ˜yÑ)Ð*¨ZÓ7ó)
ˆÔ%ô
 #¤3 t×'<Ñ'<Ó#=Ó>ö(
àð ×#Ñ# IÑ.Ð/°$×2OÑ2OÐPYÑ2ZÐ[^Ð\^Ð2_Ó_ò(
ˆÔ$ð
 $(×#;Ñ#;ˆÔ Ü $¤X¨d×.?Ñ.?Ó%@Ó AÀ#À2Ð FˆÔØ!%×!1Ñ!1°AÑ!5ˆÔØ×ÑÐ1°3Ô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à)-Ð�d˜3‘i $Ñ&Ó-Ø%)€L�$�s‘)˜dÑ"Ó)Ø%)€L�$�s‘)˜dÑ"Ó)Ø€K�ÓØ%Ð˜Ó%Ø%&Ð˜sÓ&Ø&'Ð Ó'Ø !Ð˜#Ó!Ø!"Ð˜3Ó"Ø !Ð˜#Ó!Ø Ð˜Ó Ø%(Ð�u˜s‘{Ó(Ø €N�DÓ Ø#/Ð˜SÓ/Ø).Ð  $Ó.Ø'*Ð˜uÓ*Ø),Ð Ó,Ø*+Ð" CÓ+ØÐ�cÓØ €N�EÓ Ø#'€O�T˜D‘[Ó'Ø#$Ð˜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   