o
    پi                     @   s@   d dl mZmZ d dlmZ d dlmZmZ G dd deZdS )    )ListUnion)MllamaForConditionalGeneration)BaseMultimodalProcessorMultimodalSpecialTokensc                       s<   e Zd ZegZ fddZdeeee	f  fddZ
  ZS )MllamaImageProcessorc                    s>   t  j|||g|R i | t| jj| jjd|| _d S )N)image_tokenimage_token_id)super__init__r   
_processorr   r	   build	mm_tokens)self	hf_configserver_argsr   argskwargs	__class__ Z/home/ubuntu/.local/lib/python3.10/site-packages/sglang/srt/multimodal/processors/mlama.pyr      s   zMllamaImageProcessor.__init__
image_datac           	         s<   | j ||| jd}| || j\}}}|| | jjdS )N)promptr   multimodal_tokens)mm_items	input_idsim_token_id)load_mm_datar   process_and_combine_mm_datatolistr	   )	r   r   
input_textr   r   base_outr   r   _r   r   r   process_mm_data_async   s   
z*MllamaImageProcessor.process_mm_data_async)__name__
__module____qualname__r   modelsr   r   r   strbytesr$   __classcell__r   r   r   r   r   
   s    r   N)	typingr   r   sglang.srt.models.mllamar   /sglang.srt.multimodal.processors.base_processorr   r   r   r   r   r   r   <module>   s    