
    rhwb                        d Z ddlZddlmZ ddlmZ ddlZddlmc m	Z
 ddlmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZmZmZ ddlmZmZmZmZ ddlmZmZ ddlmZ ddl m!Z!  ejD                  e#      Z$ G d de!      Z%e ed       G d de                    Z& G d de      Z' G d de      Z( G d deejR                        Z* G d de      Z+ G d de      Z, G d  d!e      Z- G d" d#ej\                        Z/ G d$ d%ejR                        Z0 G d& d'ejR                        Z1 G d( d)ejR                        Z2e G d* d+e             Z3 ed,       G d- d.eejR                               Z4g d/Z5y)0zPyTorch EoMT model.    N)	dataclass)Optional)Tensornn   )ACT2FN)ModelOutput)PreTrainedModel)auto_docstringcan_return_tuplelogging   )Dinov2EmbeddingsDinov2LayerDinov2LayerScaleDinov2PatchEmbeddings)#Mask2FormerForUniversalSegmentationMask2FormerLoss)SiglipAttention)	ViTConfigc                   z     e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddedededededed	ef fd
Z xZS )
EomtConfiga  
    This is the configuration class to store the configuration of a [`EomtForUniversalSegmentation`]. It is used to instantiate an EoMT 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 EoMT
    [tue-mps/coco_panoptic_eomt_large_640](https://huggingface.co/tue-mps/coco_panoptic_eomt_large_640)
    architecture.

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

    Args:
        hidden_size (`int`, *optional*, defaults to 1024):
            Dimensionality of the hidden representations.
        num_hidden_layers (`int`, *optional*, defaults to 24):
            Number of hidden layers in the Transformer encoder.
        num_attention_heads (`int`, *optional*, defaults to 16):
            Number of attention heads in each attention layer.
        mlp_ratio (`int`, *optional*, defaults to 4):
            Ratio of the MLP hidden dimensionality to the hidden size.
        hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder.
        hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
            The dropout probability for all fully connected layers in the embeddings and encoder.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        layer_norm_eps (`float`, *optional*, defaults to 1e-06):
            The epsilon used by the layer normalization layers.
        image_size (`int`, *optional*, defaults to 640):
            The size (resolution) of each input image.
        patch_size (`int`, *optional*, defaults to 16):
            The size (resolution) of each patch.
        num_channels (`int`, *optional*, defaults to 3):
            The number of input channels.
        layerscale_value (`float`, *optional*, defaults to 1.0):
            Initial value for the LayerScale parameter.
        drop_path_rate (`float`, *optional*, defaults to 0.0):
            The stochastic depth rate (drop path) used during training.
        num_upscale_blocks (`int`, *optional*, defaults to 2):
            Number of upsampling blocks used in the decoder or segmentation head.
        attention_dropout (`float`, *optional*, defaults to 0.0):
            Dropout probability applied after attention projection.
        use_swiglu_ffn (`bool`, *optional*, defaults to `False`):
            Whether to use the SwiGLU feedforward neural network.
        num_blocks (`int`, *optional*, defaults to 4):
            Number of feature blocks or stages in the architecture.
        no_object_weight (`float`, *optional*, defaults to 0.1):
            Loss weight for the 'no object' class in panoptic/instance segmentation.
        class_weight (`float`, *optional*, defaults to 2.0):
            Loss weight for classification targets.
        mask_weight (`float`, *optional*, defaults to 5.0):
            Loss weight for mask prediction.
        dice_weight (`float`, *optional*, defaults to 5.0):
            Loss weight for the dice loss component.
        train_num_points (`int`, *optional*, defaults to 12544):
            Number of points to sample for mask loss computation during training.
        oversample_ratio (`float`, *optional*, defaults to 3.0):
            Oversampling ratio used in point sampling for mask training.
        importance_sample_ratio (`float`, *optional*, defaults to 0.75):
            Ratio of points to sample based on importance during training.
        num_queries (`int`, *optional*, defaults to 200):
            Number of object queries in the Transformer.
        num_register_tokens (`int`, *optional*, defaults to 4):
            Number of learnable register tokens added to the transformer input.

    Example:

    ```python
    >>> from transformers import EomtConfig, EomtForUniversalSegmentation

    >>> # Initialize configuration
    >>> config = EomtConfig()

    >>> # Initialize model
    >>> model = EomtForUniversalSegmentation(config)

    >>> # Access config
    >>> config = model.config
    ```eomtno_object_weightclass_weightmask_weightdice_weighttrain_num_pointsoversample_ratioimportance_sample_ratioc                 2   t        |   d||||||||	|
|d
| | `| `| `| `| `| `|| _        || _	        || _
        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        y )N)
