
    i                         d dl mZ ddlmZ ddlmZ ddlmZmZ ddl	m
Z
  ed	      e G d
 de                    ZdgZy)    )strict   )PreTrainedConfig)auto_docstring   )CONFIG_MAPPING
AutoConfig)SuperPointConfigzETH-CVG/lightglue_superpoint)
checkpointc                        e Zd ZU dZdZdeiZdZee	z  dz  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<   dZee
d<   dZee
d<   dZeez  e
d<   dZee
d<    fdZd Z xZS )LightGlueConfigaG  
    keypoint_detector_config (`Union[AutoConfig, dict]`,  *optional*, defaults to `SuperPointConfig`):
        The config object or dictionary of the keypoint detector.
    descriptor_dim (`int`, *optional*, defaults to 256):
        The dimension of the descriptors.
    depth_confidence (`float`, *optional*, defaults to 0.95):
        The confidence threshold used to perform early stopping
    width_confidence (`float`, *optional*, defaults to 0.99):
        The confidence threshold used to prune points
    filter_threshold (`float`, *optional*, defaults to 0.1):
        The confidence threshold used to filter matches

    Examples:
        ```python
        >>> from transformers import LightGlueConfig, LightGlueForKeypointMatching

        >>> # Initializing a LightGlue style configuration
        >>> configuration = LightGlueConfig()

        >>> # Initializing a model from the LightGlue style configuration
        >>> model = LightGlueForKeypointMatching(configuration)

        >>> # Accessing the model configuration
        >>> configuration = model.config
        ```
    	lightgluekeypoint_detector_configN   descriptor_dim	   num_hidden_layers   num_attention_headsnum_key_value_headsgffffff?depth_confidencegGz?width_confidenceg?filter_thresholdg{Gz?initializer_rangegelu
hidden_actg        attention_dropoutTattention_biasc                    | j                   | j                  | _         t        | j                  t              rX| j                  j                  dd      | j                  d<   t        | j                  d      di | j                  ddi| _        n | j                  t        d   d      | _        | j                  dz  | _        | j                  | _	        t        | ,  di | y )N
model_type
superpointattn_implementationeager)r"   r    )r   r   
isinstancer   dictgetr   r   intermediate_sizehidden_sizesuper__post_init__)selfkwargs	__class__s     /var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/transformers/models/lightglue/configuration_lightglue.pyr+   zLightGlueConfig.__post_init__K   s    ##+'+'?'?D$ d33T::>:W:W:[:[\hjv:wD)),7,:4;X;XYe;f,g -//-EL-D) **2,:<,H]d,eD)!%!4!4q!8..''    c                 R    | j                   | j                  z  dk7  rt        d      y)zOPart of `@strict`-powered validation. Validates the architecture of the config.r   z1descriptor_dim % num_heads is different from zeroN)r   r   
ValueError)r,   s    r/   validate_architecturez%LightGlueConfig.validate_architecture]   s,    !9!99Q>PQQ ?r0   )__name__
__module____qualname____doc__r    r	   sub_configsr   r&   r
   __annotations__r   intr   r   r   r   floatr   r   r   r   strr   r   boolr+   r3   __classcell__)r.   s   @r/   r   r      s    6 J-z:K?Cd%55<CNCs  &*t*"e""e"!e!#u#J%(us{(ND($Rr0   r   N)huggingface_hub.dataclassesr   configuration_utilsr   utilsr   autor   r	   r!   r
   r   __all__r$   r0   r/   <module>rD      sQ   * / 3 # - ) 9:AR& AR  ;ARH 
r0   