+
    œ°³j�`  ã                   ó  € ^ RI t ^ RIHt ^ RIHtHtHt ^ RIt^ RI	t	^RI
Ht ^RIHtHt ^RIHtHtHtHt ^RIHtHtHt ^RIHt ^R	IHt ]'       d   ^R
IHt  ! R R]RR7      t]! RR7      ] ! R R]4      4       4       tR.tR# )é    N)Ú
accumulate)ÚTYPE_CHECKINGÚOptionalÚUnion)ÚBatchFeature)Ú
ImageInputÚis_valid_image)ÚMultiModalDataÚProcessingKwargsÚProcessorMixinÚUnpack)Ú
AddedTokenÚBatchEncodingÚ	TextInput)Úauto_docstring)Úrequires)ÚPreTokenizedInputc            	       ó:   € ] tR t^(tRRR/RRRRRR	R/R
RR//tRtR# )ÚColModernVBertProcessorKwargsÚtext_kwargsÚpaddingÚlongestÚimages_kwargsÚreturn_row_col_infoTÚdata_formatÚchannels_firstÚdo_convert_rgbÚcommon_kwargsÚreturn_tensorsÚpt© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú	_defaultsÚ__static_attributes__r!   ó    Ú}/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/colmodernvbert/processing_colmodernvbert.pyr   r   (   s=   † àØ�yð
ð 	Ø! 4ØÐ+Ø˜dð
ð
 	Ð*¨DÐ1ð
„Ir(   r   F)Útotal)Úbackendsc                   ó  a a€ ] tR t^6t o]tRV3R lV 3R lllt]RV3R lR ll4       tRV3R lR llt	RV3R lV 3R lllt
V3R	 lR
 ltV3R lR ltRR ltRV3R lR lltV3R lR ltRV3R lR lltRtVtV ;t# )ÚColModernVBertProcessorc                óH   <€ V ^8„  d   QhRS[ RS[R,          RS[R,          /# )é   Úimage_seq_lenÚvisual_prompt_prefixNÚquery_prefix)ÚintÚstr)ÚformatÚ__classdict__s   "€r)   Ú__annotate__Ú$ColModernVBertProcessor.__annotate__;   s8   ø€ ÷ 3Dñ 3Dñ
 ð3Dñ " D�jð3Dñ ˜D•jñ3Dr(   c                óØ  <€ Rp\        RRRR7      P                  V n        \        RRRR7      P                  V n        \        RRRR7      P                  V n        RV n        W@n        VP                  V P                  4      V n        VP                  V P                  4      V n	        VP                  V P
                  4      V n
        \        ^4       UU	u. uF:  p\        ^4       F(  q’P                  R	V^,            R
V	^,            R24      NK*  	  K<  	  up	pV n        \        P                  ! R4      V n        RV P                  V P                  V P                  ./p
VP!                  V
4       VP                  V P                  4      V n        \"        SV `H  ! W3RV/VB  T;'       g    RV P                   R2V n        T;'       g    RV n        V P                  V n        R# u up	pi )aJ  
image_seq_len (`int`, *optional*, defaults to 64):
    The length of the image sequence i.e. the number of <image> tokens per image in the input.
visual_prompt_prefix (`str`, *optional*):
    A string that gets tokenized and prepended to the image tokens.
query_prefix (`str`, *optional*):
    A prefix to be used for the query.