hidden_sizenum_hidden_layersnum_attention_headshidden_dropout_prob
hidden_actinitializer_rangelayer_norm_eps
image_size
patch_sizenum_channels )super__init__intermediate_sizeqkv_bias
pooler_actpooler_output_sizeencoder_strideattention_probs_dropout_prob	mlp_ratioattention_dropoutlayerscale_valuedrop_path_ratenum_upscale_blocksuse_swiglu_ffn
num_blocksr   r   r   r   r   r   r    num_queriesnum_register_tokens)selfr"   r#   r$   r5   r&   r%   r'   r(   r)   r*   r+   r7   r8   r9   r6   r:   r;   r   r   r   r   r   r   r    r<   r=   kwargs	__class__s                               x/var/www/html/ai-insurance-compliance-backend/venv/lib/python3.12/site-packages/transformers/models/eomt/modular_eomt.pyr.   zEomtConfig.__init__   s    < 	 	
#/ 3 3!/)!!%	
 	
 "MO#-"!2 0,"4,$ 0(&& 0 0'>$&#6     )i            gelu        g{Gz?ư>i  rD   r         ?rG   r   rG   FrE   g?g       @      @rJ   i 1  g      @g      ?   rE   )	__name__
__module____qualname____doc__
model_typefloatintr.   __classcell__r@   s   @rA   r   r   1   s    M^ J "%!   %"%)-7B7&  'B7( )B7* +B7, -B7. /B70  1B72 "'3B7 B7rB   r   a  
    Class for outputs of [`EomtForUniversalSegmentationOutput`].

    This output can be directly passed to [`~EomtImageProcessor.post_process_semantic_segmentation`] or
    [`~EomtImageProcessor.post_process_instance_segmentation`] or
    [`~EomtImageProcessor.post_process_panoptic_segmentation`] to compute final segmentation maps. Please, see
    [`~EomtImageProcessor] for details regarding usage.
    )custom_introc                   <   e Zd ZU dZdZeej                     ed<   dZ	eej                     ed<   dZ
eej                     ed<   dZeej                     ed<   dZeeej                        ed<   dZeeej                        ed<   dZeeej"                        ed	<   y)
"EomtForUniversalSegmentationOutputa+  
    loss (`torch.Tensor`, *optional*):
        The computed loss, returned when labels are present.
    class_queries_logits (`torch.FloatTensor`):
        A tensor of shape `(batch_size, num_queries, num_labels + 1)` representing the proposed classes for each
        query. Note the `+ 1` is needed because we incorporate the null class.
    masks_queries_logits (`torch.FloatTensor`):
        A tensor of shape `(batch_size, num_queries, height, width)` representing the proposed masks for each
        query.
    last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):
        Last hidden states (final feature map) of the last layer.
    hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
        Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each stage) of
        shape `(batch_size, sequence_length, hidden_size)`. Hidden-states all layers of the model.
    attentions (`tuple(tuple(torch.FloatTensor))`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
        Tuple of `tuple(torch.FloatTensor)` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
        sequence_length)`. Self and Cross Attentions weights from transformer decoder.
    patch_offsets (`list[torch.Tensor]`, *optional*):
        list of tuples indicating the image index and start and end positions of patches for semantic segementation.
    Nlossclass_queries_logitsmasks_queries_logitslast_hidden_statehidden_states
attentionspatch_offsets)rL   rM   rN   rO   rX   r   torchFloatTensor__annotations__rY   rZ   r[   r\   tupler]   r^   listr   r,   rB   rA   rW   rW      s    * )-D(5$$
%,8<(5#4#45<8<(5#4#45<59x 1 1298<M8E%"3"345<59Ju0012926M8D./6rB   rW   c                       e Zd Zy)EomtLossNrL   rM   rN   r,   rB   rA   re   re          rB   re   c                       e Zd Zy)EomtPatchEmbeddingsNrf   r,   rB   rA   ri   ri      rg   rB   ri   c                   Z    e Zd ZdeddfdZd Zdej                  dej                  fdZy)EomtEmbeddingsconfigreturnNc                    t               j                          || _        |j                  | _        t	        j
                  t        j                  dd|j                              | _	        t	        j
                  t        j                  d|j                  |j                              | _        t        |      | _        | j                  j                  }t	        j                   |j"                        | _        d|j                  z   | _        t	        j(                  ||j                        | _        | j-                  dt        j.                  |      j1                  d      d       y )N   position_ids)ro   F)
persistent)r   r.   rl   r*   r   	Parameterr_   randnr"   	cls_tokenzerosr=   register_tokensri   patch_embeddingsnum_patchesDropoutr%   dropoutnum_prefix_tokens	Embeddingposition_embeddingsregister_bufferarangeexpand)r>   rl   ry   s      rA   r.   zEomtEmbeddings.__init__   s    ##% ++ekk!Q8J8J&KL!||EKK6;U;UW]WiWi,jk 3F ;++77zz&"<"<=!"V%?%?!?#%<<V=O=O#P ^U\\+-F-M-Mg-VchirB   c                     t        d      )NzNot needed for Eomt ModelAttributeErrorr>   s    rA   interpolate_pos_encodingz'EomtEmbeddings.interpolate_pos_encoding  s    899rB   pixel_valuesc                    |j                   \  }}}}| j                  j                  j                  j                  }| j                  |j                  |            }| j                  j                  |dd      }| j                  j                  |dd      }|| j                  | j                        z   }t        j                  |||gd      }| j                  |      }|S )N)dtyperq   ro   dim)shaperx   
projectionweightr   toru   r   rw   r~   rp   r_   catr{   )r>   r   
batch_size_target_dtype
embeddings
cls_tokensrw   s           rA   forwardzEomtEmbeddings.forward  s    *00
Aq!,,77>>DD**<???+NO
^^**:r2>
..55j"bI$":":4;L;L"MM
YY
OZHaP
\\*-
rB   )	rL   rM   rN   r   r.   r   r_   r   r   r,   rB   rA   rk   rk      s8    jz jd j :ELL U\\ rB   rk   c                       e Zd Zy)EomtAttentionNrf   r,   rB   rA   r   r     rg   rB   r   c                       e Zd Zy)EomtLayerScaleNrf   r,   rB   rA   r   r   "  rg   rB   r   c                       e Zd Zy)	EomtLayerNrf   r,   rB   rA   r   r   &  rg   rB   r   c                   X     e Zd Zd fd	Zdej
                  dej
                  fdZ xZS )EomtLayerNorm2dc                 *    t         |   |||       y )N)epselementwise_affine)r-   r.   )r>   r+   r   affiner@   s       rA   r.   zEomtLayerNorm2d.__init__+  s    36JrB   hidden_staterm   c                     |j                  dddd      }t        j                  || j                  | j                  | j
                  | j                        }|j                  dddd      }|S )Nr   r   r   ro   )permuteF
