Ë
    T^(h  ã                   óˆ   — d dl mZmZ ddlmZ ddlmZ ddlmZ erddl	m
Z
  ej                  e«      Z G d„ d	e«      Zd	gZy
)é    )ÚTYPE_CHECKINGÚListé   )ÚPretrainedConfig)Úloggingé   )ÚCONFIG_MAPPING)ÚSuperPointConfigc                   óf   ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 ddddedee   dee   ded	ed
edefˆ fd„Z	ˆ xZ
S )ÚSuperGlueConfiga	  
    This is the configuration class to store the configuration of a [`SuperGlueModel`]. It is used to instantiate a
    SuperGlue 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 SuperGlue
    [magic-leap-community/superglue_indoor](https://huggingface.co/magic-leap-community/superglue_indoor) architecture.

    Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PretrainedConfig`] for more information.

    Args:
        keypoint_detector_config (`Union[AutoConfig, dict]`,  *optional*, defaults to `SuperPointConfig`):
            The config object or dictionary of the keypoint detector.
        hidden_size (`int`, *optional*, defaults to 256):
            The dimension of the descriptors.
        keypoint_encoder_sizes (`List[int]`, *optional*, defaults to `[32, 64, 128, 256]`):
            The sizes of the keypoint encoder layers.
        gnn_layers_types (`List[str]`, *optional*, defaults to `['self', 'cross', 'self', 'cross', 'self', 'cross', 'self', 'cross', 'self', 'cross', 'self', 'cross', 'self', 'cross', 'self', 'cross', 'self', 'cross']`):
            The types of the GNN layers. Must be either 'self' or 'cross'.
        num_attention_heads (`int`, *optional*, defaults to 4):
            The number of heads in the GNN layers.
        sinkhorn_iterations (`int`, *optional*, defaults to 100):
            The number of Sinkhorn iterations.
        matching_threshold (`float`, *optional*, defaults to 0.0):
            The matching threshold.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.

    Examples:
        ```python
        >>> from transformers import SuperGlueConfig, SuperGlueModel

        >>> # Initializing a SuperGlue superglue style configuration
        >>> configuration = SuperGlueConfig()

        >>> # Initializing a model from the superglue style configuration
        >>> model = SuperGlueModel(configuration)

        >>> # Accessing the model configuration
        >>> configuration = model.config
        ```
    Ú	superglueÚkeypoint_detector_configr
   Úhidden_sizeÚkeypoint_encoder_sizesÚgnn_layers_typesÚnum_attention_headsÚsinkhorn_iterationsÚmatching_thresholdÚinitializer_rangec	                 óÚ  •— |�|nddgdz  | _         t        d„ | j                   D «       «      st        d«      ‚||z  dk7  rt        d«      ‚|�|ng d¢| _        || _        || _        || _         || _        || _        || _        t        |t        «      rd	|v r|d	   nd
|d	<   t        |d	      di |¤Ž}|€t        d
   «       }|| _        || _        d| _        d| _        t        ‰
| �@  di |	¤Ž y )NÚselfÚcrossé	   c              3   ó$   K  — | ]  }|d v –— Œ
 y­w))r   r   N© )Ú.0Ú
layer_types     ús/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/superglue/configuration_superglue.pyú	<genexpr>z+SuperGlueConfig.__init__.<locals>.<genexpr>V   s   è ø€ Ò[°z�:Ð!2Ô2Ñ[ùs   ‚z5All gnn_layers_types must be either 'self' or 'cross'r   z8hidden_size % num_attention_heads is different from zero)é    é@   é€   é   Ú
model_typeÚ
superpointFr   )r   ÚallÚ
ValueErrorr   r   r   r   r   Ú
isinstanceÚdictr	   r   r   Úattention_probs_dropout_probÚ
is_decoderÚsuperÚ__init__)r   r   r   r   r   r   r   r   r   ÚkwargsÚ	__class__s             €r   r-   zSuperGlueConfig.__init__H   s3  ø€ ð 5EÐ4PÑ 0ÐW]Ð_fÐVgÐjkÑVkˆÔäÑ[ÀT×EZÑEZÔ[Ô[ÜÐTÓUÐUàÐ,Ñ,°Ò1ÜÐWÓXÐXð '=Ð&HÑ"ÒN`ð 	Ô#ð 'ˆÔØ&<ˆÔ#Ø 0ˆÔØ#6ˆÔ Ø#6ˆÔ Ø"4ˆÔäÐ.´Ô5à:FÐJbÑ:bÐ(¨Ò6Ðhtð % \Ñ2ô (6Ð6NÈ|Ñ6\Ñ']ñ (Ø*ñ(Ð$ð $Ð+Ü'5°lÑ'CÓ'EÐ$à(@ˆÔ%Ø!2ˆÔØ,-ˆÔ)ØˆŒä‰ÑÑ"˜6Ó"ó    )Nr#   NNé   éd   g        g{®Gáz”?)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r$   Úintr   ÚstrÚfloatr-   Ú__classcell__)r/   s   @r   r   r      sŠ   ø„ ñ(ðT €Jð 8<ØØ,0Ø&*Ø#$Ø#&Ø$'Ø#'ñ-#à"4ð-#ð ð-#ð !% S¡	ð	-#ð
 ˜s™)ð-#ð !ð-#ð !ð-#ð "ð-#ð !÷-#ñ -#r0   r   N)Útypingr   r   Úconfiguration_utilsr   Úutilsr   Úautor	   r%   r
   Ú
get_loggerr3   Úloggerr   Ú__all__r   r0   r   ú<module>rB      sG   ð÷ 'å 3Ý Ý !ñ Ý-à	ˆ×	Ñ	˜HÓ	%€ôZ#Ð&ô Z#ðz Ð
�r0   