Nz<fake_token_around_image>FT)Ú
normalizedÚspecialz<image>z<end_of_utterance>z<global-img>ú<row_Ú_col_Ú>z*(\n?<global-img>\n?|<row_\d+_col_\d+>\n?)+Úadditional_special_tokensÚchat_templatez<|begin_of_text|>User:z0Describe the image.<end_of_utterance>
Assistant:Ú )r   ÚcontentÚfake_image_tokenÚimage_tokenÚend_of_utterance_tokenÚglobal_image_tagr0   Úconvert_tokens_to_idsÚimage_token_idÚfake_image_token_idÚglobal_image_token_idÚrangeÚrow_col_idsÚreÚcompileÚ%_regex_to_remove_extra_special_tokensÚadd_special_tokensÚsuperÚ__init__r1   r2   Úquery_augmentation_token)ÚselfÚimage_processorÚ	tokenizerr@   r0   r1   r2   ÚkwargsÚiÚjÚtokens_to_addÚ	__class__s   &&&&&&&,   €r)   rR   Ú ColModernVBertProcessor.__init__;   sÒ  ø€ ð$ ˆÜ *Ð+FÐSXÐbfÔ g× oÑ oˆÔÜ% i¸EÈ4ÔP×XÑXˆÔÜ&0Ð1EÐRWÐaeÔ&f×&nÑ&nˆÔ#Ø .ˆÔØ*ÔØ'×=Ñ=¸d×>NÑ>NÓOˆÔØ#,×#BÑ#BÀ4×CXÑCXÓ#YˆÔ Ø%.×%DÑ%DÀT×EZÑEZÓ%[ˆÔ"äSXÐYZÔS[ô
ÙS[ÈaÔejÐklÖemÐ`a×+Ñ+¨e°A¸µE°7¸%ÀÀAÅ¸wÀaÐ,HÖIÑemÑIÑS[ò
ˆÔô 68·Z²ZÐ@mÓ5nˆÔ2ð (Ø×%Ñ%Ø× Ñ Ø×+Ñ+ð*ð
ˆð 	×$Ñ$ ]Ô3Ø'×=Ñ=¸d×>NÑ>NÓOˆÔä‰Ò˜Ñ[À=Ð[ÐTZÒ[à$8÷ %
ð %
Ø$ T×%5Ñ%5Ð$6Ð6gÐhð 	Ô!ð )×.Ð.¨BˆÔØ(,×(CÑ(CˆÖ%ùó1
s   ÃA G&c          
      óà   <€ V ^8„  d   QhRS[ S[S[ ,          ,          S[S[S[ ,          ,          ,          RS[S[RS[S[,          S[R,          3,          RS[R,          RS[S[,          RS[/# )r/   ÚimagesÚtextr   r0   NrW   Úreturn)r   Úlistr   r   r3   r   r   r   )r5   r6   s   "€r)   r7   r8   q   s€   ø€ ÷ >^ñ >^á™T¡*Õ-Õ-±±T¹*Õ5EÕ0FÕFð>^ñ ‘IÐ2±D¹µOÁTÐJ]ÕE^Ð^Õ_ð>^ñ ˜T•zð	>^ñ
 Ñ6Õ7ð>^ñ 
ñ>^r(   c                ó`  € V P                   ! RRVRV/VB w  rV P                  ! RRVRV/VB  V P                  ! \        3RV P                  P
                  /VB pVe   TMV P                  pVR,          P                  RR4      pVR,          P                  RR4      pVR,          P                  R	R4      p/ ;ršVEe@   V P                  ! V3/ VR
,          B w  r›V	P                  RR4       V	P                  RR4       Veû   V P                  W+R7      w  r,V P                  ! V3/ VR,          B p
V'       d   WÊR&   . p\        V4       Fw  w  rï. pV FY  pVR,          w  ppV
P                  VV4      pV
P                  VV^,
          4      pVP                  VV,
          ^,           4       K[  	  VP                  V4       Ky  	  V'       d   V P                  V
R,          V4      V
R&   V P                  W*R.R7       MVe   V P                  ! RRV/VR,          B p
\        / V
CV	CVR7      # )zì
image_seq_len (`int`, *optional*):
    The length of the image sequence. If not provided, the default value of self.image_seq_len is used.
    image_seq_len should be equal to int(((image_size // patch_size) ** 2) / (scale_factor**2))
r^   r_   Útokenizer_init_kwargsNr   Úreturn_text_replacement_offsetsFÚreturn_mm_token_type_idsr   r   ÚrowsÚcols)Úimages_replacementsÚtext_replacement_offsetsÚnew_spanÚ	input_idsÚmm_token_type_idsÚimage)Ú
modalities)ÚdataÚtensor_typer!   )Úprepare_inputs_layoutÚvalidate_inputsÚ_merge_kwargsr   rV   Úinit_kwargsr0   ÚpopÚ_process_imagesÚget_text_with_replacementsÚ	enumerateÚchar_to_tokenÚappendÚcreate_mm_token_type_idsÚ_check_special_mm_tokensr   )rT   r^   r_   r0   rW   Úoutput_kwargsrd   re   r   Úimage_inputsÚtext_inputsrh   ri   Úbatch_image_seq_lengthsÚbatch_idÚtext_replacement_offsetÚimage_seq_lensro   ÚstartÚendÚstart_id_posÚ
end_id_poss   &&&&,                 r)   Ú__call__Ú ColModernVBertProcessor.__call__p   sa  € ð ×1Ò1ÑU¸ÐUÀdÐUÈfÑU‰ˆØ×ÒÑ@ FÐ@°Ð@¸Ò@à×*Ò*Ü)ñ
à"&§.¡.×"<Ñ"<ð
ð ñ
ˆð *7Ò)B™È×HZÑHZˆØ*7¸Õ*F×*JÑ*JÐKlÐnsÓ*tÐ'Ø#0°Õ#?×#CÑ#CÐD^Ð`eÓ#fÐ Ø& }Õ5×9Ñ9Ð:JÈDÓQˆà%'Ð'ˆØÓØ04×0DÒ0DÀVÑ0nÈ}Ð]lÕOmÑ0nÑ-ˆLð ×Ñ˜V TÔ*Ø×Ñ˜V TÔ*àÒØ15×1PÑ1PØð 2Qó 2Ñ.�ð #Ÿnšn¨TÑR°]À=Õ5QÑR�ß2Ø>VÐ :Ñ;à*,Ð'Ü9BÐC[Ö9\Ñ5�HØ%'�NÛ 7˜Ø%)¨*Õ%5™
˜˜sØ'2×'@Ñ'@ÀÈ5Ó'Q˜Ø%0×%>Ñ%>¸xÈÈqÍÓ%Q˜
à&×-Ñ-¨j¸<Õ.GÈ!Õ.KÖLñ !8ð ,×2Ñ2°>ÖBñ :]÷ ,Ø7;×7TÑ7TØ# KÕ0Ð2Ió8�KÐ 3Ñ4ð ×-Ñ-¨dÈWÈIÐ-ÔVøàÒØŸ.š.ÑS¨dÐS°mÀMÕ6RÑSˆKäÐ!@ KÐ!@°<Ð!@ÈnÔ]Ð]r(   c          	      ó„   <€ V ^8„  d   QhRS[ R,          RS[S[RS[S[,          S[R,          3,          RS[S[,          /# ©r/   r^   Nr_   r   rW   ©r   r   r   ra   r   r   )r5   r6   s   "€r)   r7   r8   ±   sM   ø€ ÷  ñ  á˜TÕ!ð ñ ‘IÐ2±D¹µOÁTÐJ]ÕE^Ð^Õ_ð ñ Ñ6Õ7ñ	 r(   c                óÐ  € Ve3   \        V\        4      '       d   V.p\        V4      P                  4       pVEe    V P                  P                  V4      p\        V4      '       d   V..pW3# \        V\        \        34      '       dÑ   \        V^ ,          4      '       d¹   Ve²   V Uu. uF  qDP                  V P                  4      NK  	  pp^ .\        \        V4      4      ,           p\        \        V4      4       Uu. uF  pWV,          Wg^,           ,           NK  	  pp\        V4      VR,          8”  d   W�VR,          R  .,           pW3# Tp W3# V.pW3# u upi u upi )Néÿÿÿÿ)Ú
isinstancer4   ra   ÚcopyrU   Úfetch_imagesr	   ÚtupleÚcountrD   r   rK   Úlen)	rT   r^   r_   rW   ÚsampleÚn_images_in_textÚcumsum_images_in_textrX   Úsplit_imagess	   &&&,     r)   rq   Ú-ColModernVBertProcessor.prepare_inputs_layout±   sp  € ð ÒÜ˜$¤×$Ò$Ø�v�Ü˜“:—?‘?Ó$ˆDàÓØ×)Ñ)×6Ñ6°vÓ>ˆFÜ˜f×%Ò%Ø!˜(˜�ð$ ˆ|Ðô# ˜F¤T¬5 M×2Ò2´~ÀfÈQÅi×7PÒ7PØÒ#áUYÓ'ZÑUYÈ6¯©°T×5EÑ5EÖ(FÑUYÐ$Ð'ZØ-.¨C´$´zÐBRÓ7SÓ2TÕ,TÐ)ô "'¤sÐ+;Ó'<Ô!=ó$á!=˜Að °QÕ7Ð:OÐTUÕPUÕ:VÓWÙ!=ð !ð $ô
 ˜6“{Ð%:¸2Õ%>Ô>Ø!-Ð8MÈbÕ8QÐ8SÐ1TÐ0UÕ!U˜ð ˆ|Ðð	 ".™ð ˆ|Ðð %˜X�Fàˆ|Ðùò ([ùò$s   Â+#EÄ!E#c          	      ó„   <€ V ^8„  d   QhRS[ R,          RS[S[RS[S[,          S[R,          3,          RS[S[,          /# r‹   rŒ   )r5   r6   s   "€r)   r7   r8   Ó   sM   ø€ ÷ ñ á˜TÕ!ðñ ‘IÐ2±D¹µOÁTÐJ]ÕE^Ð^Õ_ðñ Ñ6Õ7ñ	r(   c                óÞ  <€ \         SV `  ! W3/ VB  Vf   Vf   \        R4      hVeº   V Uu. uF  qDP                  V P                  4      NK  	  ppVeO   V Uu. uF  p\        V4      NK  	  ppWW8w  d-   \        RV P                   RV RV P                   RV R2	4      hR # Vf9   \        V4      '       d&   \        R\        V4       RV P                   R24      hR # R # R # u upi u upi )	Nz+You must provide either `text` or `images`.zThe total number of zP tokens in the prompts should be the same as the number of images passed. Found Ú z tokens and z images per sample.zFound z. tokens in the text but no images were passed.)rQ   rr   Ú
ValueErrorr“   rD   r”   ÚanyÚsum)	rT   r^   r_   rW   r•   r–   ÚsublistÚn_images_in_imagesr[   s	   &&&,    €r)   rr   Ú'ColModernVBertProcessor.validate_inputsÓ   s  ø€ ô 	‰Ò Ñ7°Ò7àŠ<˜FšNÜÐJÓKÐKàÒÙMQÓRÉTÀ6§¡¨T×-=Ñ-=Ö >ÉTÐÐRØÒ!ÙBHÓ%IÁ&°w¤c¨'¦lÁ&Ð"Ð%IØ#Ô9Ü$Ø.¨t×/?Ñ/?Ð.@ð A"Ø"2Ð!3°1°T×5EÑ5EÐ4FÀlÐSeÐRfÐfyð{óð ñ :ð
 ’¤CÐ(8×$9Ò$9Ü ØœSÐ!1Ó2Ð3°1°T×5EÑ5EÐ4FÐFtÐuóð ñ %:‘ñ ùÚRùâ%Is   ®#C%ÁC*c                ó,   <€ V ^8„  d   QhRS[ RS[RS[/# )r/   r~   Ú	image_idxr`   )Údictr3   r4   )r5   r6   s   "€r)   r7   r8   ì   s#   ø€ ÷ %ñ %±ð %Áð %ÑSVñ %r(   c           	     óD  € VR ,           UUu. uF  qD F  qUNK  	  K  	  uppV,          pVR,           UUu. uF  qw F  qˆNK  	  K  	  uppV,          p	V^ 8X  d\   V	^ 8X  dU   V P                    V P                   ,           V P                   V P                  ,          ,           V P                    ,           # Rp
