+
    œ°³jÒo  ã                   ó   € ^ RI t ^ RIHt ^ RIHt ^ RIt^ RIHt ^ RIH	t	 ^ RIH
t
HtHt ^RIHt ^RIHt ^RIHtHtHtHt ^R	IHt ^R
IHt ^RIHtHtHt ^RIH t  ^RI!H"t"H#t#H$t$ ^RI%H&t& ^RI'H(t(H)t) ]PT                  ! ]+4      t,]! RR7      ]	 ! R R]4      4       4       t-] ! R R]4      4       t.] ! R R]4      4       t/ ! R R]P`                  4      t1] ! R R])4      4       t2]! RR7       ! R R](4      4       t3 ! R  R!]&4      t4] ! R" R#]24      4       t5]! R$R7       ! R% R&]24      4       t6]! R'R7       ! R( R)]24      4       t7. R*Ot8R# )+é    N)Ú	dataclass)ÚLiteral)Ústrict)ÚBCEWithLogitsLossÚCrossEntropyLossÚMSELoss)Úinitialization)ÚPreTrainedConfig)ÚBaseModelOutputÚMaskedLMOutputÚSequenceClassifierOutputÚTokenClassifierOutput)ÚPreTrainedModel)ÚUnpack)ÚTransformersKwargsÚauto_docstringÚlogging)Úcan_return_tuple)ÚCONFIG_MAPPINGÚ
AutoConfigÚ	AutoModel)ÚModernBertPredictionHead)ÚSmolVLMModelÚSmolVLMPreTrainedModelúModernVBERT/modernvbert)Ú
checkpointc                   óz   a a€ ] tR t^,t oRtRtR]R]/tRtRt	Rt
^tRtRtR	tR
tRtRtV 3R ltV3R ltRtVtV ;t# )ÚModernVBertConfigaï  
pixel_shuffle_factor (`int | None`, *optional*, defaults to 4):
    Scale factor used by any pixel-shuffle / upsampling operations in the vision head.
initializer_cutoff_factor (`float | None`, *optional*, defaults to 2.0):
    The cutoff factor for the truncated_normal_initializer for initializing all weight matrices.
classifier_pooling (`Literal["cls", "mean"]`, *optional*, defaults to `"cls"`):
    The pooling strategy to use for classification tasks.
classifier_bias (`bool | None`, *optional*, defaults to `False`):
    Whether to add a bias term to the classification head

