ó
    ‡Ž¡j²  ã                   ó†   • S SK JrJrJrJr  S SKJrJr  SSKJ	r	   " S S\SS9r
 " S	 S
\SS9r\ " S S\5      5       rS/rg)é   )ÚImagesKwargsÚMultiModalDataÚProcessingKwargsÚProcessorMixin)Ú
TensorTypeÚauto_docstringé   )ÚAutoTokenizerc                   ó8   • \ rS rSr% Sr\\S'   \\S'   \\S'   Srg)ÚAriaImagesKwargsé   aÍ  
split_image (`bool`, *optional*, defaults to `False`):
    Whether to split large images into multiple crops. When enabled, images exceeding the maximum size are
    divided into overlapping crops that are processed separately and then combined. This allows processing
    of very high-resolution images that exceed the model's input size limits.
max_image_size (`int`, *optional*, defaults to `980`):
    Maximum image size (in pixels) for a single image crop. Images larger than this will be split into
    multiple crops when `split_image=True`, or resized if splitting is disabled. This parameter controls
    the maximum resolution of individual image patches processed by the model.
min_image_size (`int`, *optional*):
    Minimum image size (in pixels) for a single image crop. Images smaller than this will be upscaled to
    meet the minimum requirement. If not specified, images are processed at their original size (subject
    to the maximum size constraint).
Úsplit_imageÚmax_image_sizeÚmin_image_size© N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚboolÚ__annotations__ÚintÚ__static_attributes__r   ó    Ú¶C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\transformers/models/aria/processing_aria.pyr   r      s   ‡ ñð ÓØÓØÖr   r   F)Útotalc                   óL   • \ rS rSr% \\S'   SSS.SSS.\R                  S.rSr	g	)
ÚAriaProcessorKwargsé.   Úimages_kwargsF)ÚpaddingÚreturn_mm_token_type_idséÔ  )r   r   )Útext_kwargsr!   Úreturn_tensorsr   N)
r   r   r   r   r   r   r   ÚPYTORCHÚ	_defaultsr   r   r   r   r   r   .   s4   ‡ Ø#Ó#ð Ø(-ñ
ð
 "Ø ñ
ð %×,Ñ,ñ
ƒIr   r   c            	       ó¨   ^ • \ rS rSr\r    SS\\-  S\S-  S\\	\
-  \
4   S-  4U 4S jjjrS\S\
S	\4S
 jrSS jr\S	\\   4S j5       rSrU =r$ )ÚAriaProcessoré>   NÚ	tokenizerÚchat_templateÚsize_conversionc                 ó,  >• Uc  SSS.nUR                  5        VVs0 s H  u  pV[        U5      U_M     snnU l        UR                  U l        UR                  U l        Ub  UR
                  c  UR                  Ul        [        TU ]!  XUS9  gs  snnf )z`
size_conversion (`Dict`, *optional*):
    A dictionary indicating size conversions for images.
Né€   é   )iê  r$   )r-   )	Úitemsr   r.   Úimage_tokenÚimage_token_idÚ	pad_tokenÚ	unk_tokenÚsuperÚ__init__)ÚselfÚimage_processorr,   r-   r.   ÚkÚvÚ	__class__s          €r   r8   ÚAriaProcessor.__init__B   s”   ø€ ð Ñ"Ø$'¨cÑ2ˆOØ6E×6KÑ6KÔ6MÔNÒ6M©d¨a¤ A£¨¢	Ñ6MÒNˆÔà$×0Ñ0ˆÔØ'×6Ñ6ˆÔØÑ  Y×%8Ñ%8Ñ%@Ø"+×"5Ñ"5ˆIÔä‰Ñ˜À=ÐÒQùó  Os   �BÚimage_inputsÚ	image_idxÚreturnc                 ón   • U R                   US   R                  S      nUS   U-  nU R                  U-  $ )NÚpixel_valuesr	   Ú	num_crops)r.   Úshaper3   )r9   r?   r@   ÚkwargsÚtokens_per_imageÚnum_image_tokenss         r   Úreplace_image_tokenÚ!AriaProcessor.replace_image_tokenX   sG   € Ø×/Ñ/°¸^Ñ0L×0RÑ0RÐSTÑ0UÑVÐØ'¨Ñ4Ð7GÑGÐØ×ÑÐ"2Ñ2Ð2r   c                 óº  • 0 nUbÂ  [         R                  R                  S0 5      nUR                  U5        UR                  SS5      =(       d    U R                  R
                  nU Vs/ s H!  nU R                  R                  " / UQUP76 PM#     nnU Vs/ s H  o€R                  U   U-  PM     n	nUR                  X—S.5        [        S0 UD6$ s  snf s  snf )ay  
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.
Nr!   r   )rH   Únum_image_patchesr   )	r   r(   ÚgetÚupdater:   r   Úget_number_of_image_patchesr.   r   )
r9   Úimage_sizesrF   Úvision_datar!   Úmax_sizeÚ
image_sizerL   Únum_patchesrH   s
             r   Ú_get_num_multimodal_tokensÚ(AriaProcessor._get_num_multimodal_tokens]   sé   € ð ˆØÑ"Ü/×9Ñ9×=Ñ=¸oÈrÓRˆMØ× Ñ  Ô(à$×(Ñ(Ð)9¸4Ó@×gÀD×DXÑDX×DgÑDgˆHñ #.ó!â"-�Jð ×$Ñ$×@Ò@Ð\À*Ð\ÈmÕ\Ù"-ð ð !ñ arÓrÒ`qÐQ\× 4Ñ 4°XÑ >ÀÔ LÑ`qÐÐrØ×ÑÐ4DÑmÔnäÑ, Ñ,Ð,ùò!ùò  ss   Á*(CÂCc                 ó   • S/$ )NrD   r   )r9   s    r   Úunused_input_namesÚ AriaProcessor.unused_input_namesw   s
   € àˆ}Ðr   )r3   r4   r.   )NNNN)N)r   r   r   r   r   Úvalid_processor_kwargsr
   ÚstrÚdictÚfloatr   r8   rI   rU   ÚpropertyÚlistrX   r   Ú__classcell__)r=   s   @r   r*   r*   >   sŸ   ø† à0Ðð Ø)-Ø$(Ø9=ñRð ! 3Ñ&ðRð ˜T‘zð	Rð
 ˜e c™k¨3Ð.Ñ/°$Ñ6÷Rð Rð,3°ð 3Àð 3ÐSVô 3ô
-ð4 ð D¨¡Ió ó ör   r*   N)Úprocessing_utilsr   r   r   r   Úutilsr   r   Úautor
   r   r   r*   Ú__all__r   r   r   Ú<module>re      sW   ð÷( _Ó ^ß /Ý  ô�|¨5ò ô*Ð*°%ò ð  ô:�Nó :ó ð:ðz Ð
�r   