Ë
    ÛÓ^j\  ã                   óR   — d Z ddlmZ ddlmZ ddlmZ e G d„ de«      «       ZdgZy)z(
Image/Text processor class for CLIPSeg
é   )ÚProcessorMixin)ÚBatchEncoding)Úauto_docstringc                   ó2   ‡ — e Zd Zdˆ fd„	Zedd„«       Zˆ xZS )ÚCLIPSegProcessorc                 ó&   •— t         ‰| �  ||«       y )N)ÚsuperÚ__init__)ÚselfÚimage_processorÚ	tokenizerÚkwargsÚ	__class__s       €úy/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/clipseg/processing_clipseg.pyr
   zCLIPSegProcessor.__init__   s   ø€ Ü‰Ñ˜¨)Õ4ó    c                 ó  — |€|€|€t        d«      ‚|�|�t        d«      ‚ | j                  | j                  fd| j                  j                  i|¤Ž}|� | j                  |fd|i|d   ¤Ž}|� | j
                  |fd|i|d   ¤Ž}|� | j
                  |fd|i|d   ¤Ž}	|�|�	j                  j                  dœ}|S |�|�	j                  d<   |S |�S |�d	j                  i}|S t        t        di 	¤Ž|¬
«      S )a  
        visual_prompt (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `list[PIL.Image.Image]`, `list[np.ndarray]`, `list[torch.Tensor]`):
            The visual prompt image or batch of images to be prepared. Each visual prompt 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.

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

            - **input_ids** -- List of token ids to be fed to a model. Returned when `text` is not `None`.
            - **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`.
        z9You have to specify either text, visual prompt or images.zMYou have to specify exactly one type of prompt. Either text or visual prompt.Útokenizer_init_kwargsÚreturn_tensorsÚtext_kwargsÚimages_kwargs)Úpixel_valuesÚconditional_pixel_valuesr   r   )ÚdataÚtensor_type© )	Ú
ValueErrorÚ_merge_kwargsÚvalid_processor_kwargsr   Úinit_kwargsr   r   r   Údict)
r   ÚtextÚimagesÚvisual_promptr   r   Úoutput_kwargsÚencodingÚprompt_featuresÚimage_featuress
             r   Ú__call__zCLIPSegProcessor.__call__   s€  € ð" ˆ<˜MÐ1°f°nÜÐXÓYÐYàÐ Ð 9ÜÐlÓmÐmà*˜×*Ñ*Ø×'Ñ'ñ
Ø?C¿~¹~×?YÑ?Yð
Ø]cñ
ˆð ÐØ%�t—~‘~ dÑj¸>ÐjÈ]Ð[hÑMiÑjˆHàÐ$Ø2˜d×2Ñ2ØñØ.<ðØ@MÈoÑ@^ñˆOð ÐØ1˜T×1Ñ1ØñØ'5ðØ9FÀÑ9WñˆNð Ð$¨Ð);à .× ;Ñ ;Ø,;×,HÑ,HñˆHð ˆOØÐ &Ð"4Ø'5×'BÑ'BˆH�^Ñ$ØˆOØÐØˆOØÐ&à*¨O×,HÑ,HðˆHð ˆOä ¤dÑ&<¨^Ñ&<È.ÔYÐYr   )NN)NNNN)Ú__name__Ú
__module__Ú__qualname__r
   r   r(   Ú__classcell__)r   s   @r   r   r      s   ø„ õ5ð ò8Zó ô8Zr   r   N)	Ú__doc__Úprocessing_utilsr   Útokenization_utils_baser   Úutilsr   r   Ú__all__r   r   r   ú<module>r2      s>   ðñõ /Ý 4Ý #ð ô=Z�~ó =Zó ð=Zð@ Ð
�r   