Example:
```python
>>> from transformers import ModernVBertConfig

>>> # Initializing configuration
>>> configuration = ModernVBertConfig()

>>> # Initializing a model from the configuration (model class is implemented in
>>> # `modernvbert.modeling_modernvbert`)

>>> from transformers import ModernVBertModel
>>> model = ModernVBertModel(configuration)

>>> # Accessing the model configuration
>>> cfg = model.config
```ÚmodernvbertÚtext_configÚvision_configNiçÄ  g{®Gáz”?ç       @Úclsç        Fc                óÈ  <€ V P                   f   \        R,          ! 4       V n         MB\        V P                   \        4      '       d#   \        R,          ! R/ V P                   B V n         V P                  f   \        R,          ! 4       V n        MB\        V P                  \        4      '       d#   \        R,          ! R/ V P                  B V n        \
        SV `  ! R/ VB  R # )NÚ
modernbertÚsiglip_vision_model© )r    r   Ú
isinstanceÚdictr!   ÚsuperÚ__post_init__)ÚselfÚkwargsÚ	__class__s   &,€Út/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/modernvbert/modular_modernvbert.pyr,   ÚModernVBertConfig.__post_init__X   s©   ø€ Ø×ÑÒ#Ü-¨lÖ;Ó=ˆDÕÜ˜×(Ñ(¬$×/Ò/Ü-¨lÖ;ÑO¸d×>NÑ>NÑOˆDÔà×ÑÒ%Ü!/Ð0EÖ!FÓ!HˆDÕÜ˜×*Ñ*¬D×1Ò1Ü!/Ð0EÖ!FÑ!\È×I[ÑI[Ñ!\ˆDÔä‰ÒÑ' Ô'ó    c                óì   <€ V ^8„  d   Qh/ S[ S[,          R,          ;R&   S[ S[,          R,          ;R&   S[;R&   S[;R&   S[;R&   S[;R&   S[R,          ;R&   S[S[,          ;R	&   S[;R
&   S[;R&   # )é   Nr    r!   Úimage_token_idÚpixel_shuffle_factorÚinitializer_rangeÚinitializer_cutoff_factorÚclassifier_poolingÚclassifier_dropoutÚclassifier_biasÚtie_word_embeddings)r#   Úmean)r
   r*   ÚintÚfloatr   Úbool)ÚformatÚ__classdict__s   "€r0   Ú__annotate__ÚModernVBertConfig.__annotate__,   s¸   ø‡ ‚ ñB "¡DÕ(¨4Õ/Ñ6ñC ñD $¡dÕ*¨TÕ1Ñ8ñE ñF ÑñG ñH Ñ!ñI ñJ Ñ#ñK ñL  %Ñ*ñM ñN   Õ.Ñ6ñO ñP ¡�Ñ)ñQ ñR Ñ!ñS ñT Ñ%òU r2   )r    r!   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
model_typer   Úsub_configsr    r!   r5   r6   r7   r8   r9   r:   r;   r<   r,   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r/   rB   s   @@r0   r   r   ,   sd   ù‡ € ñð6 €JØ  *¨o¸zÐJ€Kà26€KØ48€MØ€NØ !ÐØ#ÐØ'*ÐØ16ÐØ&)ÐØ!€OØ %Ðõ(÷Y … r2   r   c                   ó@   a € ] tR t^ft o RtRtRtRtRtV 3R lt	Rt
V tR# )ÚModernVBertBaseModelOutputa	  
Base class for ModernVBERT model's outputs.
Args:
    last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
        Sequence of hidden-states at the output of the last layer of the model.
        If `past_key_values` is used only the last hidden-state of the sequences of shape `(batch_size, 1,
        hidden_size)` is output.
    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, if the model has an embedding layer, +
        one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
        Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
    attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
        Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
        sequence_length)`.
        Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
        heads.
    image_hidden_states (`tuple(torch.FloatTensor)`, *optional*):
        Tuple of `torch.FloatTensor` (one for the output of the image embeddings, `(batch_size, num_images,
        sequence_length, hidden_size)`.
        image_hidden_states of the model produced by the vision encoder
Nc                óô   <€ V ^8„  d   Qh/ S[ P                  ;R&   S[S[ P                  ,          R,          ;R&   S[S[ P                  ,          R,          ;R&   S[S[ P                  ,          R,          ;R&   # )r4   Úlast_hidden_stateNÚhidden_statesÚ
attentionsÚimage_hidden_states©ÚtorchÚFloatTensorÚtuple)rA   rB   s   "€r0   rC   Ú'ModernVBertBaseModelOutput.__annotate__f   so   ø‡ ‚ ñ0 ×(Ñ(Ñ/ñ1 ñ2 ™×*Ñ*Õ+¨dÕ2Ñ9ñ3 ñ4 ‘e×'Ñ'Õ(¨4Õ/Ñ6ñ5 ñ6 ™u×0Ñ0Õ1°DÕ8Ñ?ò7 r2   r(   )rE   rF   rG   rH   rI   rT   rU   rV   rW   rL   rM   rN   ©rB   s   @r0   rR   rR   f   s)   ø‡ € ñð, ,0ÐØ59€MØ26€JØ;?Ð÷7 ƒ r2   rR   c                   óD   a € ] tR t^„t o RtRtRtRtRtRt	V 3R lt
RtV tR# )ÚModernVBertMaskedLMOutputa÷  
Base class for ModernVBERT model's outputs with masked language modeling loss.
Args:
    loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided):
        Masked language modeling (MLM) loss.
    logits (`torch.FloatTensor`):
        Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
    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, if the model has an embedding layer, +
        one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
        Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
    attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
        Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
        sequence_length)`.
        Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
        heads.
    image_hidden_states (`tuple(torch.FloatTensor)`, *optional*):
        Tuple of `torch.FloatTensor` (one for the output of the image embeddings, `(batch_size, num_images,
        sequence_length, hidden_size)`.
        image_hidden_states of the model produced by the vision encoder
Nc                ó  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[ P                  R,          ;R&   # )r4   NÚlossÚlogits.rU   rV   rW   rX   )rA   rB   s   "€r0   rC   Ú&ModernVBertMaskedLMOutput.__annotate__„   sŒ   ø‡ ‚ ñ0 ×
Ñ
˜dÕ
"Ñ)ñ1 ñ2 ×ÑÑ$ñ3 ñ4 ™×*Ñ*¨CÐ/Õ0°4Õ7Ñ>ñ5 ñ6 ‘e×'Ñ'¨Ð,Õ-°Õ4Ñ;ñ7 ñ8 ×*Ñ*¨TÕ1Ñ8ò9 r2   r(   )rE   rF   rG   rH   rI   ra   rb   rU   rV   rW   rL   rM   rN   r]   s   @r0   r_   r_   „   s-   ø‡ € ñð, &*€DØ $€FØ:>€MØ7;€JØ48Ð÷9 ƒ r2   r_   c                   óB   a a€ ] tR t^£t oRtV 3R ltR tR tRtVt	V ;t
# )ÚModernVBertConnectorzÞ
Connector module for ModernVBERT. It performs a pixel shuffle operation followed by a linear projection to match the text model's hidden size.
Based on https://pytorch.org/docs/stable/generated/torch.nn.PixelShuffle.html
c                ó  <€ \         SV `  4        VP                  V n        \        P                  ! VP
                  P                  VP                  ^,          ,          VP                  P                  RR7      V n        R# )r4   F©ÚbiasN)	r+   Ú__init__r6   ÚnnÚLinearr!   Úhidden_sizer    Úmodality_projection©r-   Úconfigr/   s   &&€r0   ri   ÚModernVBertConnector.__init__©   s^   ø€ Ü‰ÑÔØ$*×$?Ñ$?ˆÔ!Ü#%§9¢9Ø× Ñ ×,Ñ,°×0KÑ0KÈQÕ0NÕOØ×Ñ×*Ñ*Øô$
ˆÖ r2   c                óü  € VP                  4       w  r4p\        VR ,          4      ;rgVP                  W6Wu4      pVP                  W6\        Wr,          4      WR,          4      pVP                  ^ ^^^4      pVP	                  V\        Wr,          4      \        Wb,          4      WR^,          ,          4      pVP                  ^ ^^^4      pVP	                  V\        WB^,          ,          4      WR^,          ,          4      # )g      à?)Úsizer>   ÚviewÚpermuteÚreshape)r-   rW   r6   Ú
batch_sizeÚ
seq_lengthÚ	embed_dimÚheightÚwidths   &&&     r0   Úpixel_shuffleÚ"ModernVBertConnector.pixel_shuffle²   só   € Ø,?×,DÑ,DÓ,FÑ)ˆ
 	Ü˜Z¨�_Ó-Ð-ˆØ1×6Ñ6°zÈ5Ó\ÐØ1×6Ñ6Ø¤ EÕ$@Ó AÀ9ÕCcó
Ðð 2×9Ñ9¸!¸QÀÀ1ÓEÐØ1×9Ñ9ØÜ�Õ,Ó-Ü�Õ-Ó.Ø¨qÕ0Õ1ó	
Ðð 2×9Ñ9¸!¸QÀÀ1ÓEÐØ"×*Ñ*Øœ˜JÀÕ*AÕBÓCÀYÐhiÕRiÕEjó
ð 	
r2   c                óZ   € V P                  WP                  4      pV P                  V4      # ©N)r{   r6   rm   )r-   rW   s   &&r0   ÚforwardÚModernVBertConnector.forwardÅ   s,   € Ø"×0Ñ0Ð1D×F_ÑF_Ó`ÐØ×'Ñ'Ð(;Ó<Ð<r2   )rm   r6   )rE   rF   rG   rH   rI   ri   r{   r   rM   rN   rO   rP   s   @@r0   re   re   £   s   ù‡ € ñõ

ò
÷&=ò =r2   re   c                   óV   a € ] tR t^Êt o ]t. t]P                  ! 4       R 4       t	Rt
V tR# )ÚModernVBertPreTrainedModelc                óL  a € \         P                  ! S V4       R  V 3R llp\        V\        4      '       dl   S P                  P
                  \        P                  ! RS P                  P                  P                  ,          4      ,          pV! VP                  V4       R# \        V\        4      '       dl   S P                  P
                  \        P                  ! RS P                  P                  P                  ,          4      ,          pV! VP                  V4       R# \        V\        \        34      '       de   S P                  P
                  \        P                  ! S P                  P                  P                  4      ,          pV! VP                   V4       R# R# )c                óD   € V ^8„  d   QhR\         P                  R\        /# )r4   ÚmoduleÚstd)rj   ÚModuler?   )rA   s   "r0   rC   Ú>ModernVBertPreTrainedModel._init_weights.<locals>.__annotate__Ó   s   € ÷ 	-ñ 	-¤§	¡	ð 	-´ñ 	-r2   c                 ó`  <€ \        SP                  R R4      p\        P                  ! V P                  RVV) V,          W!,          R7       \        V \        P                  \        P                  34      '       d3   V P                  e#   \        P                  ! V P                  4       R# R# R# )r8   r"   r$   )r=   r†   ÚaÚbN)Úgetattrro   ÚinitÚtrunc_normal_Úweightr)   rj   rk   ÚConv2drh   Úzeros_)r…   r†   Úcutoff_factorr-   s   && €r0   Úinit_weightÚ=ModernVBertPreTrainedModel._init_weights.<locals>.init_weightÓ   s�   ø€ Ü# D§K¡KÐ1LÈcÓRˆMÜ×ÒØ—‘ØØØ �. 3Õ&ØÕ%õô ˜&¤2§9¡9¬b¯i©iÐ"8×9Ò9Ø—;‘;Ò*Ü—K’K §¡Ö,ñ +ñ :r2   r"   N)r   Ú_init_weightsr)   re   ro   r7   ÚmathÚsqrtr    Únum_hidden_layersrm   ÚModernVBertForMaskedLMÚlm_headÚ$ModernVBertForSequenceClassificationÚ!ModernVBertForTokenClassificationrl   Ú
classifier)r-   r…   r“   Úout_stdÚfinal_out_stds   f&   r0   r•   Ú(ModernVBertPreTrainedModel._init_weightsÏ   s  ø€ ä×%Ò% d¨FÔ3÷	-ð 	-ô �fÔ2×3Ò3Ø—k‘k×3Ñ3´d·i²iÀÀdÇkÁk×F]ÑF]×FoÑFoÕ@oÓ6pÕpˆGÙ˜×2Ñ2°GÖ<Ü˜Ô 6×7Ò7Ø—k‘k×3Ñ3´d·i²iÀÀdÇkÁk×F]ÑF]×FoÑFoÕ@oÓ6pÕpˆGÙ˜Ÿ™¨Ö0ÜØä4Ü1ð÷
ò 
ð !ŸK™K×9Ñ9¼D¿IºIÀdÇkÁk×F]ÑF]×FiÑFiÓ<jÕjˆMÙ˜×)Ñ)¨=Ö9ñ
r2   r(   N)rE   rF   rG   rH   r   Úconfig_classÚ_no_split_modulesrY   Úno_gradr•   rM   rN   r]   s   @r0   r‚   r‚   Ê   s(   ø‡ € à$€LØÐà
‡]‚]ƒ_ñ:ó ö:r2   r‚   aG  
    ModernVBertModel is a model that combines a vision encoder (SigLIP) and a text encoder (ModernBert).

    ModernVBert is the base model of the visual retriever ColModernVBert, and was introduced in the following paper:
    [*ModernVBERT: Towards Smaller Visual Document Retrievers*](https://arxiv.org/abs/2510.01149).
    )Úcustom_introc                   óx   a a€ ] tR t^òt oV3R lV 3R llt]]! RRR7      R	V3R lR ll4       4       tRtVt	V ;t