layer_normnormalized_shaper   biasr   )r>   r   s     rA   r   zEomtLayerNorm2d.forward.  sb    #++Aq!Q7||L$2G2GVZV_V_aeaiaij#++Aq!Q7rB   )rH   T)rL   rM   rN   r.   r_   r   r   rS   rT   s   @rA   r   r   *  s$    KELL U\\ rB   r   c                   \     e Zd Zdef fdZdej                  dej                  fdZ xZ	S )EomtScaleLayerrl   c                    t         |           |j                  }t        j                  ||dd      | _        t        |j                     | _        t        j                  ||dd|d      | _
        t        |      | _        y )Nr   )kernel_sizestrider   ro   F)r   paddinggroupsr   )r-   r.   r"   r   ConvTranspose2dconv1r   r&   
activationConv2dconv2r   layernorm2dr>   rl   r"   r@   s      rA   r.   zEomtScaleLayer.__init__6  su    ((''[aXYZ
 !2!23YY

 +;7rB   r\   rm   c                     | j                  |      }| j                  |      }| j                  |      }| j                  |      }|S N)r   r   r   r   r>   r\   s     rA   r   zEomtScaleLayer.forwardF  sB    

=16

=1((7rB   )
rL   rM   rN   r   r.   r_   tensorr   r   rS   rT   s   @rA   r   r   5  s*    8z 8 U\\ ell rB   r   c                   \     e Zd Zdef fdZdej                  dej                  fdZ xZS )EomtScaleBlockrl   c                     t         |           |j                  | _        t	        j
                  t        | j                        D cg c]  }t        |       c}      | _        y c c}w r   )	r-   r.   r9   r;   r   
