Ë
    S^(h˜ ã            
       óÔ  — d Z ddlZddlZddlZddlZddlZddlZddlZddlm	Z	 ddlm
Z
mZmZmZmZmZmZ ddlZddlZddlmZ ddlmZ ddlmZmZmZmZmZmZmZ  e«       rdd	lm Z  dd
l!m"Z"m#Z#m$Z$m%Z%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3  e3jh                  e5«      Z6 e/ e	e7«      jp                  «      Z9ddddœZ:ejv                  dk\  rejx                  Z<nejx                  Z< G d„ ded¬«      Z= G d„ ded¬«      Z> G d„ ded¬«      Z? G d„ ded¬«      Z@ G d„ ded¬«      ZA G d„ de=e>e?e@eAd¬«      ZB G d„ d ed¬«      ZC G d!„ d"ed¬«      ZD G d#„ d$eDeCd¬«      ZE G d%„ d&e=e>e?e@eAeE«      ZF G d'„ d(e)«      ZGd)„ ZH e.eGj’                  «      eG_I        eGj’                  j                   �8eGj’                  j                   j•                  d*d+d,¬-«      eGj’                  _         yy).z8
Processing saving/loading class for common processors.
é    N)ÚPath)ÚAnyÚCallableÚDictÚListÚOptionalÚ	TypedDictÚUnioné   )Ú
load_audio)Úcustom_object_save)ÚChannelDimensionÚ
ImageInputÚ
VideoInputÚis_valid_imageÚis_vision_availableÚ
load_imageÚ
load_video)ÚPILImageResampling)ÚPaddingStrategyÚPreTokenizedInputÚPreTrainedTokenizerBaseÚ	TextInputÚTruncationStrategy)ÚPROCESSOR_NAMEÚPushToHubMixinÚ
TensorTypeÚadd_model_info_to_auto_mapÚ"add_model_info_to_custom_pipelinesÚcached_fileÚ	copy_funcÚdirect_transformers_importÚdownload_urlÚis_offline_modeÚis_remote_urlÚloggingr   ÚFeatureExtractionMixinÚImageProcessingMixin)ÚAutoTokenizerÚAutoFeatureExtractorÚAutoImageProcessor)é   é   c                   ó†  — e Zd ZU dZeeeeee   ee   f      e	d<   eeeee   ee   f   e	d<   eeeeee   ee   f      e	d<   ee
   e	d<   ee
eef   e	d<   ee
eef   e	d<   ee   e	d<   ee   e	d	<   ee
   e	d
<   ee   e	d<   ee
   e	d<   ee
   e	d<   ee
   e	d<   ee
   e	d<   ee
   e	d<   ee
   e	d<   ee
   e	d<   ee   e	d<   y)Ú
TextKwargsa²  
    Keyword arguments for text processing. For extended documentation, check out tokenization_utils_base methods and
    docstrings associated.

    Attributes:
        add_special_tokens (`bool`, *optional*)
            Whether or not to add special tokens when encoding the sequences.
        padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*)
            Activates and controls padding.
        truncation (`bool`, `str` or [`~tokenization_utils_base.TruncationStrategy`], *optional*):
            Activates and controls truncation.
        max_length (`int`, *optional*):
            Controls the maximum length to use by one of the truncation/padding parameters.
        stride (`int`, *optional*):
            If set, the overflowing tokens will contain some tokens from the end of the truncated sequence.
        is_split_into_words (`bool`, *optional*):
            Whether or not the input is already pre-tokenized.
        pad_to_multiple_of (`int`, *optional*):
            If set, will pad the sequence to a multiple of the provided value.
        return_token_type_ids (`bool`, *optional*):
            Whether to return token type IDs.
        return_attention_mask (`bool`, *optional*):
            Whether to return the attention mask.
        return_overflowing_tokens (`bool`, *optional*):
            Whether or not to return overflowing token sequences.
        return_special_tokens_mask (`bool`, *optional*):
            Whether or not to return special tokens mask information.
        return_offsets_mapping (`bool`, *optional*):
            Whether or not to return `(char_start, char_end)` for each token.
        return_length (`bool`, *optional*):
            Whether or not to return the lengths of the encoded inputs.
        verbose (`bool`, *optional*):
            Whether or not to print more information and warnings.
        padding_side (`str`, *optional*):
            The side on which padding will be applied.
    Ú	text_pairÚtext_targetÚtext_pair_targetÚadd_special_tokensÚpaddingÚ
truncationÚ
max_lengthÚstrideÚis_split_into_wordsÚpad_to_multiple_ofÚreturn_token_type_idsÚreturn_attention_maskÚreturn_overflowing_tokensÚreturn_special_tokens_maskÚreturn_offsets_mappingÚreturn_lengthÚverboseÚpadding_sideN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r
   r   r   ÚlistÚ__annotations__ÚboolÚstrr   r   Úint© ó    ú[/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/processing_utils.pyr/   r/   X   s  … ñ#ðJ ˜˜iÐ):¸DÀ¹OÈTÐRcÑMdÐdÑeÑfÓfØ�yÐ"3°T¸)±_ÀdÐK\ÑF]Ð]Ñ^Ó^Ø˜u YÐ0AÀ4È	Á?ÐTXÐYjÑTkÐ%kÑlÑmÓmØ  ™Ó&Ø�4˜˜oÐ-Ñ.Ó.Ø�d˜CÐ!3Ð3Ñ4Ó4Ø˜‘ÓØ�S‰MÓØ! $™Ó'Ø  ™Ó%Ø# D™>Ó)Ø# D™>Ó)Ø'¨™~Ó-Ø (¨¡Ó.Ø$ T™NÓ*Ø˜D‘>Ó!Ø�d‰^ÓØ˜3‘-ÔrL   r/   F)Útotalc                   ód  — e Zd ZU dZee   ed<   eeee	f      ed<   ee	   ed<   eeee	f      ed<   ee
de	f      ed<   ee   ed<   ee   ed	<   ee   ed
<   ee
eee   f      ed<   ee
eee   f      ed<   ee   ed<   eeee	f      ed<   ee   ed<   ee   ed<   ee
eef      ed<   ee   ed<   y)ÚImagesKwargsaç  
    Keyword arguments for image processing. For extended documentation, check the appropriate ImageProcessor
    class methods and docstrings.

    Attributes:
        do_resize (`bool`, *optional*):
            Whether to resize the image.
        size (`Dict[str, int]`, *optional*):
            Resize the shorter side of the input to `size["shortest_edge"]`.
        size_divisor (`int`, *optional*):
            The size by which to make sure both the height and width can be divided.
        crop_size (`Dict[str, int]`, *optional*):
            Desired output size when applying center-cropping.
        resample (`PILImageResampling`, *optional*):
            Resampling filter to use if resizing the image.
        do_rescale (`bool`, *optional*):
            Whether to rescale the image by the specified scale `rescale_factor`.
        rescale_factor (`int` or `float`, *optional*):
            Scale factor to use if rescaling the image.
        do_normalize (`bool`, *optional*):
            Whether to normalize the image.
        image_mean (`float` or `List[float]`, *optional*):
            Mean to use if normalizing the image.
        image_std (`float` or `List[float]`, *optional*):
            Standard deviation to use if normalizing the image.
        do_pad (`bool`, *optional*):
            Whether to pad the image to the `(max_height, max_width)` of the images in the batch.
        pad_size (`Dict[str, int]`, *optional*):
            The size `{"height": int, "width" int}` to pad the images to.
        do_center_crop (`bool`, *optional*):
            Whether to center crop the image.
        data_format (`ChannelDimension` or `str`, *optional*):
            The channel dimension format for the output image.
        input_data_format (`ChannelDimension` or `str`, *optional*):
            The channel dimension format for the input image.
        device (`str`, *optional*):
            The device to use for processing (e.g. "cpu", "cuda"), only relevant for fast image processing.
    Ú	do_resizeÚsizeÚsize_divisorÚ	crop_sizer   ÚresampleÚ
do_rescaleÚrescale_factorÚdo_normalizeÚ
image_meanÚ	image_stdÚdo_padÚpad_sizeÚdo_center_cropÚdata_formatÚinput_data_formatÚdeviceN)rB   rC   rD   rE   r   rH   rG   ÚdictrI   rJ   r
   ÚfloatrF   r   rK   rL   rM   rP   rP   ’   sý   … ñ%ðN ˜‰~ÓØ
�4˜˜S˜‘>Ñ
"Ó"Ø˜3‘-ÓØ˜˜S #˜X™Ñ'Ó'Ø�uÐ1°3Ð6Ñ7Ñ8Ó8Ø˜‘ÓØ˜U‘OÓ#Ø˜4‘.Ó Ø˜˜u d¨5¡kÐ1Ñ2Ñ3Ó3Ø˜˜e T¨%¡[Ð0Ñ1Ñ2Ó2Ø�T‰NÓØ�t˜C ˜H‘~Ñ&Ó&Ø˜T‘NÓ"ØÐ*Ñ+Ó+Ø  cÐ+;Ð&;Ñ <Ñ=Ó=Ø�S‰MÔrL   rP   c                   ó  — e Zd ZU dZee   ed<   eeee	f      ed<   ee	   ed<   ed   ed<   ee   ed<   ee
   ed<   ee   ed	<   eee
ee
   f      ed