\	        V4       Fq  p\	        V	4       FV  pV
V P                    RV^,            RV^,            R2,           V P                   V P                  ,          ,           ,          p
KX  	  V
R,          p
Ks  	  V
RV P                    2V P                   ,           V P                   V P                  ,          ,           V P                    ,           ,          p
V
# u uppi u uppi )rf   rg   rA   r<   r=   r>   Ú
)rC   rF   rD   r0   rK   )rT   r~   r¤   rW   Úrow_listÚrowÚ
image_rowsÚcol_listÚcolÚ
image_colsÚtext_split_imagesÚn_hÚn_ws   &&&,         r)   Úreplace_image_tokenÚ+ColModernVBertProcessor.replace_image_tokenì   s§  € Ø*6°vÖ*>ÔSÑ*>˜hÊ(À3’cÉ(‘cÑ*>ÒSÐT]Õ^ˆ
Ø*6°vÖ*>ÔSÑ*>˜hÊ(À3’cÉ(‘cÑ*>ÒSÐT]Õ^ˆ
Ø˜Œ?˜z¨Qœà×(Ñ(Ð)Ø×*Ñ*Ð+õ-à×%Ñ%Ð&¨$×*<Ñ*<Õ<õ=ð ×*Ñ*Ð+õ-ðð !#ÐÜ˜ZÖ(�Ü  Ö,�CØ%Ø×0Ñ0Ð1Ø! #¨¥' ¨%°°aµ¨y¸Ð:õ;à!×-Ñ-Ð.°$×2DÑ2DÕDõEõÒ%ñ -ð " TÕ)Ò!ñ )ð Ø�T×*Ñ*Ð+Ð,Ø×*Ñ*Ð+õ-à×%Ñ%Ð&¨$×*<Ñ*<Õ<õ=ð ×*Ñ*Ð+õ-õÐð %Ð$ùó5 TùÛSs
   �F¶Fc                ó\   <€ V ^8„  d   QhRS[ RS[ S[,          RS[ S[ S[,          ,          /# )r/   rk   r€   r`   )ra   r3   )r5   r6   s   "€r)   r7   r8   	  s6   ø€ ÷ !ñ !±$ð !ÑQUÑVYÕQZð !Ñ_cÑdhÑilÕdmÕ_nñ !r(   c                ó´  € . p\        V4       FÆ  w  rE\        P                  ! W,          4      p\        P                  ! V4      p\        P                  ! W`P
                  8H  4      ^ ,          p^ p	V F?  p
V	\        V4      8¼  d    M.W‰,          pWº,           p^W{V% \        P                  ! WŒ4      p	KA  	  VP                  VP                  4       4       KÈ  	  V# )r   )
rx   ÚnpÚarrayÚ
zeros_likeÚwhererI   r”   Úsearchsortedrz   Útolist)rT   rk   r€   rl   rX   Úseq_lengthsÚ	array_idsÚmm_token_typesÚimage_start_positionsrY   Úseq_lenr„   r…   s   &&&          r)   r{   Ú0ColModernVBertProcessor.create_mm_token_type_ids	  sÂ   € ð ÐÜ'Ð(?Ö@‰NˆAÜŸš ¥Ó.ˆIÜŸ]š]¨9Ó5ˆNÜ$&§H¢H¨Y×:RÑ:RÑ-RÓ$SÐTUÕ$VÐ!ØˆAÛ&�ØœÐ1Ó2Ô2ÙØ-Õ0�Ø•o�Ø,-� SÐ)Ü—O’OÐ$9Ó?’ñ 'ð ×$Ñ$ ^×%:Ñ%:Ó%<Ö=ñ Að !Ð r(   c                óx  € / pVEe%   \         P                  P                  R/ 4      pVP                  V4       V Uu. uF"  pV P                  P
                  ! . VOVN5!  NK$  	  ppV P                  ^,           pV P                  ^,           p\        V P                  RRR7      R,          4      ^,
          p	. p
. pV FV  w  rÍpWŽ,          ^,           pV^ 8”  d   T	M^ pV
P                  VV,           Wý,          ,           4       VP                  V4       KX  	  VP                  RV
RV/4       \        R/ VB # u upi )	a{  
Computes the number of placeholder tokens needed for multimodal inputs with the given sizes.

Args:
    image_sizes (`list[list[int]]`, *optional*):
        The input sizes formatted as (height, width) per each image.

Returns:
    `MultiModalData`: A `MultiModalData` object holding number of tokens per each of the provided
    input modalities, along with other useful data.
r   z

F)rP   rk   Únum_image_tokensÚnum_image_patchesr!   )r   r&   ÚgetÚupdaterU   Úget_number_of_image_patchesr0   r”   rV   rz   r
   )rT   Úimage_sizesrW   Úvision_datar   Ú
image_sizeÚnum_image_row_colsÚbase_image_lengthÚ
col_lengthÚextra_split_newlinerÂ   rÃ   Únum_patchesÚnum_rowsÚnum_colsÚ
row_lengthÚsplit_extras   &&,              r)   Ú_get_num_multimodal_tokensÚ2ColModernVBertProcessor._get_num_multimodal_tokens  sL  € ð ˆØÓ"Ü9×CÑC×GÑGÈÐY[Ó\ˆMØ× Ñ  Ô(ñ #.ó"á"-�Jð ×$Ñ$×@Ò@Ð\À*Ð\ÈmÖ\Ù"-ð ð "ð
 !%× 2Ñ 2°QÕ 6ÐØ×+Ñ+¨aÕ/ˆJô
 #& d§n¡n°VÐPU nÓ&VÐWbÕ&cÓ"dÐghÕ"hÐØ!ÐØ "Ðã3EÑ/� xØ'Õ2°QÕ6�
Ø5=À´\Ñ1Àq�Ø ×'Ñ'Ð(9¸KÕ(GÈ:ÕK`Õ(aÔbØ!×(Ñ(¨Ö5ñ	 4Fð ×ÑÐ 2Ð4DÐFYÐ[lÐmÔnäÑ, Ñ,Ð,ùò/"s   ½(D7c                óJ   <€ V ^8„  d   QhRS[ R,          RS[S[,          RS[/# )r/   r^   NrW   r`   )r   r   r   r   )r5   r6   s   "€r)   r7   r8   I  s9   ø€ ÷ @ñ @á˜TÕ!ð@ñ Ñ6Õ7ð@ñ 
ñ	@r(   c                ó  € V P                   ! \        3RV P                  P                  /VB pVR,          P	                  RR4      pVRJp\        V4      '       d   V.pMŒ\        V\        4      '       d   \        V^ ,          4      '       d   M]\        V\        4      '       d=   \        V^ ,          \        4      '       d    \        V^ ,          ^ ,          4      '       g   \        R4      hV Uu. uF  qfP                  R4      NK  	  ppV P                  V P                  .\        V4      ,          VVR,          VR,          R7      pV'       d7   VR	,          P                  VR
,          ^ 8H  R4      pVP                  RV/4       V# u upi )au  
Prepare for the model one or several image(s). Handles input validation, RGB conversion,
and prepends the `visual_prompt_prefix` to each image. Optionally computes labels from
`token_type_ids` when a `suffix` is provided in `text_kwargs`.

Args:
    images (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `list[PIL.Image.Image]`, `list[np.ndarray]`, `list[torch.Tensor]`):
        The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
        tensor. In case of a NumPy array/PyTorch tensor, each image should be of shape (C, H, W), where C is a
        number of channels, H and W are image height and width.
    return_tensors (`str` or [`~utils.TensorType`], *optional*):
        If set, will return tensors of a particular framework. Acceptable values are:

        - `'pt'`: Return PyTorch `torch.Tensor` objects.
        - `'np'`: Return NumPy `np.ndarray` objects.

Returns:
    [`BatchFeature`]: A [`BatchFeature`] with the following fields:

    - **input_ids** -- List of token ids to be fed to a model.
    - **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when
      `return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names` and if `text` is not
      `None`).
    - **pixel_values** -- Pixel values to be fed to a model. Returned when `images` is not `None`.
rc   r   ÚsuffixNzAimages must be an image, list of images or list of list of imagesÚRGBr   )r_   r^   r   r   rk   Útoken_type_idsÚlabelsiœÿÿÿ)rs   r   rV   rt   ru   r	   r�   ra   r�   Úconvertrˆ   r1   r”   Úmasked_fillrÅ   )	rT   r^   rW   r}   r×   Úreturn_token_type_idsrm   Ú	batch_docrÚ   s	   &&,      r)   Úprocess_imagesÚ&ColModernVBertProcessor.process_imagesI  sj  € ð< ×*Ò*Ü)ñ
à"&§.¡.×"<Ñ"<ð
ð ñ
ˆð ˜}Õ-×1Ñ1°(¸DÓAˆà &¨dÐ 2Ðô ˜&×!Ò!Ø�X‰FÜ˜¤×%Ò%¬.¸À½×*CÒ*CØÜ˜V¤T×*Ò*¬z¸&À½)ÄT×/JÒ/JÌ~Ð^dÐefÕ^gÐhiÕ^j×OkÒOkÜÐ`ÓaÐañ 5;Ó;±F¨5—-‘- Ö&±FˆÐ;ð —M‘MØ×+Ñ+Ð,¬s°6«{Õ:ØØ'¨Õ8Ø% mÕ4ð	 "ó 
ˆ	÷ !Ø˜{Õ+×7Ñ7¸	ÐBRÕ8SÐWXÑ8XÐZ^Ó_ˆFØ×Ñ˜h¨Ð/Ô0àÐùò <s   Ã0F	c                ó\   <€ V ^8„  d   QhRS[ S[S[ ,          ,          RS[S[,          RS[/# )r/   r_   rW   r`   )r   ra   r   r   r   )r5   r6   s   "€r)   r7   r8   ‹  s8   ø€ ÷ 7ñ 7á™$™y�/Õ)ð7ñ Ñ6Õ7ð7ñ 
ñ	7r(   c                ó   € V P                   ! \        3RV P                  P                  /VB pVR,          P	                  RR4      p\        V\        4      '       d   V.pM>\        V\        4      '       d   \        V^ ,          \        4      '       g   \        R4      hVf   V P                  ^
,          pV Uu. uF  qPP                  V,           V,           NK  	  ppV P                  VRVR,          R7      pV# u upi )aÌ  
Prepare for the model one or several text queries. Handles input validation, prepends the
`query_prefix`, and appends query augmentation tokens (used to pad query embeddings for
better late-interaction retrieval performance).

Args:
    text (`str`, `list[str]`, `list[list[str]]`):
        The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
        (pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
        `is_split_into_words=True` (to lift the ambiguity with a batch of sequences).
    return_tensors (`str` or [`~utils.TensorType`], *optional*):
        If set, will return tensors of a particular framework. Acceptable values are:

        - `'pt'`: Return PyTorch `torch.Tensor` objects.
        - `'np'`: Return NumPy `np.ndarray` objects.

Returns:
    [`BatchFeature`]: A [`BatchFeature`] with the following fields:

    - **input_ids** -- List of token ids to be fed to a model.
    - **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when
      `return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names` and if `text` is not
      `None`).
rc   r   r×   Nz*Text must be a string or a list of stringsF)r_   rÝ   r   )rs   r   rV   rt   ru   r�   r4   ra   r�   rS   r2   rˆ   )rT   r_   rW   r}   r×   ÚqueryÚtexts_queryÚbatch_querys   &&,     r)   Úprocess_queriesÚ'ColModernVBertProcessor.process_queries‹  sú   € ð: ×*Ò*Ü)ñ
à"&§.¡.×"<Ñ"<ð
ð ñ
ˆð ˜}Õ-×1Ñ1°(¸DÓAˆä�dœC× Ò Ø�6‰DÜ˜T¤4×(Ò(¬Z¸¸Q½Ä×-EÒ-EÜÐIÓJÐJð Š>Ø×2Ñ2°RÕ7ˆFñ SWÓ!WÑRVÈ×"3Ñ"3°eÕ";¸f×"DÐ"DÑRVˆÐ!Wà—m‘mØØ"'Ø% mÕ4ð $ó 
ˆð Ðùò "Xs   Â:"C;c                ó¢   <€ V ^8„  d   QhRS[ RS[R,          3,          RS[ RS[R,          3,          RS[RS[R,          RS[ RS[3,          R	R/# )
r/   Úquery_embeddingsztorch.TensorÚpassage_embeddingsÚ
batch_sizeÚoutput_dtypeztorch.dtypeÚoutput_deviceztorch.devicer`   )r   ra   r3   r   r4   )r5   r6   s   "€r)   r7   r8   Ä  st   ø€ ÷ >(ñ >(á ±°^Õ0DÐ DÕEð>(ñ " .±$°~Õ2FÐ"FÕGð>(ñ ð	>(ñ
 ˜}Õ-ð>(ñ ˜^©SÐ0Õ1ð>(ð 
ñ>(r(   c           	     ó8  € \        V4      ^ 8X  d   \        R4      h\        V4      ^ 8X  d   \        R4      hV^ ,          P                  V^ ,          P                  8w  d   \        R4      hV^ ,          P                  V^ ,          P                  8w  d   \        R4      hVf   V^ ,          P                  p. p\	        ^ \        V4      V4       EF1  p. p\
        P                  P                  P                  P                  WWs,            R^ R7      p	\	        ^ \        V4      V4       FŽ  p
\
        P                  P                  P                  P                  W*W£,            R^ R7      pVP                  \
        P                  ! RW›4      P                  ^R7      ^ ,          P                  ^R7      4       K�  	  VP                  \
        P                  ! V^R7      P                  V4      P                  V4      4       EK4  	  \
        P                  ! V^ R7      # )	aÃ  
Compute the late-interaction/MaxSim score (ColBERT-like) for the given multi-vector
query embeddings (`qs`) and passage embeddings (`ps`). For ColQwen2, a passage is the
image of a document page.

Because the embedding tensors are multi-vector and can thus have different shapes, they
should be fed as:
(1) a list of tensors, where the i-th tensor is of shape (sequence_length_i, embedding_dim)
(2) a single tensor of shape (n_passages, max_sequence_length, embedding_dim) -> usually
    obtained by padding the list of tensors.

Args:
    query_embeddings (`Union[torch.Tensor, list[torch.Tensor]`): Query embeddings.
    passage_embeddings (`Union[torch.Tensor, list[torch.Tensor]`): Passage embeddings.
    batch_size (`int`, *optional*, defaults to 128): Batch size for computing scores.
    output_dtype (`torch.dtype`, *optional*, defaults to `torch.float32`): The dtype of the output tensor.
        If `None`, the dtype of the input embeddings is used.
    output_device (`torch.device` or `str`, *optional*, defaults to "cpu"): The device of the output tensor.

Returns:
    `torch.Tensor`: A tensor of shape `(n_queries, n_passages)` containing the scores. The score
    tensor is saved on the "cpu" device.
zNo queries providedzNo passages providedz/Queries and passages must be on the same devicez-Queries and passages must have the same dtypeT)Úbatch_firstÚpadding_valuezbnd,csd->bcns)Údim)r”   r�   ÚdeviceÚdtyperK   ÚtorchÚnnÚutilsÚrnnÚpad_sequencerz   ÚeinsumÚmaxrŸ   ÚcatÚto)rT   ré   rê   rë   rì   rí   ÚscoresrX   Úbatch_scoresÚbatch_queriesrY   Úbatch_passagess   &&&&&&      r)   Úscore_retrievalÚ'ColModernVBertProcessor.score_retrievalÄ  sÍ  € ô@ ÐÓ  AÔ%ÜÐ2Ó3Ð3ÜÐ!Ó" aÔ'ÜÐ3Ó4Ð4à˜AÕ×%Ñ%Ð);¸AÕ)>×)EÑ)EÔEÜÐNÓOÐOà˜AÕ×$Ñ$Ð(:¸1Õ(=×(CÑ(CÔCÜÐLÓMÐMàÒØ+¨AÕ.×4Ñ4ˆLà%'ˆä�qœ#Ð.Ó/°×<ˆAØ/1ˆLÜ!ŸH™HŸN™N×.Ñ.×;Ñ;Ø  Q¥^Ð4À$ÐVWð <ó ˆMô ˜1œcÐ"4Ó5°zÖB�Ü!&§¡§¡×!3Ñ!3×!@Ñ!@Ø&¨1­>Ð:ÈÐ\]ð "Aó "�ð ×#Ñ#Ü—L’L °-ÓP×TÑTÐYZÐTÓ[Ð\]Õ^×bÑbÐghÐbÓiöñ	 Cð �M‰Mœ%Ÿ)š) L°aÔ8×;Ñ;¸LÓI×LÑLÈ]Ó[×\ñ =ô �yŠy˜ QÔ'Ð'r(   )rO   rE   rC   rI   rF   rJ   r0   rD   rH   rS   r2   rL   r1   )NNé@   NN)NNN)NN)N)é€   NÚcpu)r"   r#   r$   r%   r   Úvalid_processor_kwargsrR   r   rˆ   rq   rr   r±   r{   rÓ   rß   ræ   r  r'   Ú__classdictcell__Ú__classcell__)r[   r6   s   @@r)   r-   r-   6   s�   ù‡ € ð ;Ð÷3Dõ 3Dðj ÷>^ñ >^ó ð>^÷@ ò  ÷Dõ ÷2%ð %÷:!ð !ô*)-÷V@ò @÷D7ð 7÷r>(÷ >(ò >(r(   r-   )rô   ) rM   Ú	itertoolsr   Útypingr   r   r   Únumpyrµ   rô   Úfeature_extraction_utilsr   Úimage_utilsr   r	   Úprocessing_utilsr
   r   r   r   Útokenization_utils_baser   r   r   rö   r   Úutils.import_utilsr   r   r   r-   Ú__all__r!   r(   r)   Ú<module>r     s~   ðó* 
Ý  ß 1Ñ 1ã Û å 4ß 5ß XÓ Xß KÑ KÝ #Ý *÷ Ý<ôÐ$4¸Eõ ñ 
�:ÔØôJ(˜nó J(ó ó ðJ(ðZ %Ð
%‚r(   