ModuleListranger   block)r>   rl   r   r@   s      rA   r.   zEomtScaleBlock.__init__O  sG     33]]E$//DZ#[qN6$:#[\
#[s   A&r\   rm   c                 8    | j                   D ]
  } ||      } |S r   )r   )r>   r\   r   s      rA   r   zEomtScaleBlock.forwardT  s%    ZZ 	1E!-0M	1rB   	rL   rM   rN   r   r.   r_   r   r   rS   rT   s   @rA   r   r   N  s,    ]z ]
U\\ ell rB   r   c                   \     e Zd Zdef fdZdej                  dej                  fdZ xZS )EomtMaskHeadrl   c                    t         |           |j                  }t        j                  ||      | _        t        j                  ||      | _        t        j                  ||      | _        t        |j                     | _
        y r   )r-   r.   r"   r   Linearfc1fc2fc3r   r&   r   r   s      rA   r.   zEomtMaskHead.__init__[  sa    ((99[+699[+699[+6 !2!23rB   r\   rm   c                     | j                  | j                  |            }| j                  | j                  |            }| j                  |      }|S r   )r   r   r   r   r   s     rA   r   zEomtMaskHead.forwardd  sD    (?@(?@/rB   r   rT   s   @rA   r   r   Z  s*    4z 4U\\ ell rB   r   c                   Z    e Zd ZU dZeed<   dZdZdZdgZ	dZ
dZdej                  d	d
fdZy
)EomtPreTrainedModelz
    An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
    models.
    rl   r   r   Fr   Tmodulerm   Nc                    | j                   j                  }t        |t        j                  t        j
                  t        j                  f      rt        j                  j                  |j                  t        j                  d             |j                  xt        j                  j                  |j                        \  }}|dkD  rdt        j                  |      z  nd}t        j                  j                  |j                  | |       y y t        |t        j                        rJ|j                  j                   j#                  d       |j                  j                   j%                          y t        |t        j&                        rf|j                  j                   j)                  dd       |j*                  2|j                  j                   |j*                     j%                          y y t        |t,              rGt/        |d      r:|j0                  j                   j#                  | j                   j2                         y y t        |t4              rt        j                  j7                  |j8                  j                   j;                  t<        j>                        d|      j;                  |j8                  j@                        |j8                  _        |jB                  j                   j%                          y y )	N   )ar   ro   rI   rG   )meanstdlambda1)"rl   r'   
isinstancer   r   r   r   initkaiming_uniform_r   mathsqrtr   _calculate_fan_in_and_fan_outuniform_	LayerNormdatafill_zero_r}   normal_padding_idxr   hasattrr   r7   rk   trunc_normal_ru   r   r_   float32r   rw   )r>   r   r   fan_inr   bounds         rA   _init_weightsz!EomtPreTrainedModel._init_weightsz  s   kk++fryy"))R5G5GHIGG$$V]]diil$C{{&GGAA&--P	17!DIIf--  ufe< ' -MM$$S)KK""$-MM&&CQ&7!!-""6#5#56<<> ./vy)##))$++*F*FG */$&GG$9$9  %%((7cs %: %b!!''( ! ""''--/	 0rB   )rL   rM   rN   rO   r   ra   base_model_prefixmain_input_namesupports_gradient_checkpointing_no_split_modules_supports_sdpa_supports_flash_attnr   Moduler   r,   rB   rA   r   r   k  sJ    
 $O&+#$N0BII 0$ 0rB   r   zV
    The EoMT Model with head on top for instance/semantic/panoptic segmentation.
    c                       e Zd ZdeddfdZd Zd Zdej                  fdZ	e