<   eee
ee
   f      ed<   ee   ed<   ee   ed<   ee   ed<   eeeef      ed<   y)ÚVideosKwargsaü  
    Keyword arguments for video processing.

    Attributes:
        do_resize (`bool`):
            Whether to resize the image.
        size (`Dict[str, int]`, *optional*):
            Resize the shorter side of the input to `size["shortest_edge"]`.
        size_divisor (`int`, *optional*):
            The size by which to make sure both the height and width can be divided.
        resample (`PILImageResampling`, *optional*):
            Resampling filter to use if resizing the image.
        do_rescale (`bool`, *optional*):
            Whether to rescale the image by the specified scale `rescale_factor`.
        rescale_factor (`int` or `float`, *optional*):
            Scale factor to use if rescaling the image.
        do_normalize (`bool`, *optional*):
            Whether to normalize the image.
        image_mean (`float` or `List[float]`, *optional*):
            Mean to use if normalizing the image.
        image_std (`float` or `List[float]`, *optional*):
            Standard deviation to use if normalizing the image.
        do_pad (`bool`, *optional*):
            Whether to pad the image to the `(max_height, max_width)` of the images in the batch.
        do_center_crop (`bool`, *optional*):
            Whether to center crop the image.
        data_format (`ChannelDimension` or `str`, *optional*):
            The channel dimension format for the output image.
        input_data_format (`ChannelDimension` or `str`, *optional*):
            The channel dimension format for the input image.
    rQ   rR   rS   r   rU   rV   rW   rX   rY   rZ   r[   r]   r^   r_   N)rB   rC   rD   rE   r   rH   rG   ra   rI   rJ   rb   r
   rF   r   rK   rL   rM   rd   rd   Ì   sÃ   … ñð@ ˜‰~ÓØ
�4˜˜S˜‘>Ñ
"Ó"Ø˜3‘-ÓØÐ+Ñ,Ó,Ø˜‘ÓØ˜U‘OÓ#Ø˜4‘.Ó Ø˜˜u d¨5¡kÐ1Ñ2Ñ3Ó3Ø˜˜e T¨%¡[Ð0Ñ1Ñ2Ó2Ø�T‰NÓØ˜T‘NÓ"ØÐ*Ñ+Ó+Ø  cÐ+;Ð&;Ñ <Ñ=Ô=rL   rd   c                   ó´   — e Zd ZU dZee   ed<   eedee	   ed   eee	      f      ed<   eee
eef      ed<   ee   ed<   ee
   ed<   ee   ed<   ee
   ed	<   y
)ÚAudioKwargsaŸ  
    Keyword arguments for audio processing.

    Attributes:
        sampling_rate (`int`, *optional*):
            The sampling rate at which the `raw_speech` input was sampled.
        raw_speech (`np.ndarray`, `List[float]`, `List[np.ndarray]`, `List[List[float]]`):
            The sequence or batch of sequences to be padded. Each sequence can be a numpy array, a list of float
            values, a list of numpy arrays or a list of list of float values. Must be mono channel audio, not
            stereo, i.e. single float per timestep.
        padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*):
            Select a strategy to pad the returned sequences (according to the model's padding side and padding
            index) among:

            - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
                sequence if provided).
            - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum
                acceptable input length for the model if that argument is not provided.
            - `False` or `'do_not_pad'`
        max_length (`int`, *optional*):
            Maximum length of the returned list and optionally padding length (see above).
        truncation (`bool`, *optional*):
            Activates truncation to cut input sequences longer than *max_length* to *max_length*.
        pad_to_multiple_of (`int`, *optional*):
            If set, will pad the sequence to a multiple of the provided value.
        return_attention_mask (`bool`, *optional*):
            Whether or not [`~ASTFeatureExtractor.__call__`] should return `attention_mask`.
    Úsampling_ratez
np.ndarrayÚ
raw_speechr4   r6   r5   r9   r;   N)rB   rC   rD   rE   r   rJ   rG   r
   rF   rb   rH   rI   r   rK   rL   rM   rf   rf   ü   s€   … ñð: ˜C‘=Ó Ø˜˜|¨T°%©[¸$¸|Ñ:LÈdÐSWÐX]ÑS^ÑN_Ð_Ñ`ÑaÓaØ�e˜D # Ð6Ñ7Ñ8Ó8Ø˜‘ÓØ˜‘ÓØ  ™Ó%Ø# D™>Ô)rL   rf   c                   ó(   — e Zd ZU eeeef      ed<   y)ÚCommonKwargsÚreturn_tensorsN)rB   rC   rD   r   r
   rI   r   rG   rK   rL   rM   rj   rj   #  s   … Ø˜U 3¨
 ?Ñ3Ñ4Ô4rL   rj   c                   óÐ   — e Zd ZU dZi ej
                  ¥Zeed<   i ej
                  ¥Zeed<   i e	j
                  ¥Z
e	ed<   i ej
                  ¥Zeed<   i ej
                  ¥Zeed<   y)ÚProcessingKwargsa'  
    Base class for kwargs passing to processors.
    A model should have its own `ModelProcessorKwargs` class that inherits from `ProcessingKwargs` to provide:
        1) Additional typed keys and that this model requires to process inputs.
        2) Default values for existing keys under a `_defaults` attribute.
    New keys have to be defined as follows to ensure type hinting is done correctly.

    ```python
    # adding a new image kwarg for this model
    class ModelImagesKwargs(ImagesKwargs, total=False):
        new_image_kwarg: Optional[bool]

    class ModelProcessorKwargs(ProcessingKwargs, total=False):
        images_kwargs: ModelImagesKwargs
        _defaults = {
            "images_kwargs: {
                "new_image_kwarg": False,
            }
            "text_kwargs": {
                "padding": "max_length",
            },
        }

    ```

    For Python 3.8 compatibility, when inheriting from this class and overriding one of the kwargs,
    you need to manually update the __annotations__ dictionary. This can be done as follows:

    ```python
    class CustomProcessorKwargs(ProcessingKwargs, total=False):
        images_kwargs: CustomImagesKwargs

    CustomProcessorKwargs.__annotations__["images_kwargs"] = CustomImagesKwargs  # python 3.8 compatibility
    ```python

    Úcommon_kwargsÚtext_kwargsÚimages_kwargsÚvideos_kwargsÚaudio_kwargsN)rB   rC   rD   rE   rj   rG   rn   r/   ro   rP   rp   rd   rq   rf   rr   rK   rL   rM   rm   rm   '  s”   … ñ#ðJ#Ø
×
&Ñ
&ð#€M�<ó ðØ
×
$Ñ
$ð€K�ó ð#Ø
×
&Ñ
&ð#€M�<ó ð#Ø
×
&Ñ
&ð#€M�<ó ð!Ø
×
%Ñ
%ð!€L�+ô rL   rm   c                   óŒ   — e Zd ZU dZdZeee      ed<   dZ	eeee
e
f         ed<   dZee   ed<   dZee   ed<   dZee   ed<   y)	ÚTokenizerChatTemplateKwargsaU	  
    Keyword arguments for tokenizer's `apply_chat_template`, when it is called from within a processor.

    tools (`List[Dict]`, *optional*):
        A list of tools (callable functions) that will be accessible to the model. If the template does not
        support function calling, this argument will have no effect. Each tool should be passed as a JSON Schema,
        giving the name, description and argument types for the tool. See our
        [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#automated-function-conversion-for-tool-use)
        for more information.
    documents (`List[Dict[str, str]]`, *optional*):
        A list of dicts representing documents that will be accessible to the model if it is performing RAG
        (retrieval-augmented generation). If the template does not support RAG, this argument will have no
        effect. We recommend that each document should be a dict containing "title" and "text" keys. Please
        see the RAG section of the [chat templating guide](https://huggingface.co/docs/transformers/main/en/chat_templating#arguments-for-RAG)
        for examples of passing documents with chat templates.
    add_generation_prompt (bool, *optional*):
        If this is set, a prompt with the token(s) that indicate
        the start of an assistant message will be appended to the formatted output. This is useful when you want to generate a response from the model.
        Note that this argument will be passed to the chat template, and so it must be supported in the
        template for this argument to have any effect.
    continue_final_message (bool, *optional*):
        If this is set, the chat will be formatted so that the final
        message in the chat is open-ended, without any EOS tokens. The model will continue this message
        rather than starting a new one. This allows you to "prefill" part of
        the model's response for it. Cannot be used at the same time as `add_generation_prompt`.
    return_assistant_tokens_mask (`bool`, defaults to `False`):
        Whether to return a mask of the assistant generated tokens. For tokens generated by the assistant,
        the mask will contain 1. For user and system tokens, the mask will contain 0.
        This functionality is only available for chat templates that support it via the `{% generation %}` keyword.
    NÚtoolsÚ	documentsFÚadd_generation_promptÚcontinue_final_messageÚreturn_assistant_tokens_mask)rB   rC   rD   rE   ru   r   rF   ra   rG   rv   rI   rw   rH   rx   ry   rK   rL   rM   rt   rt   ^  se   … ñð> #'€Eˆ8�D˜‘JÑÓ&Ø04€Iˆx˜˜T # s (™^Ñ,Ñ-Ó4Ø,1Ð˜8 D™>Ó1Ø-2Ð˜H T™NÓ2Ø38Ð  (¨4¡.Ô8rL   rt   c                   óŠ   — e Zd ZU dZdZee   ed<   dZee	   ed<   dZ
ee   ed<   dZee   ed<   dZee   ed	<   d
Zee   ed<   y)ÚChatTemplateLoadKwargsaZ  
    Keyword arguments used to load multimodal data in processor chat templates.

    num_frames (`int`, *optional*):
        Number of frames to sample uniformly. If not passed, the whole video is loaded.
    video_load_backend (`str`, *optional*, defaults to `"pyav"`):
        The backend to use when loading the video which will be used only when there are videos in the conversation.
        Can be any of ["decord", "pyav", "opencv", "torchvision"]. Defaults to "pyav" because it is the only backend
        that supports all types of sources to load from.
    video_fps (`int`, *optional*):
        Number of frames to sample per second. Should be passed only when `num_frames=None`.
        If not specified and `num_frames==None`, all frames are sampled.
    sample_indices_fn (`Callable`, *optional*):
            A callable function that will return indices at which the video should be sampled. If the video has to be loaded using
            by a different sampling technique than provided by `num_frames` or `fps` arguments, one should provide their own `sample_indices_fn`.
            If not provided, simple uniformt sampling with fps is performed, otherwise `sample_indices_fn` has priority over other args.
            The function expects at input the all args along with all kwargs passed to `load_video` and should output valid
            indices at which the video should be sampled. For example:

            def sample_indices_fn(num_frames, fps, metadata, **kwargs):
                # add you sampling logic here ...
                return np.linspace(start_idx, end_idx, num_frames, dtype=int)
    NÚ
num_framesÚpyavÚvideo_load_backendÚ	video_fpsi€>  rg   Úsample_indices_fnFÚload_audio_from_video)rB   rC   rD   rE   r|   r   rJ   rG   r~   rI   r   rg   r€   r   r�   rH   rK   rL   rM   r{   r{   …  sa   … ñð0 !%€J�˜‘Ó$Ø(.Ð˜ ™Ó.Ø#€Iˆx˜‰}Ó#Ø#)€M�8˜C‘=Ó)Ø,0Ð�x Ñ)Ó0Ø,1Ð˜8 D™>Ô1rL   r{   c                   ó:   — e Zd ZU dZdZee   ed<   dZee   ed<   y)ÚProcessorChatTemplateKwargsa:  
    Keyword arguments for processor's `apply_chat_template`.

    tokenize (`bool`, *optional*, defaults to `False`):
        Whether to tokenize the output or not.
    return_dict (`bool`, defaults to `False`):
        Whether to return a dictionary with named outputs. Has no effect if tokenize is `False`.
    FÚtokenizeÚreturn_dictN)	rB   rC   rD   rE   r„   r   rH   rG   r…   rK   rL   rM   rƒ   rƒ   ¦  s%   … ñð  %€Hˆh�t‰nÓ$Ø"'€K�˜$‘Ô'rL   rƒ   c                   ó   — e Zd Zy)ÚAllKwargsForChatTemplateN)rB   rC   rD   rK   rL   rM   r‡   r‡   ´  s   „ àrL   r‡   c                   óò  — e Zd ZU dZddgZdgZg Zee   e	d<   dZ
dZdZg Zee   e	d<   d„ Zd	eeef   fd
„Zd	efd„Zdeeej*                  f   fd„Zd„ Zd-defd„Zedeeej*                  f   d	eeeef   eeef   f   fd„«       Zedeeef   fd„«       Z	 d.dedee   d	eeef   fd„Z e	 	 	 	 	 d/deeej*                  f   deeeej*                  f      dededeeeef      defd„«       Z!ed0d„«       Z"ed„ «       Z#e$d „ «       Z%e&d!„ «       Z'e$d"„ «       Z(d#„ Z)d$e*e*e+eef         d%e*e,   d&e*e-   d'e*e*e+ee.f         d(e/e0   f
d)„Z1	 d.d$eeeeef      eeeeef         f   dee   d*e/e2   d	efd+„Z3d1d,„Z4y)2ÚProcessorMixinza
    This is a mixin used to provide saving/loading functionality for all processor classes.
    Úfeature_extractorÚ	tokenizerÚchat_templateÚoptional_call_argsNÚvalid_kwargsc           
      óT  ‡ — ‰ j                   D ]  }t        ‰ ||j                  |d «      «       Œ! |D ]  }|‰ j                  vsŒt	        d|› d�«      ‚ t        |‰ j                  «      D ]  \  }}||v rt	        d|› d�«      ‚|||<   Œ t        |«      t        ‰ j                  «      k7  rJt        dt        ‰ j                  «      › ddj                  ‰ j                  «      › dt        |«      › d�«      ‚|j                  «       D ]¡  \  }}t        ‰ |› d	�«      }t        j                  ||«      }t        |t        «      rt        ˆ fd
„|D «       «      }n‰ j                  |«      }t        ||«      s(t	        dt!        |«      j"                  › d|› d|› d�«      ‚t        ‰ ||«       Œ£ y )NzUnexpected keyword argument ú.z!Got multiple values for argument zThis processor requires z arguments: z, z. Got z arguments instead.Ú_classc              3   óF   •K  — | ]  }|€Œ‰j                  |«      –— Œ y ­w©N©Úget_possibly_dynamic_module)Ú.0ÚnÚselfs     €rM   ú	<genexpr>z*ProcessorMixin.__init__.<locals>.<genexpr>ã  s"   øè ø€ Ò$nÈQÐ`aÑ`m T×%EÑ%EÀa×%HÑ$nùs   ƒ!‹!zReceived a z for argument z, but a z was expected.)Úoptional_attributesÚsetattrÚpopÚ
attributesÚ	TypeErrorÚzipÚlenÚ
ValueErrorÚjoinÚitemsÚgetattrÚAUTO_TO_BASE_CLASS_MAPPINGÚgetÚ
isinstanceÚtupler•   ÚtyperB   )	r˜   ÚargsÚkwargsÚoptional_attributeÚkeyÚargÚattribute_nameÚ
class_nameÚproper_classs	   `        rM   Ú__init__zProcessorMixin.__init__È  sÎ  ø€ ð #'×":Ñ":ò 	TÐÜ�DÐ,¨f¯j©jÐ9KÈTÓ.RÕSð	Tð ò 	GˆCØ˜$Ÿ/™/Ò)ÜÐ">¸s¸eÀ1Ð EÓFÐFð	Gô $' t¨T¯_©_Ó#=ò 	-ÑˆC�Ø Ñ'ÜÐ"CÀNÐCSÐSTÐ UÓVÐVà),��~Ò&ð		-ô ˆv‹;œ#˜dŸo™oÓ.Ò.ÜØ*¬3¨t¯©Ó+?Ð*@ÀÈTÏYÉYÐW[×WfÑWfÓMgÐLhÐhnÜ�t“9�+Ð0ð2óð ð $*§<¡<£>ò 	/ÑˆN˜CÜ  ¨.Ð)9¸Ð'@ÓAˆJä3×7Ñ7¸
ÀJÓOˆJÜ˜*¤eÔ,Ü$Ó$nÐR\Ô$nÓn‘à#×?Ñ?À
ÓK�ä˜c <Ô0ÜØ!¤$ s£)×"4Ñ"4Ð!5°^ÀNÐCSÐS[Ð\fÐ[gÐguÐvóð ô �D˜.¨#Õ.ñ	/rL   Úreturnc                 ój  — t        j                  | j                  «      }t        j                  | j
                  «      }|j                  }|D �cg c]  }|| j                  j                  vsŒ|‘Œ }}|dgz  }|j                  «       D ��ci c]  \  }}||v sŒ||“Œ }}}| j                  j                  |d<   d|v r|d= d|v r|d= d|v r|d= d|v r|d= |j                  «       D ��ci c]1  \  }}t        |t        «      s|j                  j                  dk(  s||“Œ3 }}}|S c c}w c c}}w c c}}w )z¹
        Serializes this instance to a Python dictionary.

        Returns:
            `Dict[str, Any]`: Dictionary of all the attributes that make up this processor instance.
        Úauto_mapÚprocessor_classr‹   Úimage_processorrŠ   rŒ   ÚBeamSearchDecoderCTC)ÚcopyÚdeepcopyÚ__dict__ÚinspectÚ	signaturer²   Ú