# )
ÚModernVBertModelc                ó    <€ V ^8„  d   QhRS[ /# ©r4   ro   ©r   )rA   rB   s   "€r0   rC   ÚModernVBertModel.__annotate__û   s   ø€ ÷ ñ Ñ0ñ r2   c                ó¶  <€ \         SV `  V4       \        V4      V n        \        P
                  ! VP                  4      V n        \        P
                  ! VP                  4      V n	        \        VP                  P                  VP                  P                  ,          ^,          VP                  ^,          ,          4      V n        V P                  4        R# )r4   N)r+   ri   re   Ú	connectorr   Úfrom_configr    Ú
text_modelr!   Úvision_modelr>   Ú
image_sizeÚ
patch_sizer6   Úimage_seq_lenÚ	post_initrn   s   &&€r0   ri   ÚModernVBertModel.__init__û   s¡   ø€ Ü‰Ñ˜Ô ô .¨fÓ5ˆŒÜ#×/Ò/°×0BÑ0BÓCˆŒÜ%×1Ò1°&×2FÑ2FÓGˆÔä Ø×"Ñ"×-Ñ-°×1EÑ1E×1PÑ1PÕPÐUVÕVØ×*Ñ*¨AÕ-õ/ó
ˆÔð 	�‰Ör2   áØ  
        Inputs fed to the model can have an arbitrary number of images. To account for this, pixel_values fed to
        the model have image padding -> (batch_size, max_num_images, 3, max_heights, max_widths) where
        max_num_images is the maximum number of images among the batch_size samples in the batch.
        Padding images are not needed beyond padding the pixel_values at the entrance of the model.
        For efficiency, we only pass through the vision_model's forward the real images by
        discarding the padding images i.e. pixel_values of size (image_batch_size, 3, height, width) where
        image_batch_size would be 7 when num_images_per_sample=[1, 3, 1, 2] and max_num_images would be 3.
        r   ©r¤   r   c                óP  <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[S[,          R
S[S[,          /	# )r4   Ú	input_idsÚattention_maskNÚposition_idsÚinputs_embedsÚpixel_valuesÚpixel_attention_maskrW   r.   Úreturn)	rY   Ú
LongTensorÚTensorrZ   Ú
BoolTensorr   r   r[   rR   )rA   rB   s   "€r0   rC   rª     s·   ø€ ÷ /
ñ /
á×#Ñ#ð/
ñ Ÿ™ tÕ+ð/
ñ ×&Ñ&¨Õ-ð	/
ñ
 ×(Ñ(¨4Õ/ð/
ñ ×'Ñ'¨$Õ.ð/
ñ $×.Ñ.°Õ5ð/
ñ #×.Ñ.°Õ5ð/
ñ Ñ+Õ,ð/
ñ 
Ñ+Õ	+ñ/
r2   c           	     óÂ  € Vf:   V P                   P                  4       ! V4      P                  VP                  4      pVe   V P	                  WVR7      P
                  pVe;   VP                  VP                  VP                  R7      pV P                  WVR7      pV P                   ! RRVRVRV/VB p	\        V	P                  V	P                  V	P                  VR7      # )	aT  
pixel_attention_mask (`torch.Tensor` of shape `(batch_size, image_size, image_size)`, *optional*):
    Mask to avoid performing attention on padding pixel indices.
image_hidden_states (`torch.FloatTensor` of shape `(batch_size, num_channels, image_size, image_size)`):
    The hidden states of the image encoder after modality projection.
)r¼   r½   )ÚdtypeÚdevice)r¸   r»   rW   r»   r¹   rº   )rT   rU   rV   rW   r(   )r®   Úget_input_embeddingsÚtorÄ   Úget_image_featuresÚpooler_outputrÃ   Úinputs_mergerrR   rT   rU   rV   )
r-   r¸   r¹   rº   r»   r¼   r½   rW   r.   Úoutputss
   &&&&&&&&, r0   r   ÚModernVBertModel.forward  s  € ð> Ò Ø ŸO™O×@Ñ@ÔBÀ9ÓM×PÑPÐQZ×QaÑQaÓbˆMð Ò#Ø"&×"9Ñ"9Ø)ð #:ó #ç‰mð  ð
 Ò*Ø"5×"8Ñ"8¸}×?RÑ?RÐ[h×[oÑ[oÐ"8Ó"pÐØ ×.Ñ.Ø#ÐVið /ó ˆMð
 —/’/ñ 
Ø'ð
à)ð
ð &ð
ð ñ	
ˆô *Ø%×7Ñ7Ø!×/Ñ/Ø×)Ñ)Ø 3ô	
ð 	
r2   )r¬   r²   r®   r¯   )NNNNNNN©rE   rF   rG   rH   ri   r   r   r   rM   rN   rO   rP   s   @@r0   r¦   r¦   ò   sD   ù‡ € ÷ó ð  Ùðð -ô÷/
ñ /
óó ÷/
ð /
r2   r¦   c                   ó   € ] tR tRtRtR# )ÚModernVBertPredictionHeadiJ  r(   N)rE   rF   rG   rH   rM   r(   r2   r0   rÎ   rÎ   J  s   † Ûr2   rÎ   c                   óŒ   a a€ ] tR tRt oRR/tV3R lV 3R lltR tR t]]	! RR	R
7      RV3R lR ll4       4       t
RtVtV ;t# )r™   iN  zlm_head.weightz1model.text_model.embeddings.tok_embeddings.weightc                ó    <€ V ^8„  d   QhRS[ /# r¨   r©   )rA   rB   s   "€r0   rC   Ú#ModernVBertForMaskedLM.__annotate__R  ó   ø€ ÷ 
ñ 
Ñ0ñ 
r2   c                óp  <€ \         SV `  V4       VP                  P                  V n        \	        V4      V n        \        VP                  4      V n        \        P                  ! VP                  P                  V P                  VP                  P                  R 7      V n        V P                  4        R# )rg   N)r+   ri   r    Ú
vocab_sizer¦   ÚmodelrÎ   Úprojection_headrj   rk   rl   Údecoder_biasrš   r³   rn   s   &&€r0   ri   ÚModernVBertForMaskedLM.__init__R  s   ø€ Ü‰Ñ˜Ô à ×,Ñ,×7Ñ7ˆŒä% fÓ-ˆŒ
Ü8¸×9KÑ9KÓLˆÔÜ—y’y ×!3Ñ!3×!?Ñ!?ÀÇÁÐW]×WiÑWi×WvÑWvÔwˆŒð 	�‰Ör2   c                ó   € V P                   # r~   ©rš   )r-   s   &r0   Úget_output_embeddingsÚ,ModernVBertForMaskedLM.get_output_embeddings^  s   € Ø�|‰|Ðr2   c                ó   € Wn         R # r~   rÚ   )r-   Únew_embeddingss   &&r0   Úset_output_embeddingsÚ,ModernVBertForMaskedLM.set_output_embeddingsa  s   € Ø%Žr2   rµ   r   r¶   c                óx  <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[S[,          RS[S[,          /
# ©r4   r¸   r¹   Nrº   r»   r¼   r½   rW   Úlabelsr.   r¾   )	rY   r¿   rÀ   rZ   rÁ   r   r   r[   r_   )rA   rB   s   "€r0   rC   rÑ   q  sÌ   ø€ ÷ 0
ñ 0
á×#Ñ#ð0
ñ Ÿ™ tÕ+ð0
ñ ×&Ñ&¨Õ-ð	0
ñ
 ×(Ñ(¨4Õ/ð0
ñ ×'Ñ'¨$Õ.ð0
ñ $×.Ñ.°Õ5ð0
ñ #×.Ñ.°Õ5ð0
ñ × Ñ  4Õ'ð0
ñ Ñ+Õ,ð0
ñ 
Ñ*Õ	*ñ0
r2   c	                ót  € V P                   ! R
RVRVRVRVRVRVRV/V	B p
V
^ ,          pV P                  V P                  V4      4      pRpVe=   \        4       pV! VP	                  RV P
                  4      VP	                  R4      4      p\        VVV
P                  V
P                  V
P                  R	7      # )áÔ  
pixel_attention_mask (`torch.Tensor` of shape `(batch_size, image_size, image_size)`, *optional*):
    Mask to avoid performing attention on padding pixel indices.
image_hidden_states (`torch.FloatTensor` of shape `(batch_size, num_channels, image_size, image_size)`):
    The hidden states of the image encoder after modality projection.
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
    Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
    text_config.]` or `model.image_token_id`. Tokens with indices set to `model.image_token_id` are
    ignored (masked), the loss is only computed for the tokens with labels in `[0, ..., text_config.]`.