d	        Zee	 	 	 	 	 dd
edeee      deee      dee   dee   deee      fd              Zy)EomtForUniversalSegmentationrl   rm   Nc                    t        j                         j                  |       || _        |j                  | _        t        |      | _        t        j                  |j                  |j                        | _
        t        j                  |j                  |j                        | _        t        j                  t        |j                        D cg c]  }t!        |       c}      | _        t%        |      | _        t)        |      | _        t        j,                  |j                  |j.                  dz         | _        |j2                  |j4                  z  |j2                  |j4                  z  f| _        |j8                  |j:                  |j<                  d| _        tA        || j>                        | _!        | jE                  dtG        jH                  |jJ                               | jM                          y c c}w )N)r   ro   )loss_cross_entropy	loss_mask	loss_dice)rl   weight_dictattn_mask_probs)'r   r   r.   rl   r#   rk   r   r   r"   r(   	layernormr}   r<   queryr   r   r   layersr   upscale_blockr   	mask_headr   
num_labelsclass_predictorr)   r*   	grid_sizer   r   r   r   re   	criterionr   r_   onesr;   	post_init)r>   rl   r   s      rA   r.   z%EomtForUniversalSegmentation.__init__  sv   
		V$!'!9!9(0f&8&8f>S>ST\\&"4"4f6H6HI
mmfF^F^@_$`1Yv%6$`a+F3%f-!yy););V=N=NQR=RS ++v/@/@@&BSBSW]WhWhBhi"("5"5++++.
 "T=M=MN.

6;L;L0MN% %as   G=c                 .    | j                   j                  S r   )r   rx   r   s    rA   get_input_embeddingsz1EomtForUniversalSegmentation.get_input_embeddings  s    ///rB   c                     t        d      )NzNote needed for Eomt Model.r   r   s    rA   get_auxiliary_logitsz1EomtForUniversalSegmentation.get_auxiliary_logits  s    :;;rB   logitsc                    |d d d | j                   j                  d d f   }| j                  |      }|d d | j                   j                  | j                  j                  z   d d d f   }|j                  dd      } |j                  |j                  d   dg| j                   }| j                  |      }| j                  |      }t        j                  d||      }||fS )Nro   r   r   rq   zbqc, bchw -> bqhw)rl   r<   r   r   r|   	transposereshaper   r   r   r   r_   einsum)r>   r  query_tokensclass_logitsprefix_tokensmask_logitss         rA   predictz$EomtForUniversalSegmentation.predict  s    a!:4;;#:#:!:A=>++L9q$++"9"9DOO<]<]"]"_abbc%//15---m.A.A!.DbZ4>>Z~~l3**=9ll#6mTL((rB   c                     |dk  r9t        j                  | j                  d   ||      |kD  }d| d d d ||d f   |<   | S )Nro   r   )device)r_   randr   )	attn_maskprobnum_query_tokensencoder_start_tokensr  random_queriess         rA   _disable_attention_maskz4EomtForUniversalSegmentation._disable_attention_mask  sW    !8"ZZ	(:<LU[\_ccN VWIa***,@,AAB>RrB   r   mask_labelsclass_labelsoutput_hidden_statesoutput_attentionsr^   c           	         ||n| j                   j                  }||n| j                   j                  }|rdnd}|rdnd}d\  }	}
d}|t        d      | j	                  |      }t        | j                        D ]  \  }}|r||fz  }|| j                  | j                   j                  z
  k(  rp| j                  j                  dddddf   j                  |j                  d   dd      j                  |j                        }t        j                   ||fd      }|| j                  | j                   j                  z
  k\  r| j"                  s7| j$                  || j                  z
  | j                   j                  z      dkD  r| j'                  |      }| j)                  |      \  }}|	|fz  }	|
|fz  }
t        j*                  |j                  d   |j                  d   |j                  d   |j                  t        j,                  	      }t/        j0                  || j2                  d
      }|j5                  |j7                  d      |j7                  d      d      }| j                   j8                  }|| j                  j:                  z   }|dkD  |ddd||df<   | j=                  || j$                  || j                  z
  | j                   j                  z      |||j                        }|ddddf   j                  d| j                   j>                  dd      }|jA                         jC                  | d      } ||||      }|d   }|s||d   fz  } | j'                  |      }|r||fz  }| j)                  |      \  }}|	|fz  }	|