parametersÚ	__class__r�   r£   rB   r§   r   )r˜   ÚoutputÚsigÚattrs_to_saveÚxÚkÚvs          rM   Úto_dictzProcessorMixin.to_dictî  sE  € ô —‘˜tŸ}™}Ó-ˆô ×Ñ §¡Ó.ˆàŸ™ˆà$1ÖX˜q°Q¸d¿n¹n×>WÑ>WÒ5WšÐXˆÐXà˜*˜Ñ%ˆà#)§<¡<£>×H™4˜1˜a°Q¸-Ò5G�!�Q‘$ÐHˆÑHà$(§N¡N×$;Ñ$;ˆÐ Ñ!à˜&Ñ Ø�{Ð#Ø Ñ&ØÐ(Ð)Ø &Ñ(ØÐ*Ð+Ø˜fÑ$Ø�Ð'ð
 Ÿ™›÷
á��1Ü˜q¤.Ô1°Q·[±[×5IÑ5IÐMcÒ5cð ˆq‰Dð
ˆñ 
ð ˆùò1 Yùó Iùó
s   ÁD$Á-D$ÂD)ÂD)Ã)6D/c                 óX   — | j                  «       }t        j                  |dd¬«      dz   S )zÃ
        Serializes this instance to a JSON string.

        Returns:
            `str`: String containing all the attributes that make up this feature_extractor instance in JSON format.
        é   T©ÚindentÚ	sort_keysú
)rÆ   ÚjsonÚdumps)r˜   Ú
dictionarys     rM   Úto_json_stringzProcessorMixin.to_json_string  s'   € ð —\‘\“^ˆ
ä�z‰z˜*¨Q¸$Ô?À$ÑFÐFrL   Újson_file_pathc                 óˆ   — t        |dd¬«      5 }|j                  | j                  «       «       ddd«       y# 1 sw Y   yxY w)zÛ
        Save this instance to a JSON file.

        Args:
            json_file_path (`str` or `os.PathLike`):
                Path to the JSON file in which this processor instance's parameters will be saved.
        Úwúutf-8©ÚencodingN)ÚopenÚwriterÐ   )r˜   rÑ   Úwriters      rM   Úto_json_filezProcessorMixin.to_json_file!  s<   € ô �. #°Ô8ð 	0¸FØ�L‰L˜×,Ñ,Ó.Ô/÷	0÷ 	0ñ 	0ús	   � 8¸Ac                 óê   — | j                   D �cg c]  }d|› dt        t        | |«      «      › �‘Œ }}dj                  |«      }| j                  j
                  › d|› d| j                  «       › �S c c}w )Nz- z: rÌ   z:
