o
    پi                     @  s   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 ddlmZmZmZmZ ddlmZ dd	lmZ eeZG d
d deZG dd deZeegZdS )z5
MOVA pipeline integration (native SGLang pipeline).
    )annotations)MOVAPipelineConfig)MOVASamplingParams)ComposedPipelineBase)ImageVAEEncodingStageInputValidationStage)MOVADecodingStageMOVADenoisingStageMOVALatentPreparationStageMOVATimestepPreparationStage)
ServerArgs)init_loggerc                   @  s<   e Zd ZdZdZdZg dZeZe	Z
dd	d
ZdddZdS )MOVAPipelinez.MOVA pipeline with SGLang stage orchestration.MOVAT)		video_vae	audio_vaetext_encoder	tokenizer	scheduler	video_ditvideo_dit_2	audio_ditdual_tower_bridgeserver_argsr   returnNonec                 C  s    |j dkrtd|j  dS dS )z
        Initialize the pipeline.

        MOVA supports Context Parallel (sequence parallel) through USPAttention,
        which uses Ulysses-style all-to-all communication for distributed attention.
           zcMOVA Context Parallel enabled with sp_degree=%d. Using USPAttention for distributed self-attention.N)	sp_degreeloggerinfoselfr    r"   i/home/ubuntu/.local/lib/python3.10/site-packages/sglang/multimodal_gen/runtime/pipelines/mova_pipeline.pyinitialize_pipeline0   s   
z MOVAPipeline.initialize_pipelinec              
   C  s   |  t  |   t| dddr|  t| dd |  t| dt| ddddd |  t| d	d
d |  t| d| d| d| d| d	dd |  t	| d| ddd d S )Nr   require_vae_embeddingTr   )vaer   )r   r%   mova_latent_preparation_stager   )r   mova_timestep_preparation_stager   r   r   )r   r   r   r   r   mova_denoising_stage)r   r   mova_decoding_stage)
	add_stager    add_standard_text_encoding_stagegetattr
get_moduler   r
   r   r	   r   r    r"   r"   r#   create_pipeline_stages>   sH   	
z#MOVAPipeline.create_pipeline_stagesN)r   r   r   r   )__name__
__module____qualname____doc__pipeline_nameis_video_pipeline_required_config_modulesr   pipeline_config_clsr   sampling_params_clsr$   r/   r"   r"   r"   r#   r      s    
r   c                   @  s   e Zd ZdZdS )MOVAPipelineAliasr   N)r0   r1   r2   r4   r"   r"   r"   r#   r9   e   s    r9   N)r3   
__future__r   3sglang.multimodal_gen.configs.pipeline_configs.movar   )sglang.multimodal_gen.configs.sample.movar   Csglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_baser   3sglang.multimodal_gen.runtime.pipelines_core.stagesr   r   Nsglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.movar   r	   r
   r   )sglang.multimodal_gen.runtime.server_argsr   1sglang.multimodal_gen.runtime.utils.logging_utilsr   r0   r   r   r9   
EntryClassr"   r"   r"   r#   <module>   s   H