+
    œ°³j¤  ã                   óè   € R t ^ RIt^RIHtHtHt ^RIHtH	t	H
t
 ^RIHt ]	! 4       '       d   ^RIHt ]
P                  ! ]4      t ! R R]RR	7      t]]! RR
7       ! R R]4      4       4       tR.tR# )z
Processor class for Pixtral.
N)ÚMultiModalDataÚProcessingKwargsÚProcessorMixin)Úauto_docstringÚis_vision_availableÚlogging)Úrequires)Úget_resize_output_image_sizec                   ó.   € ] tR t^$tRRRRR/RRR//tRtR	# )
ÚPixtralProcessorKwargsÚtext_kwargsÚpaddingFÚreturn_mm_token_type_idsÚcommon_kwargsÚreturn_tensorsÚpt© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú	_defaultsÚ__static_attributes__r   ó    Úo/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/pixtral/processing_pixtral.pyr   r   $   s*   † àØ�uØ&¨ð
ð 	Ø˜dð
ð„Ir   r   F)Útotal)Úbackendsc                   óš   a a€ ] tR t^0t o]tRV3R lV 3R lllt]V3R lR l4       tV 3R lt	V3R lR lt
RR lt]R	 4       tR
tVtV ;t# )ÚPixtralProcessorc                ó&   <€ V ^8„  d   QhRS[ RS[ /# )é   Ú
patch_sizeÚspatial_merge_size)Úint)ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚPixtralProcessor.__annotate__5   s%   ø€ ÷ "Xñ "Xñ ð	"Xñ
  ñ"Xr   c	                óf  <€ \         S
V `  WVR7       W0n        W@n        W`n        VP                  V P                  4      V n        Wpn        W€n        VP                  V P                  4      V n        VP                  V P                  4      V n	        VP                  V P                  4      V n
        R# )a>  
patch_size (`int`, *optional*, defaults to 16):
    Patch size from the vision tower.
spatial_merge_size (`int`, *optional*, defaults to 1):
    The downsampling factor for the spatial merge operation.
image_token (`str`, *optional*, defaults to `"[IMG]"`):
    Special token used to denote image location.
image_break_token (`str`, *optional*, defaults to `"[IMG_BREAK]"`):
    Special token used to denote the end of a line of pixels in an image.
image_end_token (`str`, *optional*, defaults to `"[IMG_END]"`):
    Special token used to denote the end of an image input.
)Úchat_templateN)ÚsuperÚ__init__r!   r"   Úimage_tokenÚconvert_tokens_to_idsÚimage_token_idÚimage_break_tokenÚimage_end_tokenÚimage_break_token_idÚimage_end_token_id)ÚselfÚimage_processorÚ	tokenizerr!   r"   r)   r,   r/   r0   ÚkwargsÚ	__class__s   &&&&&&&&&,€r   r+   ÚPixtralProcessor.__init__5   s˜   ø€ ô0 	‰Ñ˜À=ÐÔQà$ŒØ"4ÔØ&ÔØ'×=Ñ=¸d×>NÑ>NÓOˆÔØ!2ÔØ.ÔØ'×=Ñ=¸d×>NÑ>NÓOˆÔØ$-×$CÑ$CÀD×DZÑDZÓ$[ˆÔ!Ø"+×"AÑ"AÀ$×BVÑBVÓ"WˆÖr   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# )r    Úreturn)Úlistr#   )r$   r%   s   "€r   r&   r'   Z   s   ø€ ÷ Yñ Y¡¡c¥ñ Yr   c                óH   € V P                   V P                  V P                  .# ©N)r.   r1   r2   )r3   s   &r   Úimage_token_idsÚ PixtralProcessor.image_token_idsY   s!   € à×#Ñ# T×%>Ñ%>À×@WÑ@WÐXÐXr   c                óf   <€ V P                   V P                  ,          VR &   \        SV `  ! V3/ VB # )r!   )r!   r"   r*   Ú_process_images)r3   ÚimagesÚimages_kwargsr7   s   &&,€r   rA   Ú PixtralProcessor._process_images]   s1   ø€ Ø&*§o¡o¸×8OÑ8OÕ&Oˆ�lÑ#Ü‰wÒ& vÑ?°Ñ?Ð?r   c                ó,   <€ V ^8„  d   QhRS[ RS[RS[/# )r    Úimage_inputsÚ	image_idxr:   )Údictr#   Ústr)r$   r%   s   "€r   r&   r'   a   s#   ø€ ÷ 'ñ '±ð 'Áð 'ÑSVñ 'r   c                ó\  € V P                   V P                  ,          pVR ,          V,          w  rVWT,          pWd,          pV P                  .V,          V P                  .,           .V,          p	V	 U
Uu. uF  qª F  q»NK  	  K  	  p	p
pV P                  V	R&   RP                  V	4      # u upp
i )Úimage_sizesÚ éÿÿÿÿ)r!   r"   r,   r/   r0   Újoin)r3   rF   rG   r6   r!   ÚheightÚwidthÚnum_height_tokensÚnum_width_tokensÚreplace_tokensÚsublistÚitems   &&&,        r   Úreplace_image_tokenÚ$PixtralProcessor.replace_image_tokena   s¥   € Ø—_‘_ t×'>Ñ'>Õ>ˆ
Ø$ ]Õ3°IÕ>‰ˆØ"Õ0ÐØ Õ.ÐØ×+Ñ+Ð,Ð/?Õ?À4×CYÑCYÐBZÕZÐ[Ð^oÕoˆÙ.<ÔQ©n 7ÊÀš$É™$©nˆÑQØ!×1Ñ1ˆ�rÑØ�w‰w�~Ó&Ð&ùó Rs   Á3B(c                óX  € / pVEe   \         P                  P                  R/ 4      pVP                  V4       VP                  RR4      ;'       g    V P                  P
                  pV P                  V P                  ,          p. pV Fk  w  r‰\        \        P                  ! W‰^34      VR,          VR,          3Wf3R7      w  r«W¦,          pW¶,          pVP                  V^,           V,          4       Km  	  ^.\        V4      ,          pVP                  RVRV/4       \        R/ VB # )	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.
