o
    پi'                     @   s   U d dl mZ d dlmZmZ d dlmZ d dlZd dlm	Z	m
Z
mZ d dlmZ d dlmZmZmZ d dlmZ d d	lmZmZ d
ZG dd deZeddZeed< dedefddZdedejfddZdedefddZdedejfddZ eG dd deZ!eG dd de!Z"dS )    )Callable)	dataclassfield)	TypedDictN)	DiTConfigEncoderConfig	VAEConfig)HunyuanVideoConfig)BaseEncoderOutputCLIPTextConfigLlamaConfig)HunyuanVAEConfig)ModelTaskTypePipelineConfiga   <|start_header_id|>system<|end_header_id|>

Describe the video by detailing the following aspects: 1. The main content and theme of the video.2. The color, shape, size, texture, quantity, text, and spatial relationships of the objects.3. Actions, events, behaviors temporal relationships, physical movement changes of the objects.4. background environment, light, style and atmosphere.5. camera angles, movements, and transitions used in the video:<|eot_id|><|start_header_id|>user<|end_header_id|>

{}<|eot_id|>c                   @   s   e Zd ZU eed< eed< dS )PromptTemplatetemplate
crop_startN)__name__
__module____qualname__str__annotations__int r   r   j/home/ubuntu/.local/lib/python3.10/site-packages/sglang/multimodal_gen/configs/pipeline_configs/hunyuan.pyr   "   s   
 r   _   )r   r   prompt_template_videopromptreturnc                 C   s   t d | S )Nr   )r   formatr   r   r   r   llama_preprocess_text-   s   r!   outputsc                 C   sJ   d}| j d us	J | j }||d   }tdd}|d d |d f }|S )N      r   )hidden_statesr   get)r"   _text_inputshidden_state_skip_layerr&   last_hidden_stater   r   r   r   llama_postprocess_text1   s   r+   c                 C   s   | S Nr   r    r   r   r   clip_preprocess_text;   s   r-   c                 C   s
   | j }|S r,   )pooler_output)r"   r(   r.   r   r   r   clip_postprocess_text?   s   r/   c                   @   s
  e Zd ZU dZejZeed< ee	dZ
eed< eedZeed< dZeed< dZeed	< ed
d dZeedf ed< edd dZeeegef df ed< edd dZeeegejf df ed< dZeed< dZeed< edd dZeedf ed< dd ZdS )HunyuanConfigz5Base configuration for HunYuan pipeline architecture.	task_type)default_factory
dit_config
vae_config   embedded_cfg_scale   
flow_shiftc                   C   s   t  t fS r,   )r   r   r   r   r   r   <lambda>U   s    zHunyuanConfig.<lambda>.text_encoder_configsc                   C      t tfS r,   )r!   r-   r   r   r   r   r9   X       preprocess_text_funcsc                   C   r;   r,   )r+   r/   r   r   r   r   r9   [   r<   postprocess_text_funcsbf16dit_precisionfp16vae_precisionc                   C   s   dS )N)rA   rA   r   r   r   r   r   r9   b   s    text_encoder_precisionsc                 C   s   d| j _d| j _d S )NFT)r4   load_encoderload_decoder)selfr   r   r   __post_init__e   s   zHunyuanConfig.__post_init__N) r   r   r   __doc__r   T2Vr1   r   r   r	   r3   r   r   r4   r   r6   r   r8   r:   tupler   r=   r   r   r>   r
   torchtensorr@   rB   rC   rG   r   r   r   r   r0   D   s*   
  r0   c                   @   s   e Zd ZU dZdZeed< dS )FastHunyuanConfigz=Configuration specifically optimized for FastHunyuan weights.   r8   N)r   r   r   rH   r8   r   r   r   r   r   r   rM   j   s   
 rM   )#collections.abcr   dataclassesr   r   typingr   rK   $sglang.multimodal_gen.configs.modelsr   r   r   )sglang.multimodal_gen.configs.models.ditsr	   -sglang.multimodal_gen.configs.models.encodersr
   r   r   )sglang.multimodal_gen.configs.models.vaesr   3sglang.multimodal_gen.configs.pipeline_configs.baser   r   PROMPT_TEMPLATE_ENCODE_VIDEOr   r   r   r   r!   rL   r+   r-   r/   r0   rM   r   r   r   r   <module>   s.   
%