§
    ‚Štj\  ã                   ó`   — 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dS )z(
Image/Text processor class for CLIPSeg
é   )ÚProcessorMixin)ÚBatchEncoding)Úauto_docstringc                   ó8   ‡ — e Zd Zdˆ fd„	Zedd„¦   «         Zˆ xZS )ÚCLIPSegProcessorNc                 óL   •— t          ¦   «                              ||¦  «         d S )N)ÚsuperÚ__init__)ÚselfÚimage_processorÚ	tokenizerÚkwargsÚ	__class__s       €úl/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/clipseg/processing_clipseg.pyr
   zCLIPSegProcessor.__init__   s#   ø€ Ý‰Œ×Ò˜¨)Ñ4Ô4Ð4Ð4Ð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`.
        Nz9You 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ÐYàÐ Ð 9ÝÐlÑmÔmÐmà*˜Ô*ØÔ'ð
ð 
Ø?C¼~Ô?Yð
Ø]cð
ð 
ˆð ÐØ%�t”~ dÐjÐj¸>ÐjÈ]Ð[hÔMiÐjÐjˆHàÐ$Ø2˜dÔ2Øðð Ø.<ðØ@MÈoÔ@^ðð ˆOð ÐØ1˜TÔ1Øðð Ø'5ðØ9FÀÔ9Wðð ˆNð Ð$¨Ð);à .Ô ;Ø,;Ô,Hðð ˆHð ˆOØÐ &Ð"4Ø'5Ô'BˆH�^Ñ$ØˆOØÐØˆOØÐ&à*¨OÔ,HðˆHð ˆOå ¥dÐ&<Ð&<¨^Ð&<Ð&<È.ÐYÑYÔYÐYr   )NN)NNNN)Ú__name__Ú
__module__Ú__qualname__r
   r   r(   Ú__classcell__)r   s   @r   r   r      se   ø€ € € € € ð5ð 5ð 5ð 5ð 5ð 5ð ð8Zð 8Zð 8Zñ „^ð8Zð 8Zð 8Zð 8Zð 8Zr   r   N)	Ú__doc__Úprocessing_utilsr   Útokenization_utils_baser   Úutilsr   r   Ú__all__r   r   r   ú<module>r2      s”   ððð ð /Ð .Ð .Ð .Ð .Ð .Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø #Ð #Ð #Ð #Ð #Ð #ð ð=Zð =Zð =Zð =Zð =Z�~ñ =Zô =Zñ „ð=Zð@ Ð
€€€r   