|fz  }
d}|B|@d}tE        |	|
      D ]/  \  }}| jG                  ||||d      }|| jI                  |      z  }1 tK        |||||||      S )ah  
        mask_labels (`list[torch.Tensor]`, *optional*):
            list of mask labels of shape `(num_labels, height, width)` to be fed to a model
        class_labels (`list[torch.LongTensor]`, *optional*):
            list of target class labels of shape `(num_labels, height, width)` to be fed to a model. They identify the
            labels of `mask_labels`, e.g. the label of `mask_labels[i][j]` if `class_labels[i][j]`.
        patch_offsets (`list[torch.Tensor]`, *optional*):
            list of tuples indicating the image index and start and end positions of patches for semantic segementation.
        Nr,   )r,   r,   z You have to specify pixel_valuesr   rq   ro   r   )r  r   bilinear)sizemode)r  r  r  r  .g    erG   )rZ   rY   r  r  auxiliary_predictions)rX   rZ   rY   r[   r\   r]   r^   )&rl   r  r  
ValueErrorr   	enumerater   r#   r;   r   r   r   r   r   r  r_   r   trainingr   r   r  r   boolr   interpolater   viewr  r<   r|   r  r$   rQ   masked_fillzipget_loss_dictget_lossrW   )r>   r   r  r  r  r  r^   all_hidden_statesall_attentionsmasks_queries_logits_per_layerclass_queries_logits_per_layerattention_maskr\   idxlayer_moduler   norm_hidden_statesrZ   rY   interpolated_logitsr  r  layer_outputssequence_outputrX   	loss_dicts                             rA   r   z$EomtForUniversalSegmentation.forward  sV   * %9$D $++JjJj 	 2C1N-TXT_T_TqTq"6BD0dIOF&(F?@@5!*4;;!7 5	6C#!m%55!d,,t{{/E/EEE

))$1*5<<]=P=PQR=SUWY[\__`m`t`tu %		5-*@a Hd,,t{{/E/EEE!5!5cD<R<R6RUYU`U`UkUk6k!lop!p%)^^M%B"=A\\J\=]:$&:.3G2II..3G2II.!&!''*!''*!''*(//**" '(mm4Ht~~dn&o#&9&>&>',,Q/1D1I1I!1Lb'# $(;;#:#: '7$//:[:['[$ ObdeNeq"3#3"35I5JJK "&!=!="--cD4J4J.JT[[McMc.cd%5)=)00 "> " "04!=!D!DRIhIhjlnp!q!/!5!5!7!C!C^OUY!Z(HYZM)!,M =#3"55k5	6n ..7/!3359\\/5R22&+?*AA&&+?*AA&"|'?D>A.0N? 
1:$&: !..)=)= +!-*. / 	 i00
1 2!5!5-+%'
 	
rB   )NNNNN)rL   rM   rN   r   r.   r  r  r_   r   r  staticmethodr  r   r   r   rc   r%  r   r,   rB   rA   r   r     s    z d 80<)ell )     /3/3/3,004x
x
 d6l+x
 tF|,	x

 'tnx
 $D>x
  V-x
  x
rB   r   )r   r   r   )6rO   r   dataclassesr   typingr   r_   torch.nn.functionalr   
functionalr   r   activationsr   
file_utilsr	   modeling_utilsr
   utilsr   r   r   dinov2.modeling_dinov2r   r   r   r    mask2former.modeling_mask2formerr   r   siglip.modeling_siglipr   vit.configuration_vitr   
get_loggerrL   loggerr   rW   re   ri   r   rk   r   r   r   r   r   r   r   r   r   r   __all__r,   rB   rA   <module>rH     s     !      ! . 
  d 4 - 
		H	%T7 T7n 	7 7	 7>	 		/ 	!%ryy !H	O 		% 		 	bll RYY 2	RYY 	299 " $0/ $0 $0N 
x
#F		 x

x
v PrB   