z

)r�   Úreprr¤   r¢   r¿   rB   rÐ   )r˜   ÚnameÚattributes_reprs      rM   Ú__repr__zProcessorMixin.__repr__,  sv   € ØPT×P_ÑP_Ö`È˜R ˜v R¬¬W°T¸4Ó-@Ó(AÐ'BÒCÐ`ˆÐ`ØŸ)™) OÓ4ˆØ—.‘.×)Ñ)Ð*¨#¨oÐ->¸dÀ4×CVÑCVÓCXÐBYÐZÐZùò as   �"A0Úpush_to_hubc           	      óâ  — |j                  dd«      }|�<t        j                  dt        «       |j	                  dd«      �t        d«      ‚||d<   t        j                  |d¬«       |rr|j                  dd«      }|j                  d	|j                  t        j                  j                  «      d
   «      } | j                  |fi |¤Ž}| j                  |«      }| j                  �m| j                  D �cg c]  }t        | |«      ‘Œ }	}|	D �
cg c]   }
t!        |
t"        «      r|
j$                  n|
‘Œ" }}
|j'                  | «       t)        | ||¬«       | j                  D ]P  }t        | |«      }t+        |d«      r%|j-                  | j.                  j0                  «       |j3                  |«       ŒR | j                  �;| j                  D ],  }t        | |«      }t!        |t"        «      sŒ |j$                  d= Œ. t        j                  j5                  |t6        «      }t        j                  j5                  |d«      }t        j                  j5                  |d«      }| j9                  «       }| j:                  �Ä|j	                  dd«      rKt=        |dd¬«      5 }|j?                  | j:                  «       ddd«       t@        jC                  d|› �«       ngtE        jF                  d| j:                  idd¬«      dz   }t=        |dd¬«      5 }|j?                  |«       ddd«       t@        jC                  d|› �«       tI        |jK                  «       «      dhk7  r)| jM                  |«       t@        jC                  d|› �«       |r%| jO                  ||j	                  d«      ¬«       tI        |jK                  «       «      dhk(  rg S |gS c c}w c c}
w # 1 sw Y   �Œ#xY w# 1 sw Y   ŒÇxY w)aÚ  
        Saves the attributes of this processor (feature extractor, tokenizer...) in the specified directory so that it
        can be reloaded using the [`~ProcessorMixin.from_pretrained`] method.

        <Tip>

        This class method is simply calling [`~feature_extraction_utils.FeatureExtractionMixin.save_pretrained`] and
        [`~tokenization_utils_base.PreTrainedTokenizerBase.save_pretrained`]. Please refer to the docstrings of the
        methods above for more information.

        </Tip>

        Args:
            save_directory (`str` or `os.PathLike`):
                Directory where the feature extractor JSON file and the tokenizer files will be saved (directory will
                be created if it does not exist).
            push_to_hub (`bool`, *optional*, defaults to `False`):
                Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
                repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
                namespace).
            kwargs (`Dict[str, Any]`, *optional*):
                Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
        Úuse_auth_tokenNúrThe `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.ÚtokenúV`token` and `use_auth_token` are both specified. Please set only the argument `token`.T)Úexist_okÚcommit_messageÚrepo_idéÿÿÿÿ)ÚconfigÚ_set_processor_classrµ   úchat_template.jinjaúchat_template.jsonÚsave_raw_chat_templateFrÓ   rÔ   rÕ   zchat template saved in rŒ   rÈ   rÉ   rÌ   r¶   zprocessor saved in )rç   rä   )(rœ   ÚwarningsÚwarnÚFutureWarningr¦   r¡   ÚosÚmakedirsÚsplitÚpathÚsepÚ_create_repoÚ_get_files_timestampsÚ_auto_classr�   r¤   r§   r   Úinit_kwargsÚappendr   Úhasattrrë   r¿   rB   Úsave_pretrainedr¢   r   rÆ   rŒ   r×   rØ   ÚloggerÚinforÍ   rÎ   ÚsetÚkeysrÚ   Ú_upload_modified_files)r˜   Úsave_directoryrà   r«   râ   rç   rè   Úfiles_timestampsr¯   ÚattrsÚaÚconfigsÚ	attributeÚoutput_processor_fileÚoutput_raw_chat_template_fileÚoutput_chat_template_fileÚprocessor_dictrÙ   Úchat_template_json_strings                      rM   rý   zProcessorMixin.save_pretrained1  s¡  € ð0  Ÿ™Ð$4°dÓ;ˆàÐ%Ü�M‰Mð EÜôð �z‰z˜' 4Ó(Ð4Ü Ølóð ð -ˆF�7‰Oä
�‰�N¨TÕ2áØ#ŸZ™ZÐ(8¸$Ó?ˆNØ—j‘j ¨N×,@Ñ,@ÄÇÁÇÁÓ,MÈbÑ,QÓRˆGØ'�d×'Ñ'¨Ñ:°6Ñ:ˆGØ#×9Ñ9¸.ÓIÐð ×ÑÐ'ØIMÏÉÖY°~”W˜T >Õ2ÐYˆEÐYØafÖgÐ\]¬°AÔ7NÔ)O˜ŸšÐUVÑVÐgˆGÐgØ�N‰N˜4Ô Ü˜t ^¸GÕDà"Ÿo™oò 	6ˆNÜ  nÓ5ˆIô �yÐ"8Ô9Ø×.Ñ.¨t¯~©~×/FÑ/FÔGØ×%Ñ% nÕ5ð	6ð ×ÑÐ'à"&§/¡/ò :�Ü# D¨.Ó9�	Ü˜iÔ)@ÕAØ!×-Ñ-¨jÑ9ð:ô !#§¡§¡¨^¼^Ó LÐÜ(*¯©¯©°^ÐEZÓ([Ð%Ü$&§G¡G§L¡L°ÐAUÓ$VÐ!àŸ™›ˆð ×ÑÐ)Ø�z‰zÐ2°EÔ:ÜÐ7¸ÀwÔOð 5ÐSYØ—L‘L ×!3Ñ!3Ô4÷5ä—‘Ð5Ð6SÐ5TÐUÕVô —J‘J °×1CÑ1CÐDÈQÐZ^Ô_ÐbfÑfð *ô Ð3°SÀ7ÔKð <ÈvØ—L‘LÐ!:Ô;÷<ä—‘Ð5Ð6OÐ5PÐQÔRô ˆ~×"Ñ"Ó$Ó%Ð*;Ð)<Ò<Ø×ÑÐ3Ô4Ü�K‰KÐ-Ð.CÐ-DÐEÔFáØ×'Ñ'ØØØ Ø-Ø—j‘j Ó)ð (ô ô ˆ~×"Ñ"Ó$Ó%Ð*;Ð)<Ò<ØˆIØ%Ð&Ð&ùòw ZùÚg÷<5ñ 5ú÷<ð <ús$   Ã6OÄ%OÊOÌO%ÏO"Ï%O.Úpretrained_model_name_or_pathc                 óœ  — |j                  dd«      }|j                  dd«      }|j                  dd«      }|j                  dd«      }|j                  dd«      }|j                  dd«      }|j                  d	d«      }	|j                  d
d«      }
|j                  dd«      }|j                  dd«      }d|dœ}|�||d<   t        «       r|st        j                  d«       d}t	        |«      }t
        j                  j                  |«      }t
        j                  j                  |«      r$t
        j                  j                  |t        «      }t
        j                  j                  |«      r	|}d}d}d}nmt        |«      r|}t        |«      }d}d}nPt        }d}d}	 t        ||||||||||	|
d¬«      }t        ||||||||||	|
d¬«      }t        ||||||||||	|
d¬«      }|�,t!        |d¬«      5 }|j#                  «       }ddd«       |d<   nE|�Ct!        |d¬«      5 }|j#                  «       }ddd«       t%        j&                  «      d   }||d<   |€i }d|v rd|j                  d«      i}||fS 	 t!        |d¬«      5 }|j#                  «       }ddd«       t%        j&                  «      }|rt        j                  d|› �«       nt        j                  d› d |› �«       d|v r|d   �t        j+                  d!«       d|v r|j                  d«      |d<   |s,d"|v rt-        |d"   |«      |d"<   d#|v rt/        |d#   |«      |d#<   ||fS # t        $ r ‚ t        $ r t        d|› d|› dt        › d�«      ‚w xY w# 1 sw Y   �Œ}xY w# 1 sw Y   �Œ\xY w# 1 sw Y   �ŒxY w# t$        j(                  $ r t        d|› d�«      ‚w xY w)$a  
        From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a
        processor of type [`~processing_utils.ProcessingMixin`] using `from_args_and_dict`.

        Parameters:
            pretrained_model_name_or_path (`str` or `os.PathLike`):
                The identifier of the pre-trained checkpoint from which we want the dictionary of parameters.
            subfolder (`str`, *optional*, defaults to `""`):
                In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can
                specify the folder name here.

        Returns:
            `Tuple[Dict, Dict]`: The dictionary(ies) that will be used to instantiate the processor object.
        Ú	cache_dirNÚforce_downloadFÚresume_downloadÚproxiesrä   Úlocal_files_onlyÚrevisionÚ	subfolderÚ Ú_from_pipelineÚ
