ó
    qyüit  ã                   ó®   • S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	J
r
  SSKJrJr  SSKJrJrJr  / S	Qr/ S
Qr " S S\SS9r\ " S S\5      5       rS/rg)z"Image processor class for Idefics.é    )ÚCallableé   )ÚTorchvisionBackend)ÚBatchFeature)Ú
ImageInputÚPILImageResamplingÚmake_flat_list_of_images)ÚImagesKwargsÚUnpack)Ú
TensorTypeÚauto_docstringÚis_torch_available)g3<Í4'ÐÞ?gwgí¶MÝ?gy{Îå Ú?)g�‡Bô91Ñ?g•wÝt.¹Ð?g�Ý	U¦Ñ?c                   ó>   • \ rS rSr% Sr\S-  \S'   \\S'   \\S'   Srg)ÚIdeficsImageProcessorKwargsé!   aµ  
transform (`Callable`, *optional*, defaults to `None`):
    A custom transform function that accepts a single image can be passed for training. For example,
    `torchvision.Compose` can be used to compose multiple transforms. If `None` - an inference mode is
    assumed - and then a preset of inference-specific transforms will be applied to the images.
image_size (`int`, *optional*, defaults to `self.image_size`):
    Resize to image size. This is a backward-compatible alias for `size`. When provided, it overrides
    `size` and sets it to `{"height": image_size, "width": image_size}`.
image_num_channels (`int`, *optional*, defaults to `3`):
    The number of channels of the image.
NÚ	transformÚ
image_sizeÚimage_num_channels© )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__ÚintÚ__static_attributes__r   ó    Úq/home/mande/repo/quber/.venv/lib/python3.13/site-packages/transformers/models/idefics/image_processing_idefics.pyr   r   !   s   ‡ ñ
ð ˜$‰ÓØƒOØÖr   r   F)Útotalc                   ó¤   ^ • \ rS rSr\r\R                  r\	r
\rSSS.rSrSrSrSrSrS\\   4U 4S jjr\S\S\\   S	S
4U 4S jj5       rSrU =r$ )ÚIdeficsImageProcessoré3   éà   ©ÚheightÚwidthTr   Úkwargsc                 ó”   >• UR                  SS 5      nUb  X"S.US'   [        TU ]  " S0 UD6  U R                  R                  U l        g )Nr   r%   Úsizer   )ÚpopÚsuperÚ__init__r*   r&   r   )Úselfr(   r   Ú	__class__s      €r   r-   ÚIdeficsImageProcessor.__init__@   sF   ø€ Ø—Z‘Z ¨dÓ3ˆ
ØÑ!Ø(2ÑHˆF�6‰NÜ‰ÒÑ"˜6Ò"ØŸ)™)×*Ñ*ˆ�r   ÚimagesÚreturnzTensorType | BatchFeaturec                 ó2  >• UR                  SS 5      nUbb  [        5       (       d  [        S5      eSS KnU R	                  U5      n[        U5      nU Vs/ s H
  oS" U5      PM     nnUR                  U5      $ [        TU ]   " U40 UD6R                  $ s  snf )Nr   z.To pass in `transform` torch must be installedr   )
r+   r   ÚImportErrorÚtorchÚfetch_imagesr	   Ústackr,   Ú
preprocessÚpixel_values)r.   r1   r(   r   r5   Úxr/   s         €r   r8   Ú IdeficsImageProcessor.preprocessG   s”   ø€ ð —J‘J˜{¨DÓ1ˆ	ØÑ Ü%×'Ñ'Ü!Ð"RÓSÐSÛà×&Ñ& vÓ.ˆFÜ-¨fÓ5ˆFÙ,2Ó3ªF q�i –l©FˆFÐ3Ø—;‘;˜vÓ&Ð&Ü‰wÒ! &Ñ3¨FÑ3×@Ñ@Ð@ùò 4s   ÁB)r   )r   r   r   r   r   Úvalid_kwargsr   ÚBICUBICÚresampleÚIDEFICS_STANDARD_MEANÚ
image_meanÚIDEFICS_STANDARD_STDÚ	image_stdr*   Ú	do_resizeÚ
do_rescaleÚdo_normalizeÚdo_convert_rgbr   r   r-   r   r   r8   r   Ú__classcell__)r/   s   @r   r"   r"   3   sŽ   ø† à.€LØ!×)Ñ)€HØ&€JØ$€IØ CÑ(€DØ€IØ€JØ€LØ€NØÐð+ Ð(CÑ!D÷ +ð ðAàðAð Ð4Ñ5ðAð 
%ö	Aó öAr   r"   N)r   Úcollections.abcr   Úimage_processing_backendsr   Úimage_processing_utilsr   Úimage_utilsr   r   r	   Úprocessing_utilsr
   r   Úutilsr   r   r   r?   rA   r   r"   Ú__all__r   r   r   Ú<module>rO      sn   ðñ )å $å ;Ý 2÷ñ ÷
 5ß CÑ Cò <Ð Ú;Ð ô ,°eò ð$ ô#AÐ.ó #Aó ð#AðL #Ð
#�r   