NrC   ÚsizeÚlongest_edge)rY   r!   Únum_image_tokensÚnum_image_patchesr   )r   r   ÚgetÚupdater4   rY   r!   r"   r	   ÚnpÚzerosÚappendÚlenr   )r3   rK   r6   Úvision_datarC   rY   r!   r[   rO   rP   Úresized_heightÚresized_widthrQ   rR   r\   s   &&,            r   Ú_get_num_multimodal_tokensÚ+PixtralProcessor._get_num_multimodal_tokensk   s#  € ð ˆØÓ"Ü2×<Ñ<×@Ñ@ÀÐRTÓUˆMØ× Ñ  Ô(à ×$Ñ$ V¨TÓ2×OÐO°d×6JÑ6J×6OÑ6OˆDØŸ™¨4×+BÑ+BÕBˆJà!ÐÛ!,‘�Ü0LÜ—H’H˜f¨QÐ/Ó0Ø˜~Õ.°°^Õ0DÐEØ *Ð7ô1Ñ-�ð
 %3Õ$@Ð!Ø#0Õ#>Ð Ø ×'Ñ'Ð)9¸AÕ)=ÐARÕ(RÖSñ "-ð "# ¤c¨+Ó&6Õ 6ÐØ×ÑÐ 2Ð4DÐFYÐ[lÐmÔnäÑ, Ñ,Ð,r   c                óz   € V P                   P                  pV P                  P                  pW,           R .,           # )rK   )r5   Úmodel_input_namesr4   )r3   Útokenizer_input_namesÚimage_processor_input_namess   &  r   ri   Ú"PixtralProcessor.model_input_names�   s4   € à $§¡× @Ñ @ÐØ&*×&:Ñ&:×&LÑ&LÐ#Ø$ÕBÀmÀ_ÕTÐTr   )r/   r1   r0   r2   r,   r.   r!   r"   )NNé   é   Nz[IMG]z[IMG_BREAK]z	[IMG_END]r=   )r   r   r   r   r   Úvalid_processor_kwargsr+   Úpropertyr>   rA   rV   rf   ri   r   Ú__classdictcell__Ú__classcell__)r7   r%   s   @@r   r   r   0   sb   ù‡ € ð 4Ð÷"Xõ "XðH ÷Yó ðYõ@÷'ð 'ô"-ðH ñUó ÷Uð Ur   r   )ÚtorchvisionÚtorch)Ú__doc__Únumpyr_   Úprocessing_utilsr   r   r   Úutilsr   r   r   Úutils.import_utilsr   Úimage_processing_pixtralr	   Ú
get_loggerr   Úloggerr   r   Ú__all__r   r   r   Ú<module>r~      sŽ   ðñó ÷ñ ÷
 BÑ AÝ *ñ ×ÒÝFð 
×	Ò	˜HÓ	%€ô	Ð-°Uõ 	ð Ù	Ð+Ô,ôaU�~ó aUó -ó ðaUðH Ð
‚r   