_from_autoÚ	processor)Ú	file_typeÚfrom_auto_classÚusing_pipelinez+Offline mode: forcing local_files_only=TrueTrí   rì   )
r  r  r  r  r  rä   Ú
user_agentr  r  Ú%_raise_exceptions_for_missing_entrieszCan't load processor for 'zœ'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'z2' is the correct path to a directory containing a z filerÔ   rÕ   rŒ   z"It looks like the config file at 'z' is not a valid JSON file.zloading configuration file z from cache at z¢Chat templates should be in a 'chat_template.jinja' file but found key='chat_template' in the processor's config. Make sure to move your template to its own file.rµ   Úcustom_pipelines)rœ   r$   rþ   rÿ   rI   rò   rõ   Úisdirr¢   r   Úisfiler%   r#   r    ÚOSErrorÚ	Exceptionr×   ÚreadrÍ   ÚloadsÚJSONDecodeErrorÚwarning_oncer   r   )Úclsr  r«   r  r  r  r  rä   r  r  r  Úfrom_pipeliner  r  Úis_localÚprocessor_fileÚresolved_processor_fileÚresolved_chat_template_fileÚresolved_raw_chat_template_fileÚchat_template_fileÚraw_chat_template_fileÚreaderrŒ   Útextr  s                            rM   Úget_processor_dictz!ProcessorMixin.get_processor_dict�  su  € ð$ —J‘J˜{¨DÓ1ˆ	ØŸ™Ð$4°eÓ<ˆØ Ÿ*™*Ð%6¸Ó=ˆØ—*‘*˜Y¨Ó-ˆØ—
‘
˜7 DÓ)ˆØ!Ÿ:™:Ð&8¸%Ó@ÐØ—:‘:˜j¨$Ó/ˆØ—J‘J˜{¨BÓ/ˆ	àŸ
™
Ð#3°TÓ:ˆØ Ÿ*™* \°5Ó9ˆà#.À?ÑSˆ
ØÐ$Ø+8ˆJÐ'Ñ(äÔÑ%5Ü�K‰KÐEÔFØ#Ðä(+Ð,IÓ(JÐ%Ü—7‘7—=‘=Ð!>Ó?ˆÜ�7‰7�=‰=Ð6Ô7ÜŸW™WŸ\™\Ð*GÌÓXˆNä�7‰7�>‰>Ð7Ô8Ø&CÐ#à*.Ð'Ø.2Ð+Ø‰HÜÐ8Ô9Ø:ˆNÜ&2Ð3PÓ&QÐ#à*.Ð'Ø.2Ñ+ä+ˆNØ!5ÐØ%:Ð"ð<ä*5Ø1Ø"Ø'Ø#1Ø#Ø$3Ø%5ØØ)Ø%Ø'Ø:?ô+Ð'ô$ /:Ø1Ø&Ø'Ø#1Ø#Ø$3Ø%5ØØ)Ø%Ø'Ø:?ô/Ð+ô 3>Ø1Ø*Ø'Ø#1Ø#Ø$3Ø%5ØØ)Ø%Ø'Ø:?ô3Ð/ð8 +Ð6ÜÐ5ÀÔHð .ÈFØ &§¡£�÷.à&3ˆF�?Ò#Ø(Ð4ÜÐ1¸GÔDð %ÈØ—{‘{“}�÷%ä ŸJ™J tÓ,¨_Ñ=ˆMØ&3ˆF�?Ñ#ð #Ð*àˆNØ &Ñ(Ø"1°6·:±:¸oÓ3NÐ!O�Ø! 6Ð)Ð)ð	uäÐ-¸Ô@ð %ÀFØ—{‘{“}�÷%ä!ŸZ™Z¨Ó-ˆNñ
 Ü�K‰KÐ5Ð6MÐ5NÐOÕPä�K‰KÐ5°nÐ5EÀ_ÐUlÐTmÐnÔoà˜nÑ,°ÀÑ1PÐ1\Ü×Ñð^ôð
 ˜fÑ$Ø.4¯j©j¸Ó.IˆN˜?Ñ+áØ˜^Ñ+Ü-GØ" :Ñ.Ð0Mó.�˜zÑ*ð " ^Ñ3Ü5WØ"Ð#5Ñ6Ð8Uó6�Ð1Ñ2ð ˜vÐ%Ð%øôI ò ð Üò äØ0Ð1NÐ0Oð P9à9VÐ8Wð X/Ü/=Ð.>¸eðEóð ðú÷.ñ .ú÷%ñ %ú÷$%ñ %ûô ×#Ñ#ò 	uÜÐ>Ð?VÐ>WÐWrÐsÓtÐtð	uúsI   Æ!AM Ç5NÈ#NÉ9N( ÊNÊN( Í,M>ÎNÎNÎN%Î N( Î(#Or  c                 óœ  — |j                  «       }|j                  dd«      }d|v r|d= d|v r|d= | j                  || j                  ¬«      } | |i |¤Ž}t	        |j                  «       «      D ]+  }t        ||«      sŒt        |||j                  |«      «       Œ- |j                  |«       t        j                  d|› �«       |r||fS |S )a´  
        Instantiates a type of [`~processing_utils.ProcessingMixin`] from a Python dictionary of parameters.

        Args:
            processor_dict (`Dict[str, Any]`):
                Dictionary that will be used to instantiate the processor object. Such a dictionary can be
                retrieved from a pretrained checkpoint by leveraging the
                [`~processing_utils.ProcessingMixin.to_dict`] method.
            kwargs (`Dict[str, Any]`):
                Additional parameters from which to initialize the processor object.

        Returns:
            [`~processing_utils.ProcessingMixin`]: The processor object instantiated from those
            parameters.
        Úreturn_unused_kwargsFr¶   rµ   )Úprocessor_configrŽ   z
Processor )r¹   rœ   Úvalidate_init_kwargsrŽ   r   r  rü   r›   Úupdaterþ   rÿ   )r)  rª   r  r«   r6  Úunused_kwargsr  r­   s           rM   Úfrom_args_and_dictz!ProcessorMixin.from_args_and_dictO  sá   € ð" (×,Ñ,Ó.ˆØ%Ÿz™zÐ*@À%ÓHÐð  Ñ.ØÐ0Ð1à˜Ñ'Ø˜zÐ*à×0Ñ0À.Ð_b×_oÑ_oÐ0ÓpˆÙ˜Ð0 Ñ0ˆ	ô �v—{‘{“}Ó%ò 	9ˆCÜ�y #Õ&Ü˜	 3¨¯
©
°3«Õ8ð	9ð 	�‰�mÔ$Ü�‰�j  Ð,Ô-ÙØ˜fÐ$Ð$àÐrL   ÚModelProcessorKwargsÚtokenizer_init_kwargsc           	      óø  ‡— i i i i i dœ}i i i i i dœŠh d£}t        «       }‰D ]™  }|j                  j                  |i «      j                  «       ‰|<   |j                  |   j                  j                  «       D ]@  }||v sŒt        | j                  |«      rt        | j                  |«      n||   }	|	‰|   |<   ŒB Œ› |j                  ‰«       t        |«      t        |«      z
  }
|D ]ª  }|j                  |   j                  j                  «       D ]~  }||v r0||   j                  |d«      }|dk7  r/||
v r+t        d|› d|› d�«      ‚||v r|j                  |d«      }nd}t        |t        «      r|dk7  sŒf|||   |<   |j                  |«       Œ€ Œ¬ t        ˆfd„|D «       «      rT|j!                  «       D ]@  \  }}|‰v sŒ|j!                  «       D ]#  \  }}||vsŒ|||   |<   |j                  |«       Œ% ŒB n_|D ]Z  }||vsŒ||j                  d   j                  j                  «       v r||   |d   |<   Œ=||vsŒBt"        j%                  d	|› d
�«       Œ\ |D ]  }||   j                  |d   «       Œ |S )a  
        Method to merge dictionaries of kwargs cleanly separated by modality within a Processor instance.
        The order of operations is as follows:
            1) kwargs passed as before have highest priority to preserve BC.
                ```python
                high_priority_kwargs = {"crop_size" = {"height": 222, "width": 222}, "padding" = "max_length"}
                processor(..., **high_priority_kwargs)
                ```
            2) kwargs passed as modality-specific kwargs have second priority. This is the recommended API.
                ```python
                processor(..., text_kwargs={"padding": "max_length"}, images_kwargs={"crop_size": {"height": 222, "width": 222}}})
                ```
            3) kwargs passed during instantiation of a modality processor have fourth priority.
                ```python
                tokenizer = tokenizer_class(..., {"padding": "max_length"})
                image_processor = image_processor_class(...)
                processor(tokenizer, image_processor) # will pass max_length unless overridden by kwargs at call
                ```
            4) defaults kwargs specified at processor level have lowest priority.
                ```python
                class MyProcessingKwargs(ProcessingKwargs, CommonKwargs, TextKwargs, ImagesKwargs, total=False):
                    _defaults = {
                        "text_kwargs": {
                            "padding": "max_length",
                            "max_length": 64,
                        },
                    }
                ```
        Args:
            ModelProcessorKwargs (`ProcessingKwargs`):
                Typed dictionary of kwargs specifically required by the model passed.
            tokenizer_init_kwargs (`Dict`, *optional*):
                Dictionary of kwargs the tokenizer was instantiated with and need to take precedence over defaults.

        Returns:
            output_kwargs (`Dict`):
                Dictionary of per-modality kwargs to be passed to each modality-specific processor.

        )ro   rp   rr   rq   rn   >   r3  ÚaudioÚimagesÚvideosÚ	__empty__zKeyword argument z+ was passed two times:
in a dictionary for z and as a **kwarg.c              3   ó&   •K  — | ]  }|‰v –— Œ
 y ­wr“   rK   )r–   r­   Údefault_kwargss     €rM   r™   z/ProcessorMixin._merge_kwargs.<locals>.<genexpr>ä  s   øè ø€ Ò7¨ˆs�nÔ$Ñ7ùs   ƒrn   zKeyword argument `zA` is not a valid argument for this processor and will be ignored.)r   Ú	_defaultsr¦   r¹   rG   r  rü   r‹   r¤   r9  rœ   r¡   r§   rI   ÚaddÚanyr£   rþ   r(  )r˜   r<  r=  r«   Úoutput_kwargsÚpossible_modality_keywordsÚ	used_keysÚmodalityÚmodality_keyÚvalueÚnon_modality_kwargsÚkwarg_valueÚsubdictÚsubkeyÚsubvaluer­   rD  s                   @rM   Ú_merge_kwargszProcessorMixin._merge_kwargsz  s  ø€ ð^ ØØØØñ
