
    .`i'                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZ  G d de          Z ej        de           d	S )
z*BAGEL processor for image and text inputs.    )AutoProcessor)BatchFeature)
ImageInput)ProcessorMixin)PreTokenizedInput	TextInputc                       e Zd ZdZddgZdZdZ	 	 ddeez  e	e         z  e	e         z  de
fd	Zd
 Zd Zed             ZdS )BagelProcessorzf
    Constructs a BAGEL processor which wraps a
    SigLIP image processor and a Qwen2 tokenizer.
    image_processor	tokenizerSiglipImageProcessorAutoTokenizerNtextimagesc                 "   |i |}d|vrd|d<    | j         |fi |}nd}| | j        |fi |nd}|+|)t          |          }|d         |d<   t          |          S ||S |t          t          |                    S t          i           S )z`
        Main method to prepare for the model one or several sequences(s) and image(s).
        Nreturn_tensorsptpixel_values)r   r   dictr   )selfr   r   kwargsimage_kwargsr   text_inputscombineds           |/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/vllm/transformers_utils/processors/bagel.py__call__zBagelProcessor.__call__   s      &f:L|3315-./4/GG,GGLLL8<8HndnT44V444d#(?K((H'3N'CH^$)))%$[ 1 1222###    c                 &     | j         j        |i |S )z^
        This method forwards all its arguments to Qwen2TokenizerFast's batch_decode.
        )r   batch_decoder   argsr   s      r   r   zBagelProcessor.batch_decode;   s     +t~*D;F;;;r   c                 &     | j         j        |i |S )zX
        This method forwards all its arguments to Qwen2TokenizerFast's decode.
        )r   decoder    s      r   r#   zBagelProcessor.decodeA   s     %t~$d5f555r   c                     | j         j        }| j        j        }t          t                              ||z                       S )N)r   model_input_namesr   listr   fromkeys)r   tokenizer_input_namesimage_processor_input_namess      r   r%   z BagelProcessor.model_input_namesG   s:     $ @&*&:&L#DMM"7:U"UVVWWWr   )NN)__name__
__module____qualname____doc__
attributesimage_processor_classtokenizer_classr   r   r&   r   r   r   r#   propertyr%    r   r   r
   r
      s         
 $[1J2%O %)!"$ "$

y/  
!""$ "$ "$ "$ "$H< < <6 6 6 X X XX X Xr   r
   N)r-   transformersr   %transformers.feature_extraction_utilsr   transformers.image_utilsr   transformers.processing_utilsr   $transformers.tokenization_utils_baser   r   r
   registerr2   r   r   <module>r9      s    1 0 & & & & & & > > > > > > / / / / / / 8 8 8 8 8 8 M M M M M M M M>X >X >X >X >X^ >X >X >XB  ' 8 8 8 8 8r   