
    iO                         d Z ddlmZ ddlmZ 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)zDPT model configuration    )strict   )%consolidate_backbone_kwargs_to_config)PreTrainedConfig)auto_docstring   )
AutoConfigzIntel/dpt-large)
checkpointc                        e Zd ZU dZdZdeiZdZee	d<   dZ
dez  e	d<   dZedz  e	d	<   d
Zedz  e	d<   dZee	d<   dZeez  dz  e	d<   dZeez  dz  e	d<   dZee	d<   dZedz  e	d<   dZeee   z  eeef   z  dz  e	d<   dZeee   z  eeef   z  dz  e	d<   dZedz  e	d<   dZee	d<   dZedz  e	d<   dZee   eed f   z  dz  e	d!<   d"Zee	d#<   d$Zeeez     eeez  d f   z  e	d%<   d&Zee   eed f   z  e	d'<   d(Z ee	d)<   d*Z!ee	d+<   dZ"edz  e	d,<   dZ#edz  e	d-<   dZ$ee	d.<   dZ%edz  e	d/<   d0Z&ee	d1<   d2Z'ee	d3<   d4Z(eez  e	d5<   d6Z)ee   eed f   z  dz  e	d7<   d8Z*ee   eed f   z  e	d9<   dZ+e,e-z  dz  e	d<   dZ.edz  e	d:<   d;Z/ee	d<<    fd=Z0 xZ1S )>	DPTConfiga   
    is_hybrid (`bool`, *optional*, defaults to `False`):
        Whether to use a hybrid backbone. Useful in the context of loading DPT-Hybrid models.
    backbone_out_indices (`list[int]`, *optional*, defaults to `[2, 5, 8, 11]`):
        Indices of the intermediate hidden states to use from backbone.
    readout_type (`str`, *optional*, defaults to `"project"`):
        The readout type to use when processing the readout token (CLS token) of the intermediate hidden states of
        the ViT backbone. Can be one of [`"ignore"`, `"add"`, `"project"`].
        - "ignore" simply ignores the CLS token.
        - "add" passes the information from the CLS token to all other tokens by adding the representations.
        - "project" passes information to the other tokens by concatenating the readout to all other tokens before
          projecting the
        representation to the original feature dimension D using a linear layer followed by a GELU non-linearity.
    reassemble_factors (`list[int]`, *optional*, defaults to `[4, 2, 1, 0.5]`):
        The up/downsampling factors of the reassemble layers.
    neck_hidden_sizes (`list[str]`, *optional*, defaults to `[96, 192, 384, 768]`):
        The hidden sizes to project to for the feature maps of the backbone.
    fusion_hidden_size (`int`, *optional*, defaults to 256):
        The number of channels before fusion.
    head_in_index (`int`, *optional*, defaults to -1):
        The index of the features to use in the heads.
    use_batch_norm_in_fusion_residual (`bool`, *optional*, defaults to `False`):
        Whether to use batch normalization in the pre-activate residual units of the fusion blocks.
    use_bias_in_fusion_residual (`bool`, *optional*, defaults to `True`):
        Whether to use bias in the pre-activate residual units of the fusion blocks.
    add_projection (`bool`, *optional*, defaults to `False`):
        Whether to add a projection layer before the depth estimation head.
    use_auxiliary_head (`bool`, *optional*, defaults to `True`):
        Whether to use an auxiliary head during training.
    auxiliary_loss_weight (`float`, *optional*, defaults to 0.4):
        Weight of the cross-entropy loss of the auxiliary head.
    semantic_classifier_dropout (`float`, *optional*, defaults to 0.1):
        The dropout ratio for the semantic classification head.
    backbone_featmap_shape (`list[int]`, *optional*, defaults to `[1, 1024, 24, 24]`):
        Used only for the `hybrid` embedding type. The shape of the feature maps of the backbone.
    neck_ignore_stages (`list[int]`, *optional*, defaults to `[0, 1]`):
        Used only for the `hybrid` embedding type. The stages of the readout layers to ignore.
    pooler_output_size (`int`, *optional*):
        Dimensionality of the pooler layer. If None, defaults to `hidden_size`.
    pooler_act (`str`, *optional*, defaults to `"tanh"`):
        The activation function to be used by the pooler.

    Example:

    ```python
    >>> from transformers import DPTModel, DPTConfig

    >>> # Initializing a DPT dpt-large style configuration
    >>> configuration = DPTConfig()

    >>> # Initializing a model from the dpt-large style configuration
    >>> model = DPTModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```dptbackbone_config   hidden_size   Nnum_hidden_layersnum_attention_headsi   intermediate_sizegelu