ˆð ØØØØñ
ˆò &KÐ"Ü“Eˆ	ð 'ò 	CˆHØ';×'EÑ'E×'IÑ'IÈ(ÐTVÓ'W×'\Ñ'\Ó'^ˆN˜8Ñ$à 4× DÑ DÀXÑ N× ^Ñ ^× cÑ cÓ eò C�àÐ#8Ò8ô # 4§>¡>°<Ô@ô   §¡°Ô=à2°<Ñ@ð ð
 >C�N 8Ñ,¨\Ò:ñCð	Cð 	×Ñ˜^Ô,ô " &›k¬C°Ó,>Ñ>ÐØ%ò 	0ˆHØ 4× DÑ DÀXÑ N× ^Ñ ^× cÑ cÓ eò 0�à˜vÑ%Ø"(¨Ñ"2×"6Ñ"6°|À[Ó"Q�Kà" kÒ1°lÐFYÑ6YÜ(Ø/°¨~ð >3Ø3;°*Ð<NðPóð ð " VÑ+ð #)§*¡*¨\¸;Ó"G‘Kà"-�KÜ! +¬sÔ3°{ÀkÓ7QØ<G�M (Ñ+¨LÑ9Ø—M‘M ,Õ/ñ%0ð	0ô, Ó7°Ô7Ô7à%+§\¡\£^ò 2Ñ!�˜'Ø˜~Ò-Ø,3¯M©M«Oò 2Ñ(˜ Ø!¨Ò2Ø>F˜M¨(Ñ3°FÑ;Ø%ŸM™M¨&Õ1ñ2ñ2ð ò �Ø˜iÒ'ØÐ2×BÑBÀ?ÑS×cÑc×hÑhÓjÑjØ>DÀS¹k˜ oÑ6°sÒ;ØÐ$>Ò>Ü×+Ñ+Ø0°°Ð5vÐwõðð &ò 	KˆHØ˜(Ñ#×*Ñ*¨=¸Ñ+IÕJð	KàÐrL   r  r  r  rä   r  c           	      óÄ  — ||d<   ||d<   ||d<   ||d<   |j                  dd«      }|�)t        j                  dt        «       |�t	        d«      ‚|}|�||d	<    | j
                  |fi |¤Ž}	 | j                  |fi |¤Ž\  }
}|
j                  |j                  «       D ��ci c]  \  }}||
j                  «       v sŒ||“Œ c}}«        | j                  |	|
fi |¤ŽS c c}}w )
a[  
        Instantiate a processor associated with a pretrained model.

        <Tip>

        This class method is simply calling the feature extractor
        [`~feature_extraction_utils.FeatureExtractionMixin.from_pretrained`], image processor
        [`~image_processing_utils.ImageProcessingMixin`] and the tokenizer
        [`~tokenization_utils_base.PreTrainedTokenizer.from_pretrained`] methods. Please refer to the docstrings of the
        methods above for more information.

        </Tip>

        Args:
            pretrained_model_name_or_path (`str` or `os.PathLike`):
                This can be either:

                - a string, the *model id* of a pretrained feature_extractor hosted inside a model repo on
                  huggingface.co.
                - a path to a *directory* containing a feature extractor file saved using the
                  [`~SequenceFeatureExtractor.save_pretrained`] method, e.g., `./my_model_directory/`.
                - a path or url to a saved feature extractor JSON *file*, e.g.,
                  `./my_model_directory/preprocessor_config.json`.
            **kwargs
                Additional keyword arguments passed along to both
                [`~feature_extraction_utils.FeatureExtractionMixin.from_pretrained`] and
                [`~tokenization_utils_base.PreTrainedTokenizer.from_pretrained`].
        r  r  r  r  râ   Nrã   rå   rä   )rœ   rï   rð   rñ   r¡   Ú_get_arguments_from_pretrainedr4  r9  r£   r  r;  )r)  r  r  r  r  rä   r  r«   râ   rª   r  rÄ   rÅ   s                rM   Úfrom_pretrainedzProcessorMixin.from_pretrainedü  s  € ðN (ˆˆ{ÑØ#1ˆÐÑ Ø%5ˆÐ!Ñ"Ø%ˆˆzÑàŸ™Ð$4°dÓ;ˆØÐ%Ü�M‰Mð EÜôð Ð Ü Ølóð ð #ˆEàÐØ#ˆF�7‰Oà1ˆs×1Ñ1Ð2OÑZÐSYÑZˆØ!7 ×!7Ñ!7Ð8UÑ!`ÐY_Ñ!`Ñˆ˜Ø×Ñ°·±³×]©¨¨1À!À~×GZÑGZÓG\ÒB\˜q !™tÓ]Ô^Ø%ˆs×%Ñ% d¨NÑE¸fÑEÐEùó ^s   Â C
Â;C
c                 ó�   — t        |t        «      s|j                  }ddlmc m} t        ||«      st        |› d�«      ‚|| _        y)a  
        Register this class with a given auto class. This should only be used for custom feature extractors as the ones
        in the library are already mapped with `AutoProcessor`.

        <Tip warning={true}>

        This API is experimental and may have some slight breaking changes in the next releases.

        </Tip>

        Args:
            auto_class (`str` or `type`, *optional*, defaults to `"AutoProcessor"`):
                The auto class to register this new feature extractor with.
        r   Nz is not a valid auto class.)	r§   rI   rB   Útransformers.models.autoÚmodelsÚautorü   r¡   rù   )r)  Ú
auto_classÚauto_modules      rM   Úregister_for_auto_classz&ProcessorMixin.register_for_auto_class<  sC   € ô  ˜*¤cÔ*Ø#×,Ñ,ˆJç6Ð6ä�{ JÔ/Ü 
˜|Ð+FÐGÓHÐHà$ˆ�rL   c                 ó¢  ‡ — g }‰ j                   D ]¼  }t        ‰ |› d�«      }t        |t        «      rht        ˆ fd„|D «       «      }|dk(  r*|j	                  dd«      }|€(t
        j                  d«       n|j	                  dd«      }|r|d   �|d   }n|d	   }n‰ j                  |«      }|j                   |j                  |fi |¤Ž«       Œ¾ |S )
a�  
        Identify and instantiate the subcomponents of Processor classes, like image processors and
        tokenizers. This method uses the Processor attributes like `tokenizer_class` to figure out what class those
        subcomponents should be. Note that any subcomponents must either be library classes that are accessible in
        the `transformers` root, or they must be custom code that has been registered with the relevant autoclass,
        via methods like `AutoTokenizer.register()`. If neither of these conditions are fulfilled, this method
        will be unable to find the relevant subcomponent class and will raise an error.
        r‘   c              3   óH   •K  — | ]  }|�‰j                  |«      nd –— Œ y ­wr“   r”   )r–   r—   r)  s     €rM   r™   z@ProcessorMixin._get_arguments_from_pretrained.<locals>.<genexpr>d  s'   øè ø€ ÒrÐbcÀaÀm × ?Ñ ?ÀÔ BÐY]Ó ]Ñrùs   ƒ"r·   Úuse_fastNaC  Using a slow image processor as `use_fast` is unset and a slow processor was saved with this model. `use_fast=True` will be the default behavior in v4.52, even if the model was saved with a slow processor. This will result in minor differences in outputs. You'll still be able to use a slow processor with `use_fast=False`.Tr   r   )
r�   r¤   r§   r¨   r¦   rþ   r(  r•   rû   rV  )	r)  r  r«   rª   r¯   r°   Úclassesr`  Úattribute_classs	   `        rM   rU  z-ProcessorMixin._get_arguments_from_pretrainedV  sé   ø€ ð ˆØ!Ÿn™nò 	bˆNÜ  ¨Ð(8¸Ð&?Ó@ˆJÜ˜*¤eÔ,ÜÓrÐgqÔrÓr�Ø!Ð%6Ò6à%Ÿz™z¨*°dÓ;�HØÐ'Ü×+Ñ+ðTõð  &Ÿz™z¨*°dÓ;�HÙ ¨¡
Ð 6Ø&-¨a¡j‘Oà&-¨a¡j‘Oà"%×"AÑ"AÀ*Ó"M�à�K‰KÐ7˜×7Ñ7Ð8UÑ`ÐY_Ñ`Õað-	bð. ˆrL   c                 óž  — t        t        | «      rt        t        | «      S t        j                  t        j                  t        j
                  g}|D ]k  }|j                  j                  «       D ]L  }t        |t        «      r"|D ]  }|€Œ|j                  | k(  sŒ|c c c S  Œ5|€Œ8|j                  | k(  sŒH|c c S  Œm t        d| › d�«      ‚)NzCould not find module zž in `transformers`. If this is a custom class, it should be registered using the relevant `AutoClass.register()` function so that other functions can find it!)rü   Útransformers_moduler¤   ÚIMAGE_PROCESSOR_MAPPINGÚTOKENIZER_MAPPINGÚFEATURE_EXTRACTOR_MAPPINGÚ_extra_contentÚvaluesr§   r¨   rB   r¡   )Úmodule_nameÚlookup_locationsÚlookup_locationÚcustom_classÚcustom_subclasss        rM   r•   z*ProcessorMixin.get_possibly_dynamic_modulez  sÛ   € äÔ&¨Ô4ÜÔ.°Ó<Ð<ä×7Ñ7Ü×1Ñ1Ü×9Ñ9ð