r¸   r¹   rº   r»   r¼   r½   rW   N)ra   rb   rU   rV   rW   r(   éÿÿÿÿ)
rÕ   rš   rÖ   r   rs   rÔ   r_   rU   rV   rW   )r-   r¸   r¹   rº   r»   r¼   r½   rW   rã   r.   rÊ   rU   rb   ra   Ú	criterions   &&&&&&&&&,     r0   r   ÚModernVBertForMaskedLM.forwardd  sç   € ðH —*’*ñ 	
Øð	
à)ð	
ð &ð	
ð (ð		
ð
 &ð	
ð "6ð	
ð !4ð	
ð ñ	
ˆð   �
ˆà—‘˜d×2Ñ2°=ÓAÓBˆàˆØÒÜ(Ó*ˆIÙ˜VŸ[™[¨¨T¯_©_Ó=¸v¿{¹{È2»ÓOˆDä(ØØØ!×/Ñ/Ø×)Ñ)Ø '× ;Ñ ;ô
ð 	
r2   )rš   rÕ   rÖ   rÔ   ©NNNNNNNN)rE   rF   rG   rH   Ú_tied_weights_keysri   rÛ   rß   r   r   r   rM   rN   rO   rP   s   @@r0   r™   r™   N  sZ   ù‡ € à*Ð,_Ð`Ð÷
ó 
òò&ð Ùðð -ô÷0
ñ 0
óó ÷0
ð 0
r2   r™   za
    The ModernVBert Model with a sequence classification head on top that performs pooling.
    c                   óx   a a€ ] tR tRt oV3R lV 3R llt]]! RRR7      R
V3R lR ll4       4       tR	tVt	V ;t
# )r›   i¤  c                ó    <€ V ^8„  d   QhRS[ /# r¨   r©   )rA   rB   s   "€r0   rC   Ú1ModernVBertForSequenceClassification.__annotate__ª  s   ø€ ÷ ñ Ñ0ñ r2   c                ó†  <€ \         SV `  V4       VP                  V n        Wn        \	        V4      V n        \        VP                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP                  P                  VP                  4      V n        V P!                  4        R # r~   )r+   ri   Ú
num_labelsro   r¦   rÕ   rÎ   r    Úheadrj   ÚDropoutr:   Údroprk   rl   r�   r³   rn   s   &&€r0   ri   Ú-ModernVBertForSequenceClassification.__init__ª  s†   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒØŒä% fÓ-ˆŒ
Ü-¨f×.@Ñ.@ÓAˆŒ	Ü—J’J˜v×8Ñ8Ó9ˆŒ	ÜŸ)š) F×$6Ñ$6×$BÑ$BÀF×DUÑDUÓVˆŒð 	�‰Ör2   rµ   r   r¶   c                óx  <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[S[,          RS[S[,          /
# râ   )	rY   r¿   rÀ   rZ   rÁ   r   r   r[   r   )rA   rB   s   "€r0   rC   rí   Ä  sØ   ø€ ÷ Q
ñ Q
á×#Ñ#ðQ
ñ Ÿ™ tÕ+ðQ
ñ ×&Ñ&¨Õ-ð	Q
ñ
 ×(Ñ(¨4Õ/ðQ
ñ ×'Ñ'¨$Õ.ðQ
ñ $×.Ñ.°Õ5ðQ
ñ #×.Ñ.°Õ5ðQ
ñ × Ñ  4Õ'ðQ
ñ Ñ+Õ,ðQ
ñ 
Ñ)Õ	)ñQ
r2   c	                ó,  € V P                   ! RRVRVRVRVRVRVRV/V	B p
V
^ ,          pV P                  P                  R8X  d   VR,          pMÑV P                  P                  R	8X  d·   Ve   VP                  R,          w  rÍMVP                  R,          w  rÍVe   VP                  MVP                  pVf)   \
        P                  ! WÍ3V\
        P                  R7      pW²P                  R4      ,          P                  ^R7      VP                  ^RR7      ,          pV P                  V4      pV P                  V4      pV P                  V4      pR
pVEeš   V P                  P                  f–   V P                  ^8X  d   RV P                  n        MrV P                  ^8”  dQ   VP                  \
        P                   8X  g    VP                  \
        P"                  8X  d   RV P                  n        MRV P                  n        V P                  P                  R8X  dL   \%        4       pV P                  ^8X  d'   V! VP'                  4       VP'                  4       4      pM�V! VV4      pM†V P                  P                  R8X  d>   \)        4       pV! VP+                  RV P                  4      VP+                  R4      4      pM.V P                  P                  R8X  d   \-        4       pV! VV4      p\/        VVV
P0                  V
P2                  R7      # )rå   r¸   r¹   rº   r»   r¼   r½   rW   r#   r=   N:Nr4   N)rÄ   rÃ   )ÚdimT)rö   ÚkeepdimÚ
regressionÚsingle_label_classificationÚmulti_label_classification©ra   rb   rU   rV   r(   ):NNNr   ræ   )rÕ   ro   r9   ÚshaperÄ   rY   Úonesr@   Ú	unsqueezeÚsumrð   rò   r�   Úproblem_typerï   rÃ   Úlongr>   r   Úsqueezer   rs   r   r   rU   rV   )r-   r¸   r¹   rº   r»   r¼   r½   rW   rã   r.   rÊ   rT   rv   Úseq_lenrÄ   Úpooled_outputrb   ra   Úloss_fcts   &&&&&&&&&,         r0   r   Ú,ModernVBertForSequenceClassification.forward·  s½  € ðF —*’*ñ 	
Øð	
à)ð	
ð &ð	
ð (ð		
ð
 &ð	
ð "6ð	
ð !4ð	
ð ñ	
ˆð $ A�JÐà�;‰;×)Ñ)¨UÔ2Ø 1°$Õ 7ÑØ�[‰[×+Ñ+¨vÔ5ØÒ(Ø&3×&9Ñ&9¸"Õ&=Ñ#�
˜Gà&/§o¡o°bÕ&9Ñ#�
Ø)2Ò)>�Y×%Ò%ÀM×DXÑDXˆFàÒ%Ü!&§¢¨ZÐ,AÈ&ÔX]×XbÑXbÔ!c�Ø!2×5MÑ5MÈbÓ5QÕ!Q× VÑ VÐ[\Ð VÓ ]Ð`n×`rÑ`rØ˜tð asó aõ !Ðð Ÿ	™	Ð"3Ó4ˆØŸ	™	 -Ó0ˆØ—‘ Ó/ˆàˆØÓØ�{‰{×'Ñ'Ò/Ø—?‘? aÔ'Ø/;�D—K‘KÕ,Ø—_‘_ qÔ(¨f¯l©l¼e¿j¹jÔ.HÈFÏLÉLÔ\a×\eÑ\eÔLeØ/L�D—K‘KÕ,à/K�D—K‘KÔ,à�{‰{×'Ñ'¨<Ô7Ü"›9�Ø—?‘? aÔ'Ù# F§N¡NÓ$4°f·n±nÓ6FÓG‘Dá# F¨FÓ3‘DØ—‘×)Ñ)Ð-JÔJÜ+Ó-�Ù §¡¨B°·±Ó @À&Ç+Á+ÈbÃ/ÓR‘Ø—‘×)Ñ)Ð-IÔIÜ,Ó.�Ù ¨Ó/�ä'ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
r2   )r�   ro   rò   rð   rÕ   rï   ré   rÌ   rP   s   @@r0   r›   r›   ¤  sH   ù‡ € ÷ó ð Ùðð -ô÷Q
ñ Q
óó ÷Q
ð Q
r2   r›   zw
    The ModernVBert Model with a token classification head on top, e.g. for Named Entity Recognition (NER) tasks.
    c                   óx   a a€ ] tR tRt oV3R lV 3R llt]]! RRR7      R
V3R lR ll4       4       tR	tVt	V ;t
# )rœ   i  c                ó    <€ V ^8„  d   QhRS[ /# r¨   r©   )rA   rB   s   "€r0   rC   Ú.ModernVBertForTokenClassification.__annotate__  rÒ   r2   c                óz  <€ \         SV `  V4       VP                  V n        \        V4      V n        \        VP                  4      V n        \        P                  ! VP                  4      V n        \        P                  ! VP                  P                  VP                  4      V n        V P                  4        R # r~   )r+   ri   rï   r¦   rÕ   rÎ   r    rð   rj   rñ   r:   rò   rk   rl   r�   r³   rn   s   &&€r0   ri   Ú*ModernVBertForTokenClassification.__init__  s�   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒä% fÓ-ˆŒ
Ü-¨f×.@Ñ.@ÓAˆŒ	Ü—J’J˜v×8Ñ8Ó9ˆŒ	ÜŸ)š) F×$6Ñ$6×$BÑ$BÀF×DUÑDUÓVˆŒð 	�‰Ör2   rµ   r   r¶   c                óx  <€ V ^8„  d   QhRS[ P                  RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[S[,          RS[S[,          /
# râ   )	rY   r¿   rÀ   rZ   rÁ   r   r   r[   r   )rA   rB   s   "€r0   rC   r	  7  sÌ   ø€ ÷ 1
ñ 1
á×#Ñ#ð1
ñ Ÿ™ tÕ+ð1
ñ ×&Ñ&¨Õ-ð	1
ñ
 ×(Ñ(¨4Õ/ð1
ñ ×'Ñ'¨$Õ.ð1
ñ $×.Ñ.°Õ5ð1
ñ #×.Ñ.°Õ5ð1
ñ × Ñ  4Õ'ð1
ñ Ñ+Õ,ð1
ñ 
Ñ&Õ	&ñ1
r2   c	                ó„  € V P                   ! R
RVRVRVRVRVRVRV/V	B p
V
^ ,          pV P                  V4      pV P                  V4      pV P                  V4      pRpVe=   \	        4       pV! VP                  RV P                  4      VP                  R4      4      p\        VVV
P                  V
P                  R	7      # )rå   r¸   r¹   rº   r»   r¼   r½   rW   Nrû   r(   ræ   )
rÕ   rð   rò   r�   r   rs   rï   r   rU   rV   )r-   r¸   r¹   rº   r»   r¼   r½   rW   rã   r.   rÊ   rT   rb   ra   r  s   &&&&&&&&&,     r0   r   Ú)ModernVBertForTokenClassification.forward*  sõ   € ðH —*’*ñ 	
Øð	
à)ð	
ð &ð	
ð (ð		
ð
 &ð	
ð "6ð	
ð !4ð	
ð ñ	
ˆð $ A�JÐà ŸI™IÐ&7Ó8ÐØ ŸI™IÐ&7Ó8ÐØ—‘Ð!2Ó3ˆàˆØÒÜ'Ó)ˆHÙ˜FŸK™K¨¨D¯O©OÓ<¸f¿k¹kÈ"»oÓNˆDä$ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
r2   )r�   rò   rð   rÕ   rï   ré   rÌ   rP   s   @@r0   rœ   rœ     sD   ù‡ € ÷
ó 
ð Ùðð -ô÷1
ñ 1
óó ÷1
ð 1
r2   rœ   )r   r‚   r¦   r™   r›   rœ   )9r–   Údataclassesr   Útypingr   rY   Útorch.nnrj   Úhuggingface_hub.dataclassesr   r   r   r   Ú r	   r�   Úconfiguration_utilsr
   Úmodeling_outputsr   r   r   r   Úmodeling_utilsr   Úprocessing_utilsr   Úutilsr   r   r   Úutils.genericr   Úautor   r   r   Úmodernbert.modeling_modernbertr   Úsmolvlm.modeling_smolvlmr   r   Ú
get_loggerrE   Úloggerr   rR   r_   r‡   re   r‚   r¦   rÎ   r™   r›   rœ   Ú__all__r(   r2   r0   Ú<module>r      s¡  ðó Ý !Ý ã Ý Ý .ß AÑ Aå &Ý 3÷ó õ .Ý &ß @Ñ @Ý -ß 8Ñ 8Ý Eß Kð 
×	Ò	˜HÓ	%€ñ Ð4Ô5Øô5(Ð(ó 5(ó ó 6ð5(ðp ô@ ó @ó ð@ð: ô9 ó 9ó ð9ô<$=˜2Ÿ9™9ô $=ðN ô$:Ð!7ó $:ó ð$:ñN ðôôM
�|ó M
óðM
ô`	Ð 8ô 	ð ôR
Ð7ó R
ó ðR
ñj ðôô
l
Ð+Eó l
óð
l
ñ^ ðôô
K
Ð(Bó K
óð
K
ò\‚r2   