hidden_actg        hidden_dropout_probattention_probs_dropout_probg{Gz?initializer_rangeg-q=layer_norm_eps  
image_size   
patch_sizer   num_channelsF	is_hybridTqkv_bias)r            .backbone_out_indicesprojectreadout_type)   r      g      ?reassemble_factors)`      r   r   neck_hidden_sizes   fusion_hidden_sizehead_in_index!use_batch_norm_in_fusion_residualuse_bias_in_fusion_residualadd_projectionuse_auxiliary_headg?auxiliary_loss_weight   semantic_loss_ignore_indexg?semantic_classifier_dropout)r)   i      r:   backbone_featmap_shape)r   r)   neck_ignore_stagespooler_output_sizetanh
pooler_actc                    | j                   dvrt        d      | j                  r{t        | j                  t
              r| j                  j                  dd       t        d| j                  dddg dg dd	d
d|\  | _        }| j                   dk7  rNt        d      |j                  d      | j                  &t        dd| j                  i|\  | _        }d | _	        | j                  r| j                  nd | _
        | j                  r| j                  ng | _        | j                  r| j                  n| j                  | _        t        | <  di | y )N)ignoreaddr&   z8Readout_type must be one of ['ignore', 'add', 'project']
model_typebitsame
bottleneck)r   r(   	   )stage1stage2stage3T)global_padding
layer_typedepthsout_featuresembedding_dynamic_padding)r   default_config_typedefault_config_kwargsr&   z<Readout type must be 'project' when using `DPT-hybrid` mode.backboner    )r'   
ValueErrorr    
isinstancer   dict
setdefaultr   getr%   r;   r<   r=   r   super__post_init__)selfkwargs	__class__s     z/var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/transformers/models/dpt/configuration_dpt.pyrZ   zDPTConfig.__post_init__{   sQ   $@@WXX>>$..5$$//eD+P , $ 4 4$)&,".'$B15', ,(D &   I- !_``ZZ
#/43G3G3S+P , $ 4 4,,(D & )-D%EI^^d&A&AY]#=A^^$"9"9QS=A=T=T$"9"9Z^ZjZj''    )2__name__
__module____qualname____doc__rC   r	   sub_configsr   int__annotations__r   r   r   r   strr   floatr   r   r   r   listtupler   r   r    boolr!   r%   r'   r*   r-   r/   r1   r2   r3   r4   r5   r6   r8   r9   r;   r<   r   rV   r   r=   r?   rZ   __classcell__)r]   s   @r^   r   r      s`   7r J$j1K
 K$&tcz&&(t($(sTz(J.1t+17: %#+"4:#u##(NEDL(;>Jd3i%S/1D8>;=Jd3i%S/1D8= L#* It HdTk ?L$s)eCHo5<L!L#!FTS5[)E#+s2B,CCT5HtCy5c?2H!!M35:%td{:/33 ND &*t*#&5&&))/22ARDIc3h7$>R6<S	E#s(O3<6:OT,,t3:%)d
)J (  (r_   r   N)rc   huggingface_hub.dataclassesr   backbone_utilsr   configuration_utilsr   utilsr   auto.configuration_autor	   r   __all__rS   r_   r^   <module>rs      sP     . C 3 # 0 ,-A(  A(  .A(H -r_   