Ðð
  0ò 	ˆOØ /× >Ñ >× EÑ EÓ Gò (�Ü˜l¬EÔ2Ø+7ò 3˜Ø*Ñ6¸?×;SÑ;SÐWbÓ;bØ#2Ö2ñ3ð "Ñ-°,×2GÑ2GÈ;Ó2VØ'Ô'ñ(ð	ô Ø(¨¨ð 6/ð 0óð rL   c                 óN   — t        | | j                  d   «      }t        |dd «      S )Nr   Úmodel_input_names)r¤   r�   )r˜   Úfirst_attributes     rM   rp  z ProcessorMixin.model_input_names’  s'   € ä! $¨¯©¸Ñ(:Ó;ˆÜ�Ð(;¸TÓBÐBrL   c                 óŒ   — | j                  «       }i }t        |«      t        |«      z
  }|r|D �ci c]  }|| |   “Œ
 }}|S c c}w r“   )r  r   )r7  rŽ   Úkwargs_from_configr:  Úunused_keysrÄ   s         rM   r8  z#ProcessorMixin.validate_init_kwargs—  sX   € à-×2Ñ2Ó4ÐØˆÜÐ,Ó-´°LÓ0AÑAˆÙØ=HÖI¸˜QÐ 0°Ñ 3Ñ3ÐIˆMÐIØÐùò Js   °Ac           
      óx  — t        |«      rt        j                  d«       t        |«      t        | j                  «      kD  rJt	        dt        | j                  «      › ddj                  | j                  «      › dt        |«      › d�«      ‚t        || j                  «      D ��ci c]  \  }}||“Œ
 c}}S c c}}w )aŒ  
        Matches optional positional arguments to their corresponding names in `optional_call_args`
        in the processor class in the order they are passed to the processor call.

        Note that this should only be used in the `__call__` method of the processors with special
        arguments. Special arguments are arguments that aren't `text`, `images`, `audio`, nor `videos`
        but also aren't passed to the tokenizer, image processor, etc. Examples of such processors are:
            - `CLIPSegProcessor`
            - `LayoutLMv2Processor`
            - `OwlViTProcessor`

        Also note that passing by position to the processor call is now deprecated and will be disallowed
        in future versions. We only have this for backward compatibility.

        Example:
            Suppose that the processor class has `optional_call_args = ["arg_name_1", "arg_name_2"]`.
            And we define the call method as:
            ```python
            def __call__(
                self,
                text: str,
                images: Optional[ImageInput] = None,
                *arg,
                audio=None,
                videos=None,
            )
            ```

            Then, if we call the processor as:
            ```python
            images = [...]
            processor("What is common in these images?", images, arg_value_1, arg_value_2)
            ```

            Then, this method will return:
            ```python
            {
                "arg_name_1": arg_value_1,
                "arg_name_2": arg_value_2,
            }
            ```
            which we could then pass as kwargs to `self._merge_kwargs`
        z•Passing positional arguments to the processor call is now deprecated and will be disallowed in v4.47. Please pass all arguments as keyword arguments.zExpected *at most* zK optional positional arguments in processor callwhich will be matched with ú z+ in the order they are passed.However, got zˆ positional arguments instead.Please pass all arguments as keyword arguments instead (e.g. `processor(arg_name_1=..., arg_name_2=...))`.)r    rï   rð   r�   r¡   r¢   rŸ   )r˜   rª   Ú	arg_valueÚarg_names       rM   Ú'prepare_and_validate_optional_call_argsz6ProcessorMixin.prepare_and_validate_optional_call_args   s¼   € ôX ˆtŒ9Ü�M‰MðBôô ˆt‹9”s˜4×2Ñ2Ó3Ò3ÜØ%¤c¨$×*AÑ*AÓ&BÐ%Cð D.Ø.1¯h©h°t×7NÑ7NÓ.OÐ-Pð Q Ü # D£	˜{ð +}ð}óð ô @CÀ4È×I`ÑI`Ó?a×bÑ(;¨	°8�˜)Ñ#ÓbÐbùÓbs   Â%B6ÚconversationÚbatch_imagesÚbatch_videosÚbatch_video_metadataÚmm_load_kwargsc                 ó   — |S )a)  
        Used within `apply_chat_template` when a model has a special way to process conversation history. For example,
        video models might want to specify in the prompt the duration of video or which frame indices at which timestamps
        were sampled. This information cannot be accessed before the video is loaded.

        For most models it is a no-op, and must be overridden by model processors which require special processing.

        Args:
            conversation (`List[Dict, str, str]`):
                The conversation to process. Always comes in batched format.
            batch_images (`List[List[ImageInput]]`):
                Batch of images that were loaded from url/path defined in the conversation. The images
                are ordered in the same way as in the conversation. Comes in nested list format, one list of `PIL` images
                per batch.
            batch_videos (`List[List[ImageInput]]`):
                Batch of videos that were loaded from url/path defined in the conversation. The videos
                are ordered in the samm way as in the conversation. Comes in nested list format, one list of 4D video arrays
                per batch.
            batch_video_metadata (`List[List[Dict[[str, any]]]]`):
                Batch of metadata returned from loading videos. That includes video fps, duration and total number of framer in original video.
                Metadata are ordered in the same way as `batch_videos`. Comes in nested list format, one list of 4D video arrays
                per batch.

        rK   )r˜   rz  r{  r|  r}  r~  s         rM   Ú#_process_messages_for_chat_templatez2ProcessorMixin._process_messages_for_chat_templateÚ  s   € ð@ ÐrL   r«   c                 óV  — |€$| j                   �| j                   }nt        d«      ‚i }t        j                  j	                  «       D ]*  }t        t        |d«      }|j                  ||«      }|||<   Œ, i }t        j                  j	                  «       D ]*  }	t        t        |	d«      }|j                  |	|«      }|||	<   Œ, t        |t        t        f«      r-t        |d   t        t        f«      st        |d   d«      rd}
|}nd}
|g}|j                  dd«      }|j                  dd«      }|�rHg g }}g }g }|D �]#  }g g }}g }|D �]Û  }|d   D �cg c]  }|d	   d
v sŒ|‘Œ }}|d   D ��cg c]  }dD ]  }||v r|d	   dk(  r||   ‘Œ Œ }}}|D ��cg c]  }dD ]  }||v r|d	   dk(  r||   ‘Œ Œ }}}|D ��cg c]  }dD ]  }||v r|d	   dk(  r||   ‘Œ Œ }}}|D ]  }|j                  t        |«      «       Œ |d   s'|D ]!  }|j                  t        ||d   ¬«      «       Œ# n&|D ]!  }|j                  t        ||d   ¬«      «       Œ# |D ]Î  }t        |t        t        f«      rut        |d   t        «      rb|D �cg c]*  }t!        j"                  t        |«      «      j$                  ‘Œ, }}t!        j&                  |«      }d} t(        j+                  d«       nt-        ||d   |d   |d   |d   ¬«      \  }} |j                  |«       |j                  | «       ŒÐ �ŒÞ |r|j                  |«       |s�Œ|j                  |«       |j                  |«       �Œ&  | j.                  |f|||dœ|¤Ž} | j0                  j2                  |f|dddœ|¤Ž}!|
s|!d   }!|rk|
r|!d   n|!}"| j0                  j4                  �*|"j7                  | j0                  j4                  «      rd|d<    | d|!r|ndr|ndr|nddœ|¤Ž}#|r|#S |#d   S |!S c c}w c c}}w c c}}w c c}}w c c}w ) aå  
        Similar to the `apply_chat_template` method on tokenizers, this method applies a Jinja template to input
        conversations to turn them into a single tokenizable string.

        The input is expected to be in the following format, where each message content is a list consisting of text and
        optionally image or video inputs. One can also provide an image, video, URL or local path which will be used to form
        `pixel_values` when `return_dict=True`. If not provided, one will get only the formatted text, optionally tokenized text.

        conversation = [
            {
                "role": "user",
                "content": [
                    {"type": "image", "image": "https://www.ilankelman.org/stopsigns/australia.jpg"},
                    {"type": "text", "text": "Please describe this image in detail."},
                ],
            },
        ]

        Args:
            conversation (`Union[List[Dict, [str, str]], List[List[Dict[str, str]]]]`):
                The conversation to format.
            chat_template (`Optional[str]`, *optional*):
                The Jinja template to use for formatting the conversation. If not provided, the tokenizer's
                chat template is used.
        NzâNo chat template is set for this processor. Please either set the `chat_template` attribute, or provide a chat template as an argument. See https://huggingface.co/docs/transformers/main/en/chat_templating for more information.r   ÚcontentTFr„   r…   r©   )ÚimageÚvideo)r?  Úurlrõ   r?  )rƒ  r…  rõ   Úbase64rƒ  )r„  r…  rõ   r„  r�   rg   )rg   zÚWhen loading the video from list of images, we cannot infer metadata such as `fps` or `duration`. If your model uses this metadata during processing, please load the whole video and let the model sample frames instead.r|   r   r~   r€   )r|   ÚfpsÚbackendr€   )r{  r|  r}  )rŒ   r„   r…   r3   )r3  r@  rA  r?  Ú	input_idsrK   )rŒ   r¡   rt   rG   r  r¤   rœ   r{   r§   rF   r¨   rü   rû   r   r   rI   ÚnpÚarrayÚTÚstackrþ   Úwarningr   r€  r‹   Úapply_chat_templateÚ	bos_tokenÚ
startswith)$r˜   rz  rŒ   r«   Útokenizer_template_kwargsÚtokenizer_keyÚdefault_valuerM  r~  Úmm_load_keyÚ
is_batchedÚconversationsr„   r…   r{  r|  Úbatch_audiosr}  r@  rA  Úvideo_metadataÚmessager‚  Úvisualsr­   Úaudio_fnamesÚvision_infoÚimage_fnamesÚvideo_fnamesÚfnameÚimage_fnamer„  ÚmetadataÚpromptÚsingle_promptÚouts$                                       rM   r�  z"ProcessorMixin.apply_chat_templateü  s5  € ð@ Ð Ø×!Ñ!Ð-Ø $× 2Ñ 2‘ä ðmóð ð %'Ð!Ü8×HÑH×MÑMÓOò 	=ˆMÜ#Ô$?ÀÐPTÓUˆMØ—J‘J˜}¨mÓ<ˆEØ7<Ð% mÒ4ð	=ð
 ˆÜ1×AÑA×FÑFÓHò 	0ˆKÜ#Ô$:¸KÈÓNˆMØ—J‘J˜{¨MÓ:ˆEØ*/ˆN˜;Ò'ð	0ô
 �l¤T¬5 MÔ2Ü�| A‘¬¬u¨Ô6¼'À,ÈqÁ/ÐS\Ô:]àˆJØ(‰MàˆJØ)˜NˆMà—:‘:˜j¨%Ó0ˆØ—j‘j °Ó6ˆâØ)+¨R˜,ˆLØˆLØ#%Ð Ø -ó >@�Ø!# R˜�Ø!#�Ø+ó 38�GØ6=¸iÑ6HÖr¨7ÈGÐTZÉOÐ_qÒLqšwÐr�GÐrð (/¨yÑ'9÷$à#Ø#;ò$ð  Ø '™>¨g°f©oÀÒ.Hð   ›ð$Ø$ð$�Lñ $ð ,3÷$à'Ø#Eò$ð  Ø +Ñ-°+¸fÑ2EÈÒ2Pð $ CÓ(ð$Ø(ð$�Lñ $ð ,3÷$à'Ø#;ò$ð  Ø +Ñ-°+¸fÑ2EÈÒ2Pð $ CÓ(ð$Ø(ð$�Lñ $ð ".ò 9˜ØŸ™¤j°Ó&7Õ8ð9ð *Ð*AÒBØ%1ò r˜EØ(×/Ñ/´
¸5ÐP^Ð_nÑPoÔ0pÕqñrð &2ò r˜EØ(×/Ñ/´
¸5ÐP^Ð_nÑPoÔ0pÕqðrð ".ò 8˜Ü% e¬d´E¨]Ô;Ä
È5ÐQRÉ8ÔUXÔ@YØ\aÖ$bÈ[¤R§X¡X¬j¸Ó.EÓ%F×%HÓ%HÐ$b˜EÐ$bä$&§H¡H¨U£O˜EØ'+˜HÜ"ŸN™Nð![õô
 /9Ø %Ø+9¸,Ñ+GØ$2°;Ñ$?Ø(6Ð7KÑ(LØ2@ÐATÑ2Uô/™O˜E 8ð Ÿ™ eÔ,Ø&×-Ñ-¨hÕ7ò'8ðA38ñn Ø ×'Ñ'¨Ô/ÛØ ×'Ñ'¨Ô/Ø(×/Ñ/°Ö?ð}>@ðB E˜D×DÑDØðà)Ø)Ø%9ñ	ð
 !ñˆMð 4�—‘×3Ñ3Øð
à'ØØñ	
ð
 (ñ
ˆñ Ø˜A‘YˆFáñ *4˜F 1šI¸ˆMØ�~‰~×'Ñ'Ð3¸×8PÑ8PÐQU×Q_ÑQ_×QiÑQiÔ8jØ/4�Ð+Ñ,áð ØÙ'3‘|¸Ù'3‘|¸Ù&2‘l¸ñ	ð
 ñˆCñ Ø�
à˜;Ñ'Ð'ØˆùòM sùó$ùó$ùó$ùò( %cs$   ÅPÅPÅ,P
ÆP
Æ:P 
Ê/P&
c                 ó@   —  | j                   j                  |fd|i|¤ŽS )aÄ  
        Post-process the output of a vlm to decode the text.

        Args:
            generated_outputs (`torch.Tensor` or `np.ndarray`):
                The output of the model `generate` function. The output is expected to be a tensor of shape `(batch_size, sequence_length)`
                or `(sequence_length,)`.
            skip_special_tokens (`bool`, *optional*, defaults to `True`):
                Whether or not to remove special tokens in the output. Argument passed to the tokenizer's `batch_decode` method.
            **kwargs:
                Additional arguments to be passed to the tokenizer's `batch_decode method`.

        Returns:
            `List[str]`: The decoded text.
        Úskip_special_tokens)r‹   Úbatch_decode)r˜   Úgenerated_outputsr§  r«   s       rM   Úpost_process_image_text_to_textz.ProcessorMixin.post_process_image_text_to_text°  s(   € ð  +ˆt�~‰~×*Ñ*Ð+<ÑpÐReÐpÐioÑpÐprL   )Fr“   )NFFNÚmain)ÚAutoProcessor)T)5rB   rC   rD   rE   r�   rš   r�   rF   rI   rG   Úfeature_extractor_classÚtokenizer_classrù   rŽ   r²   ra   r   rÆ   rÐ   r
   rò   ÚPathLikerÚ   rß   rH   rý   Úclassmethodr¨   r4  r;  rm   r   rS  rV  r]  rU  Ústaticmethodr•   Úpropertyrp  r8  ry  r   r   r   r   rG  ÚUnpackr{   r€  r‡   r�  rª  rK   rL   rM   r‰   r‰   ¹  s+  … ñð & {Ð3€JØ*Ð+ÐØ$&Ð˜˜S™	Ó&à"ÐØ€OØ€KØ €L�$�s‘)Ó ò$/ðL&˜˜c 3˜h™ó &ðP	G ó 	Gð	0¨5°°b·k±kÐ1AÑ+Bó 	0ò[ñ
j'¸4ó j'ðX ðo&Ø,1°#°r·{±{Ð2BÑ,Cðo&à	ˆt�C˜�H‰~˜t C¨ H™~Ð-Ñ	.òo&ó ðo&ðb ð(°d¸3À¸8±nò (ó ð(ðZ 15ñ@à.ð@ð  (¨™~ð@ð
 
ˆc�4ˆi‰ó@ðD ð 8<Ø$Ø!&Ø,0Øñ=Fà',¨S°"·+±+Ð-=Ñ'>ð=Fð ˜E # r§{¡{Ð"2Ñ3Ñ4ð=Fð ð	=Fð
 ð=Fð ˜˜c 4˜iÑ(Ñ)ð=Fð ò=Fó ð=Fð~ ò%ó ð%ð2 ñ!ó ð!ðF ñó ðð. ñCó ðCð ñó ðò8cðt à˜4  S¨# X¡Ñ/Ñ0ð ð ˜:Ñ&ð ð ˜:Ñ&ð	 ð
 # 4¨¨S°#¨X©Ñ#7Ñ8ð ð !Ð!7Ñ8ó ðJ (,ñrà˜D  c¨3 h¡Ñ0°$°t¸DÀÀcÀ¹NÑ7KÑ2LÐLÑMðrð   ‘}ðrð Ð1Ñ2ð	rð
 
órôhqrL   r‰   c                 óì   ‡‡‡	— dt         fd„Š	ˆˆ	fd„Šˆfd„Šd„ } || ‰«      } ‰| «      } ||‰«      } ‰|«      }|r|r| |fS | €|s|€|s|r|rt        j                  d«       || fS t        d«      ‚)a¦  
    For backward compatibility: reverse the order of `images` and `text` inputs if they are swapped.
    This method should only be called for processors where `images` and `text` have been swapped for uniformization purposes.
    Note that this method assumes that two `None` inputs are valid inputs. If this is not the case, it should be handled
    in the processor's `__call__` method before calling this method.
    r³   c                 óH   — t        | t        «      xr | j                  d«      S )NÚhttp)r§   rI   r‘  )Úvals    rM   Úis_urlz1_validate_images_text_input_order.<locals>.is_urlË  s   € Ü˜#œsÓ#Ò>¨¯©°vÓ(>Ð>rL   c                 ó~   •— t        | t        t        f«      r| D ]  } ‰|«      rŒ y yt        | «      s	 ‰| «      syy)NFT)r§   rF   r¨   r   )ÚimgsÚimgÚ$_is_valid_images_input_for_processorr¸  s     €€rM   r¼  zO_validate_images_text_input_order.<locals>._is_valid_images_input_for_processorÎ  sF   ø€ ä�dœT¤5˜MÔ*Øò !�Ù;¸CÕ@Ù ð!ð ô ! Ô&©&°¬,ØØrL   c                 ó’   •— t        | t        «      ryt        | t        t        f«      rt	        | «      dk(  ry| D ]  } ‰|«      c S  y)NTr   F)r§   rI   rF   r¨   r    )ÚtÚt_sÚ"_is_valid_text_input_for_processors     €rM   rÀ  zM_validate_images_text_input_order.<locals>._is_valid_text_input_for_processorÙ  sI   ø€ Ü�aœÔàÜ˜œD¤%˜=Ô)ä�1‹v˜Š{àØò ?�Ù9¸#Ó>Ò>ð?àrL   c                 ó   —  || «      xs | d u S r“   rK   )ÚinputÚ	validators     rM   Ú	_is_validz4_validate_images_text_input_order.<locals>._is_validæ  s   € Ù˜ÓÒ0 5¨D =Ð0rL   z¾You may have used the wrong order for inputs. `images` should be passed before `text`. The `images` and `text` inputs will be swapped. This behavior will be deprecated in transformers v4.47.zGInvalid input type. Check that `images` and/or `text` are valid inputs.)rH   rþ   r(  r¡   )
r@  r3  rÄ  Úimages_is_validÚimages_is_textÚtext_is_validÚtext_is_imagesr¼  rÀ  r¸  s
          @@@rM   Ú!_validate_images_text_input_orderrÉ  Ã  sž   ú€ ð?”tó ?õ	ôò1ñ   Ð(LÓM€OÙ7¸Ó?€Ná˜dÐ$FÓG€MÙ9¸$Ó?€Ná™=Ø�tˆ|Ðð 	ˆ™>¨t¨|ÁÑTbÑguÜ×Ñðvô	
ð �Vˆ|Ðä
Ð^Ó
_Ð_rL   r  r¬  zprocessor files)ÚobjectÚobject_classÚobject_files)KrE   r¹   r¼   rÍ   rò   ÚsysÚtypingrï   Úpathlibr   r   r   r   r   r   r	   r
   ÚnumpyrŠ  Útyping_extensionsÚaudio_utilsr   Údynamic_module_utilsr   Úimage_utilsr   r   r   r   r   r   r   r   Útokenization_utils_baser   r   r   r   r   Úutilsr   r   r   r   r   r    r!   r"   r#   r$   r%   r&   Ú
get_loggerrB   rþ   Ú__file__Úparentrd  r¥   Úversion_infor³  r/   rP   rd   rf   rj   rm   rt   r{   rƒ   r‡   r‰   rÉ  rà   ÚformatrK   rL   rM   ú<module>rÜ     sõ  ðñó Û Û Û 	Û 
Û Û Ý ß H× HÑ Hã Û å #Ý 4÷÷ ñ ñ ÔÝ/÷õ ÷÷ ÷ ó ð  
ˆ×	Ñ	˜HÓ	%€ñ 1±°h³×1FÑ1FÓGÐ ð /Ø4Ø0ñÐ ð ×Ñ�wÒØ�]‰]�Fà×%Ñ%€Fô7 � %õ 7 ôt7�9 Eõ 7ôt->�9 Eõ ->ô`$*�) 5õ $*ôN5�9 Eõ 5ô4�z <°¸{ÈLÐ`eõ 4ôn$9 )°5õ $9ôN2˜Y¨eõ 2ôB(Ð"8Ð:UÐ]bõ (ôØ�˜l¨K¸ÐGbôô
Gq�^ô GqòT 7`ñt ' ~×'AÑ'AÓB€Ô Ø×Ñ×%Ñ%Ð1Ø)7×)CÑ)C×)KÑ)K×)RÑ)RØ¨ÐGXð *Só *€N×ÑÕ&ð 2rL   