diff --git a/python/sglang/multimodal_gen/__init__.py b/python/sglang/multimodal_gen/__init__.py index 11f4ecd4e240..751822218340 100644 --- a/python/sglang/multimodal_gen/__init__.py +++ b/python/sglang/multimodal_gen/__init__.py @@ -1,6 +1,5 @@ # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo - -from sglang.multimodal_gen.configs.pipelines import PipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs import PipelineConfig from sglang.multimodal_gen.configs.sample import SamplingParams from sglang.multimodal_gen.runtime.entrypoints.diffusion_generator import DiffGenerator diff --git a/python/sglang/multimodal_gen/configs/pipelines/__init__.py b/python/sglang/multimodal_gen/configs/pipeline_configs/__init__.py similarity index 60% rename from python/sglang/multimodal_gen/configs/pipelines/__init__.py rename to python/sglang/multimodal_gen/configs/pipeline_configs/__init__.py index 6611a9382abd..370ec38e95f0 100644 --- a/python/sglang/multimodal_gen/configs/pipelines/__init__.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/__init__.py @@ -1,16 +1,16 @@ # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo -from sglang.multimodal_gen.configs.pipelines.base import ( +from sglang.multimodal_gen.configs.pipeline_configs.base import ( PipelineConfig, SlidingTileAttnConfig, ) -from sglang.multimodal_gen.configs.pipelines.flux import FluxPipelineConfig -from sglang.multimodal_gen.configs.pipelines.hunyuan import ( +from sglang.multimodal_gen.configs.pipeline_configs.flux import FluxPipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs.hunyuan import ( FastHunyuanConfig, HunyuanConfig, ) -from sglang.multimodal_gen.configs.pipelines.stepvideo import StepVideoT2VConfig -from sglang.multimodal_gen.configs.pipelines.wan import ( +from sglang.multimodal_gen.configs.pipeline_configs.stepvideo import StepVideoT2VConfig +from sglang.multimodal_gen.configs.pipeline_configs.wan import ( SelfForcingWanT2V480PConfig, WanI2V480PConfig, WanI2V720PConfig, diff --git a/python/sglang/multimodal_gen/configs/pipelines/base.py b/python/sglang/multimodal_gen/configs/pipeline_configs/base.py similarity index 100% rename from python/sglang/multimodal_gen/configs/pipelines/base.py rename to python/sglang/multimodal_gen/configs/pipeline_configs/base.py diff --git a/python/sglang/multimodal_gen/configs/pipelines/flux.py b/python/sglang/multimodal_gen/configs/pipeline_configs/flux.py similarity index 97% rename from python/sglang/multimodal_gen/configs/pipelines/flux.py rename to python/sglang/multimodal_gen/configs/pipeline_configs/flux.py index a187c4f153a5..9c377689bfd3 100644 --- a/python/sglang/multimodal_gen/configs/pipelines/flux.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/flux.py @@ -13,12 +13,12 @@ T5Config, ) from sglang.multimodal_gen.configs.models.vaes.flux import FluxVAEConfig -from sglang.multimodal_gen.configs.pipelines.base import ( +from sglang.multimodal_gen.configs.pipeline_configs.base import ( ModelTaskType, PipelineConfig, preprocess_text, ) -from sglang.multimodal_gen.configs.pipelines.hunyuan import ( +from sglang.multimodal_gen.configs.pipeline_configs.hunyuan import ( clip_postprocess_text, clip_preprocess_text, ) diff --git a/python/sglang/multimodal_gen/configs/pipelines/hunyuan.py b/python/sglang/multimodal_gen/configs/pipeline_configs/hunyuan.py similarity index 98% rename from python/sglang/multimodal_gen/configs/pipelines/hunyuan.py rename to python/sglang/multimodal_gen/configs/pipeline_configs/hunyuan.py index 73ede7d07892..2483063ead36 100644 --- a/python/sglang/multimodal_gen/configs/pipelines/hunyuan.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/hunyuan.py @@ -15,7 +15,7 @@ LlamaConfig, ) from sglang.multimodal_gen.configs.models.vaes import HunyuanVAEConfig -from sglang.multimodal_gen.configs.pipelines.base import PipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs import PipelineConfig PROMPT_TEMPLATE_ENCODE_VIDEO = ( "<|start_header_id|>system<|end_header_id|>\n\nDescribe the video by detailing the following aspects: " diff --git a/python/sglang/multimodal_gen/configs/pipelines/qwen_image.py b/python/sglang/multimodal_gen/configs/pipeline_configs/qwen_image.py similarity index 99% rename from python/sglang/multimodal_gen/configs/pipelines/qwen_image.py rename to python/sglang/multimodal_gen/configs/pipeline_configs/qwen_image.py index 54c85bdcbdd9..10bd4e610b9f 100644 --- a/python/sglang/multimodal_gen/configs/pipelines/qwen_image.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/qwen_image.py @@ -9,7 +9,10 @@ from sglang.multimodal_gen.configs.models.dits.qwenimage import QwenImageDitConfig from sglang.multimodal_gen.configs.models.encoders.qwen_image import Qwen2_5VLConfig from sglang.multimodal_gen.configs.models.vaes.qwenimage import QwenImageVAEConfig -from sglang.multimodal_gen.configs.pipelines.base import ModelTaskType, PipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs.base import ( + ModelTaskType, + PipelineConfig, +) from sglang.multimodal_gen.utils import calculate_dimensions diff --git a/python/sglang/multimodal_gen/configs/pipelines/stepvideo.py b/python/sglang/multimodal_gen/configs/pipeline_configs/stepvideo.py similarity index 94% rename from python/sglang/multimodal_gen/configs/pipelines/stepvideo.py rename to python/sglang/multimodal_gen/configs/pipeline_configs/stepvideo.py index 586e7542bac2..aff18e5cf8b8 100644 --- a/python/sglang/multimodal_gen/configs/pipelines/stepvideo.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/stepvideo.py @@ -6,7 +6,7 @@ from sglang.multimodal_gen.configs.models import DiTConfig, VAEConfig from sglang.multimodal_gen.configs.models.dits import StepVideoConfig from sglang.multimodal_gen.configs.models.vaes import StepVideoVAEConfig -from sglang.multimodal_gen.configs.pipelines.base import PipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs.base import PipelineConfig @dataclass diff --git a/python/sglang/multimodal_gen/configs/pipelines/wan.py b/python/sglang/multimodal_gen/configs/pipeline_configs/wan.py similarity index 98% rename from python/sglang/multimodal_gen/configs/pipelines/wan.py rename to python/sglang/multimodal_gen/configs/pipeline_configs/wan.py index d7068fba7a05..9e7f83eca374 100644 --- a/python/sglang/multimodal_gen/configs/pipelines/wan.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/wan.py @@ -14,7 +14,10 @@ T5Config, ) from sglang.multimodal_gen.configs.models.vaes import WanVAEConfig -from sglang.multimodal_gen.configs.pipelines.base import ModelTaskType, PipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs.base import ( + ModelTaskType, + PipelineConfig, +) from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger logger = init_logger(__name__) diff --git a/python/sglang/multimodal_gen/registry.py b/python/sglang/multimodal_gen/registry.py index 08c87917995a..9600531abb9e 100644 --- a/python/sglang/multimodal_gen/registry.py +++ b/python/sglang/multimodal_gen/registry.py @@ -15,7 +15,7 @@ from functools import lru_cache from typing import Any, Callable, Dict, List, Optional, Tuple, Type -from sglang.multimodal_gen.configs.pipelines import ( +from sglang.multimodal_gen.configs.pipeline_configs import ( FastHunyuanConfig, FluxPipelineConfig, HunyuanConfig, @@ -25,12 +25,12 @@ WanT2V480PConfig, WanT2V720PConfig, ) -from sglang.multimodal_gen.configs.pipelines.base import PipelineConfig -from sglang.multimodal_gen.configs.pipelines.qwen_image import ( +from sglang.multimodal_gen.configs.pipeline_configs.base import PipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs.qwen_image import ( QwenImageEditPipelineConfig, QwenImagePipelineConfig, ) -from sglang.multimodal_gen.configs.pipelines.wan import ( +from sglang.multimodal_gen.configs.pipeline_configs.wan import ( FastWan2_1_T2V_480P_Config, FastWan2_2_TI2V_5B_Config, Wan2_2_I2V_A14B_Config, @@ -55,7 +55,7 @@ WanT2V_1_3B_SamplingParams, WanT2V_14B_SamplingParams, ) -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) from sglang.multimodal_gen.runtime.utils.hf_diffusers_utils import ( @@ -74,49 +74,37 @@ def _discover_and_register_pipelines(): """ Automatically discover and register all ComposedPipelineBase subclasses. - This function scans the 'sglang.multimodal_gen.runtime.architectures' package, + This function scans the 'sglang.multimodal_gen.runtime.pipelines' package, finds modules with an 'EntryClass' attribute, and maps the class's 'pipeline_name' to the class itself in a global registry. """ - if _PIPELINE_REGISTRY: # E-run only once + if _PIPELINE_REGISTRY: # run only once return - package_name = "sglang.multimodal_gen.runtime.architectures" + package_name = "sglang.multimodal_gen.runtime.pipelines" package = importlib.import_module(package_name) - for _, pipeline_type_str, ispkg in pkgutil.iter_modules(package.__path__): + for _, module_name, ispkg in pkgutil.walk_packages( + package.__path__, package.__name__ + "." + ): if not ispkg: - continue - pipeline_type_package_name = f"{package_name}.{pipeline_type_str}" - pipeline_type_package = importlib.import_module(pipeline_type_package_name) - for _, arch, ispkg_arch in pkgutil.iter_modules(pipeline_type_package.__path__): - if not ispkg_arch: - continue - arch_package_name = f"{pipeline_type_package_name}.{arch}" - arch_package = importlib.import_module(arch_package_name) - for _, module_name, ispkg_module in pkgutil.walk_packages( - arch_package.__path__, arch_package.__name__ + "." - ): - if not ispkg_module: - pipeline_module = importlib.import_module(module_name) - if hasattr(pipeline_module, "EntryClass"): - entry_cls = pipeline_module.EntryClass - if not isinstance(entry_cls, list): - entry_cls_list = [entry_cls] - else: - entry_cls_list = entry_cls - - for cls in entry_cls_list: - if hasattr(cls, "pipeline_name"): - if cls.pipeline_name in _PIPELINE_REGISTRY: - logger.warning( - f"Duplicate pipeline name '{cls.pipeline_name}' found. Overwriting." - ) - _PIPELINE_REGISTRY[cls.pipeline_name] = cls - # else: - # logger.warning( - # f"Pipeline class {cls.__name__} does not have a 'pipeline_name' attribute." - # ) + pipeline_module = importlib.import_module(module_name) + if hasattr(pipeline_module, "EntryClass"): + entry_cls = pipeline_module.EntryClass + entry_cls_list = ( + [entry_cls] if not isinstance(entry_cls, list) else entry_cls + ) + + for cls in entry_cls_list: + if hasattr(cls, "pipeline_name"): + if cls.pipeline_name in _PIPELINE_REGISTRY: + logger.warning( + f"Duplicate pipeline name '{cls.pipeline_name}' found. Overwriting." + ) + _PIPELINE_REGISTRY[cls.pipeline_name] = cls + logger.debug( + f"Registering pipelines complete, {len(_PIPELINE_REGISTRY)} pipelines registered" + ) # --- Part 2: Config Registration --- diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/__init__.py b/python/sglang/multimodal_gen/runtime/architectures/basic/__init__.py deleted file mode 100644 index 9f0e4bc62392..000000000000 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo - -# SPDX-License-Identifier: Apache-2.0 -""" -Basic inference pipelines for sglang.multimodal_gen. - -This package contains basic pipelines for video and image generation. -""" diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/flux/__init__.py b/python/sglang/multimodal_gen/runtime/architectures/basic/flux/__init__.py deleted file mode 100644 index af2eb7d103a8..000000000000 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/flux/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/hunyuan/__init__.py b/python/sglang/multimodal_gen/runtime/architectures/basic/hunyuan/__init__.py deleted file mode 100644 index af2eb7d103a8..000000000000 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/hunyuan/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/qwen_image/__init__.py b/python/sglang/multimodal_gen/runtime/architectures/basic/qwen_image/__init__.py deleted file mode 100644 index af2eb7d103a8..000000000000 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/qwen_image/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/stepvideo/__init__.py b/python/sglang/multimodal_gen/runtime/architectures/basic/stepvideo/__init__.py deleted file mode 100644 index af2eb7d103a8..000000000000 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/stepvideo/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/__init__.py b/python/sglang/multimodal_gen/runtime/architectures/basic/wan/__init__.py deleted file mode 100644 index af2eb7d103a8..000000000000 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py b/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py index 1c376634a9c3..787379f788ce 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py @@ -21,8 +21,8 @@ import torchvision from einops import rearrange -from sglang.multimodal_gen.runtime.pipelines import Req -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import OutputBatch +from sglang.multimodal_gen.runtime.pipelines_core import Req +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import OutputBatch # Suppress verbose logging from imageio, which is triggered when saving images. logging.getLogger("imageio").setLevel(logging.WARNING) diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/openai/image_api.py b/python/sglang/multimodal_gen/runtime/entrypoints/openai/image_api.py index 07f67a5a1786..34ee3fc55389 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/openai/image_api.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/openai/image_api.py @@ -24,7 +24,7 @@ post_process_sample, ) from sglang.multimodal_gen.runtime.entrypoints.utils import prepare_request -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req from sglang.multimodal_gen.runtime.scheduler_client import scheduler_client from sglang.multimodal_gen.runtime.server_args import get_global_server_args from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/openai/video_api.py b/python/sglang/multimodal_gen/runtime/entrypoints/openai/video_api.py index ad6b6f000694..267a6a213a39 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/openai/video_api.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/openai/video_api.py @@ -34,7 +34,7 @@ post_process_sample, ) from sglang.multimodal_gen.runtime.entrypoints.utils import prepare_request -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req from sglang.multimodal_gen.runtime.server_args import get_global_server_args from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/utils.py b/python/sglang/multimodal_gen/runtime/entrypoints/utils.py index a4f8744697fb..7dc5f19e7e2c 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/utils.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/utils.py @@ -16,7 +16,7 @@ logging.getLogger("imageio_ffmpeg").setLevel(logging.WARNING) from sglang.multimodal_gen.configs.sample.base import DataType, SamplingParams -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger from sglang.multimodal_gen.utils import shallow_asdict diff --git a/python/sglang/multimodal_gen/runtime/managers/forward_context.py b/python/sglang/multimodal_gen/runtime/managers/forward_context.py index 0fcf747f44cd..e506929c6fdb 100644 --- a/python/sglang/multimodal_gen/runtime/managers/forward_context.py +++ b/python/sglang/multimodal_gen/runtime/managers/forward_context.py @@ -14,7 +14,7 @@ if TYPE_CHECKING: from sglang.multimodal_gen.runtime.layers.attention import AttentionMetadata - from sglang.multimodal_gen.runtime.pipelines import Req + from sglang.multimodal_gen.runtime.pipelines_core import Req logger = init_logger(__name__) diff --git a/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py b/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py index 7d2152846581..ddf9dbc780fa 100644 --- a/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py +++ b/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py @@ -16,8 +16,8 @@ get_cfg_group, get_tp_group, ) -from sglang.multimodal_gen.runtime.pipelines import Req, build_pipeline -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import OutputBatch +from sglang.multimodal_gen.runtime.pipelines_core import Req, build_pipeline +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import OutputBatch from sglang.multimodal_gen.runtime.server_args import PortArgs, ServerArgs from sglang.multimodal_gen.runtime.utils.common import set_cuda_arch from sglang.multimodal_gen.runtime.utils.logging_utils import ( diff --git a/python/sglang/multimodal_gen/runtime/managers/scheduler.py b/python/sglang/multimodal_gen/runtime/managers/scheduler.py index dffd5623921f..e7789a4b500b 100644 --- a/python/sglang/multimodal_gen/runtime/managers/scheduler.py +++ b/python/sglang/multimodal_gen/runtime/managers/scheduler.py @@ -6,7 +6,7 @@ import zmq from sglang.multimodal_gen.runtime.managers.gpu_worker import GPUWorker -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import OutputBatch +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import OutputBatch from sglang.multimodal_gen.runtime.server_args import ( PortArgs, ServerArgs, diff --git a/python/sglang/multimodal_gen/runtime/managers/schedulerbase.py b/python/sglang/multimodal_gen/runtime/managers/schedulerbase.py index 208ff5fbb6d0..a2da3cc75253 100644 --- a/python/sglang/multimodal_gen/runtime/managers/schedulerbase.py +++ b/python/sglang/multimodal_gen/runtime/managers/schedulerbase.py @@ -6,8 +6,8 @@ import zmq -from sglang.multimodal_gen.runtime.pipelines import Req -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import OutputBatch +from sglang.multimodal_gen.runtime.pipelines_core import Req +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import OutputBatch from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/__init__.py b/python/sglang/multimodal_gen/runtime/pipelines/__init__.py index fdb1acbfa182..af2eb7d103a8 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/__init__.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/__init__.py @@ -1,64 +1 @@ # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo - -# SPDX-License-Identifier: Apache-2.0 -""" -Diffusion pipelines for sglang.multimodal_gen. - -This package contains diffusion pipelines for generating videos and images. -""" - -from typing import cast - -from sglang.multimodal_gen.registry import get_model_info -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( - ComposedPipelineBase, -) -from sglang.multimodal_gen.runtime.pipelines.lora_pipeline import LoRAPipeline -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.server_args import ServerArgs -from sglang.multimodal_gen.runtime.utils.hf_diffusers_utils import ( - maybe_download_model, - verify_model_config_and_directory, -) -from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger - -logger = init_logger(__name__) - - -class PipelineWithLoRA(LoRAPipeline, ComposedPipelineBase): - """Type for a pipeline that has both ComposedPipelineBase and LoRAPipeline functionality.""" - - pass - - -def build_pipeline( - server_args: ServerArgs, -) -> PipelineWithLoRA: - """ - Only works with valid hf diffusers configs. (model_index.json) - We want to build a pipeline based on the inference args mode_path: - 1. download the model from the hub if it's not already downloaded - 2. verify the model config and directory - 3. based on the config, determine the pipeline class - """ - model_path = server_args.model_path - model_info = get_model_info(model_path) - if model_info is None: - raise ValueError(f"Unsupported model: {model_path}") - - pipeline_cls = model_info.pipeline_cls - - # instantiate the pipelines - pipeline = pipeline_cls(model_path, server_args) - - logger.info("Pipelines instantiated") - - return cast(PipelineWithLoRA, pipeline) - - -__all__ = [ - "build_pipeline", - "ComposedPipelineBase", - "Req", - "LoRAPipeline", -] diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/flux/flux.py b/python/sglang/multimodal_gen/runtime/pipelines/flux.py similarity index 93% rename from python/sglang/multimodal_gen/runtime/architectures/basic/flux/flux.py rename to python/sglang/multimodal_gen/runtime/pipelines/flux.py index b56947b42780..7ede4b388f1a 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/flux/flux.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/flux.py @@ -1,11 +1,11 @@ # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo # SPDX-License-Identifier: Apache-2.0 -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( ConditioningStage, DecodingStage, DenoisingStage, diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/hunyuan/hunyuan_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines/hunyuan_pipeline.py similarity index 94% rename from python/sglang/multimodal_gen/runtime/architectures/basic/hunyuan/hunyuan_pipeline.py rename to python/sglang/multimodal_gen/runtime/pipelines/hunyuan_pipeline.py index 8edf842c079a..0be68fc4dd0c 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/hunyuan/hunyuan_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/hunyuan_pipeline.py @@ -9,10 +9,10 @@ """ -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( ConditioningStage, DecodingStage, DenoisingStage, diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/qwen_image/qwen_image.py b/python/sglang/multimodal_gen/runtime/pipelines/qwen_image.py similarity index 94% rename from python/sglang/multimodal_gen/runtime/architectures/basic/qwen_image/qwen_image.py rename to python/sglang/multimodal_gen/runtime/pipelines/qwen_image.py index 0682c467fb57..e74ebb8ae25a 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/qwen_image/qwen_image.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/qwen_image.py @@ -3,11 +3,11 @@ # SPDX-License-Identifier: Apache-2.0 from diffusers.image_processor import VaeImageProcessor -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( DecodingStage, DenoisingStage, ImageEncodingStage, @@ -17,7 +17,7 @@ TextEncodingStage, TimestepPreparationStage, ) -from sglang.multimodal_gen.runtime.pipelines.stages.conditioning import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages.conditioning import ( ConditioningStage, ) from sglang.multimodal_gen.runtime.server_args import ServerArgs diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/__init__.py b/python/sglang/multimodal_gen/runtime/pipelines/stages/__init__.py deleted file mode 100644 index 062d4cd8e6d0..000000000000 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/__init__.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo - -# SPDX-License-Identifier: Apache-2.0 -""" -Pipeline stages for diffusion models. - -This package contains the various stages that can be composed to create -complete diffusion pipelines. -""" - -from sglang.multimodal_gen.runtime.pipelines.stages.base import PipelineStage -from sglang.multimodal_gen.runtime.pipelines.stages.causal_denoising import ( - CausalDMDDenoisingStage, -) -from sglang.multimodal_gen.runtime.pipelines.stages.conditioning import ( - ConditioningStage, -) -from sglang.multimodal_gen.runtime.pipelines.stages.decoding import DecodingStage -from sglang.multimodal_gen.runtime.pipelines.stages.denoising import DenoisingStage -from sglang.multimodal_gen.runtime.pipelines.stages.denoising_dmd import ( - DmdDenoisingStage, -) -from sglang.multimodal_gen.runtime.pipelines.stages.encoding import EncodingStage -from sglang.multimodal_gen.runtime.pipelines.stages.image_encoding import ( - ImageEncodingStage, - ImageVAEEncodingStage, -) -from sglang.multimodal_gen.runtime.pipelines.stages.input_validation import ( - InputValidationStage, -) -from sglang.multimodal_gen.runtime.pipelines.stages.latent_preparation import ( - LatentPreparationStage, -) -from sglang.multimodal_gen.runtime.pipelines.stages.stepvideo_encoding import ( - StepvideoPromptEncodingStage, -) -from sglang.multimodal_gen.runtime.pipelines.stages.text_encoding import ( - TextEncodingStage, -) -from sglang.multimodal_gen.runtime.pipelines.stages.timestep_preparation import ( - TimestepPreparationStage, -) - -__all__ = [ - "PipelineStage", - "InputValidationStage", - "TimestepPreparationStage", - "LatentPreparationStage", - "ConditioningStage", - "DenoisingStage", - "DmdDenoisingStage", - "CausalDMDDenoisingStage", - "EncodingStage", - "DecodingStage", - "ImageEncodingStage", - "ImageVAEEncodingStage", - "TextEncodingStage", - "StepvideoPromptEncodingStage", -] diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/stepvideo/stepvideo_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines/stepvideo_pipeline.py similarity index 96% rename from python/sglang/multimodal_gen/runtime/architectures/basic/stepvideo/stepvideo_pipeline.py rename to python/sglang/multimodal_gen/runtime/pipelines/stepvideo_pipeline.py index bb0e4ef9fe19..9d2e80c23673 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/stepvideo/stepvideo_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/stepvideo_pipeline.py @@ -24,11 +24,11 @@ HunyuanClip, # type: ignore ) from sglang.multimodal_gen.runtime.models.encoders.stepllm import STEP1TextEncoder -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.lora_pipeline import LoRAPipeline -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.lora_pipeline import LoRAPipeline +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( DecodingStage, DenoisingStage, InputValidationStage, diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_causal_dmd_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines/wan_causal_dmd_pipeline.py similarity index 90% rename from python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_causal_dmd_pipeline.py rename to python/sglang/multimodal_gen/runtime/pipelines/wan_causal_dmd_pipeline.py index 31b5bf04f03f..b103ee0a5e78 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_causal_dmd_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/wan_causal_dmd_pipeline.py @@ -7,13 +7,13 @@ This module wires the causal DMD denoising stage into the modular pipeline. """ -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.lora_pipeline import LoRAPipeline +from sglang.multimodal_gen.runtime.pipelines_core.lora_pipeline import LoRAPipeline # isort: off -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( ConditioningStage, DecodingStage, CausalDMDDenoisingStage, diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_dmd_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines/wan_dmd_pipeline.py similarity index 92% rename from python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_dmd_pipeline.py rename to python/sglang/multimodal_gen/runtime/pipelines/wan_dmd_pipeline.py index 984812f1fd16..3c973834cafb 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_dmd_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/wan_dmd_pipeline.py @@ -11,15 +11,15 @@ from sglang.multimodal_gen.runtime.models.schedulers.scheduling_flow_match_euler_discrete import ( FlowMatchEulerDiscreteScheduler, ) -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.lora_pipeline import LoRAPipeline +from sglang.multimodal_gen.runtime.pipelines_core.lora_pipeline import LoRAPipeline from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger # isort: off -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( ConditioningStage, DecodingStage, DmdDenoisingStage, diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_i2v_dmd_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines/wan_i2v_dmd_pipeline.py similarity index 93% rename from python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_i2v_dmd_pipeline.py rename to python/sglang/multimodal_gen/runtime/pipelines/wan_i2v_dmd_pipeline.py index ed3fdd4eaad8..7a49eef9b4b3 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_i2v_dmd_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/wan_i2v_dmd_pipeline.py @@ -8,15 +8,15 @@ using the modular pipeline architecture. """ -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.lora_pipeline import LoRAPipeline +from sglang.multimodal_gen.runtime.pipelines_core.lora_pipeline import LoRAPipeline from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger # isort: off -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( ImageEncodingStage, ConditioningStage, DecodingStage, diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_i2v_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines/wan_i2v_pipeline.py similarity index 93% rename from python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_i2v_pipeline.py rename to python/sglang/multimodal_gen/runtime/pipelines/wan_i2v_pipeline.py index 9477d4009da5..93a1968704da 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_i2v_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/wan_i2v_pipeline.py @@ -8,15 +8,15 @@ using the modular pipeline architecture. """ -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.lora_pipeline import LoRAPipeline +from sglang.multimodal_gen.runtime.pipelines_core.lora_pipeline import LoRAPipeline from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger # isort: off -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( ImageEncodingStage, ConditioningStage, DecodingStage, diff --git a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines/wan_pipeline.py similarity index 92% rename from python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_pipeline.py rename to python/sglang/multimodal_gen/runtime/pipelines/wan_pipeline.py index 9d7c592bd88b..8f1cbfc26870 100644 --- a/python/sglang/multimodal_gen/runtime/architectures/basic/wan/wan_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines/wan_pipeline.py @@ -11,11 +11,11 @@ from sglang.multimodal_gen.runtime.models.schedulers.scheduling_flow_unipc_multistep import ( FlowUniPCMultistepScheduler, ) -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) -from sglang.multimodal_gen.runtime.pipelines.lora_pipeline import LoRAPipeline -from sglang.multimodal_gen.runtime.pipelines.stages import ( +from sglang.multimodal_gen.runtime.pipelines_core.lora_pipeline import LoRAPipeline +from sglang.multimodal_gen.runtime.pipelines_core.stages import ( ConditioningStage, DecodingStage, DenoisingStage, diff --git a/python/sglang/multimodal_gen/runtime/pipelines/README.md b/python/sglang/multimodal_gen/runtime/pipelines_core/README.md similarity index 100% rename from python/sglang/multimodal_gen/runtime/pipelines/README.md rename to python/sglang/multimodal_gen/runtime/pipelines_core/README.md diff --git a/python/sglang/multimodal_gen/runtime/pipelines_core/__init__.py b/python/sglang/multimodal_gen/runtime/pipelines_core/__init__.py new file mode 100644 index 000000000000..feda424e54fa --- /dev/null +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/__init__.py @@ -0,0 +1,64 @@ +# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo + +# SPDX-License-Identifier: Apache-2.0 +""" +Diffusion pipelines for sglang.multimodal_gen. + +This package contains diffusion pipelines for generating videos and images. +""" + +from typing import cast + +from sglang.multimodal_gen.registry import get_model_info +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( + ComposedPipelineBase, +) +from sglang.multimodal_gen.runtime.pipelines_core.lora_pipeline import LoRAPipeline +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.server_args import ServerArgs +from sglang.multimodal_gen.runtime.utils.hf_diffusers_utils import ( + maybe_download_model, + verify_model_config_and_directory, +) +from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger + +logger = init_logger(__name__) + + +class PipelineWithLoRA(LoRAPipeline, ComposedPipelineBase): + """Type for a pipeline that has both ComposedPipelineBase and LoRAPipeline functionality.""" + + pass + + +def build_pipeline( + server_args: ServerArgs, +) -> PipelineWithLoRA: + """ + Only works with valid hf diffusers configs. (model_index.json) + We want to build a pipeline based on the inference args mode_path: + 1. download the model from the hub if it's not already downloaded + 2. verify the model config and directory + 3. based on the config, determine the pipeline class + """ + model_path = server_args.model_path + model_info = get_model_info(model_path) + if model_info is None: + raise ValueError(f"Unsupported model: {model_path}") + + pipeline_cls = model_info.pipeline_cls + + # instantiate the pipelines + pipeline = pipeline_cls(model_path, server_args) + + logger.info("Pipelines instantiated") + + return cast(PipelineWithLoRA, pipeline) + + +__all__ = [ + "build_pipeline", + "ComposedPipelineBase", + "Req", + "LoRAPipeline", +] diff --git a/python/sglang/multimodal_gen/runtime/pipelines/composed_pipeline_base.py b/python/sglang/multimodal_gen/runtime/pipelines_core/composed_pipeline_base.py similarity index 96% rename from python/sglang/multimodal_gen/runtime/pipelines/composed_pipeline_base.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/composed_pipeline_base.py index d3f2c8fae655..b9d22fc46346 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/composed_pipeline_base.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/composed_pipeline_base.py @@ -15,15 +15,15 @@ import torch from tqdm import tqdm -from sglang.multimodal_gen.configs.pipelines import PipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs import PipelineConfig from sglang.multimodal_gen.runtime.loader.component_loader import ( PipelineComponentLoader, ) -from sglang.multimodal_gen.runtime.pipelines.executors.pipeline_executor import ( +from sglang.multimodal_gen.runtime.pipelines_core.executors.pipeline_executor import ( PipelineExecutor, ) -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages import PipelineStage from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.hf_diffusers_utils import ( maybe_download_model, @@ -90,7 +90,7 @@ def __init__( def build_executor(self, server_args: ServerArgs): # TODO - from sglang.multimodal_gen.runtime.pipelines.executors.parallel_executor import ( + from sglang.multimodal_gen.runtime.pipelines_core.executors.parallel_executor import ( ParallelExecutor, ) diff --git a/python/sglang/multimodal_gen/runtime/pipelines/executors/parallel_executor.py b/python/sglang/multimodal_gen/runtime/pipelines_core/executors/parallel_executor.py similarity index 93% rename from python/sglang/multimodal_gen/runtime/pipelines/executors/parallel_executor.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/executors/parallel_executor.py index a1a9d88fa9ef..dabe531c666f 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/executors/parallel_executor.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/executors/parallel_executor.py @@ -9,12 +9,12 @@ get_cfg_group, get_classifier_free_guidance_rank, ) -from sglang.multimodal_gen.runtime.pipelines import Req -from sglang.multimodal_gen.runtime.pipelines.executors.pipeline_executor import ( +from sglang.multimodal_gen.runtime.pipelines_core import Req +from sglang.multimodal_gen.runtime.pipelines_core.executors.pipeline_executor import ( PipelineExecutor, Timer, ) -from sglang.multimodal_gen.runtime.pipelines.stages.base import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import ( PipelineStage, StageParallelismType, ) diff --git a/python/sglang/multimodal_gen/runtime/pipelines/executors/pipeline_executor.py b/python/sglang/multimodal_gen/runtime/pipelines_core/executors/pipeline_executor.py similarity index 91% rename from python/sglang/multimodal_gen/runtime/pipelines/executors/pipeline_executor.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/executors/pipeline_executor.py index d826f7cd919d..3a3ec051a764 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/executors/pipeline_executor.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/executors/pipeline_executor.py @@ -8,8 +8,8 @@ from abc import ABC, abstractmethod from typing import List -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages import PipelineStage from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/executors/sync_executor.py b/python/sglang/multimodal_gen/runtime/pipelines_core/executors/sync_executor.py similarity index 78% rename from python/sglang/multimodal_gen/runtime/pipelines/executors/sync_executor.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/executors/sync_executor.py index 6368593d2b7f..5e429b3e8768 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/executors/sync_executor.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/executors/sync_executor.py @@ -6,13 +6,13 @@ """ from typing import List -from sglang.multimodal_gen.runtime.pipelines.executors.pipeline_executor import ( +from sglang.multimodal_gen.runtime.pipelines_core.executors.pipeline_executor import ( PipelineExecutor, Timer, logger, ) -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages import PipelineStage from sglang.multimodal_gen.runtime.server_args import ServerArgs diff --git a/python/sglang/multimodal_gen/runtime/pipelines/lora_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines_core/lora_pipeline.py similarity index 99% rename from python/sglang/multimodal_gen/runtime/pipelines/lora_pipeline.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/lora_pipeline.py index 4e7bc0901c6e..6f5c52a0494e 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/lora_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/lora_pipeline.py @@ -16,7 +16,7 @@ replace_submodule, ) from sglang.multimodal_gen.runtime.loader.utils import get_param_names_mapping -from sglang.multimodal_gen.runtime.pipelines.composed_pipeline_base import ( +from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import ( ComposedPipelineBase, ) from sglang.multimodal_gen.runtime.server_args import ServerArgs diff --git a/python/sglang/multimodal_gen/runtime/pipelines/schedule_batch.py b/python/sglang/multimodal_gen/runtime/pipelines_core/schedule_batch.py similarity index 100% rename from python/sglang/multimodal_gen/runtime/pipelines/schedule_batch.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/schedule_batch.py diff --git a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/__init__.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/__init__.py new file mode 100644 index 000000000000..3c962b0b970d --- /dev/null +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/__init__.py @@ -0,0 +1,59 @@ +# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo + +# SPDX-License-Identifier: Apache-2.0 +""" +Pipeline stages for diffusion models. + +This package contains the various stages that can be composed to create +complete diffusion pipelines. +""" + +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.causal_denoising import ( + CausalDMDDenoisingStage, +) +from sglang.multimodal_gen.runtime.pipelines_core.stages.conditioning import ( + ConditioningStage, +) +from sglang.multimodal_gen.runtime.pipelines_core.stages.decoding import DecodingStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.denoising import DenoisingStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.denoising_dmd import ( + DmdDenoisingStage, +) +from sglang.multimodal_gen.runtime.pipelines_core.stages.encoding import EncodingStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.image_encoding import ( + ImageEncodingStage, + ImageVAEEncodingStage, +) +from sglang.multimodal_gen.runtime.pipelines_core.stages.input_validation import ( + InputValidationStage, +) +from sglang.multimodal_gen.runtime.pipelines_core.stages.latent_preparation import ( + LatentPreparationStage, +) +from sglang.multimodal_gen.runtime.pipelines_core.stages.stepvideo_encoding import ( + StepvideoPromptEncodingStage, +) +from sglang.multimodal_gen.runtime.pipelines_core.stages.text_encoding import ( + TextEncodingStage, +) +from sglang.multimodal_gen.runtime.pipelines_core.stages.timestep_preparation import ( + TimestepPreparationStage, +) + +__all__ = [ + "PipelineStage", + "InputValidationStage", + "TimestepPreparationStage", + "LatentPreparationStage", + "ConditioningStage", + "DenoisingStage", + "DmdDenoisingStage", + "CausalDMDDenoisingStage", + "EncodingStage", + "DecodingStage", + "ImageEncodingStage", + "ImageVAEEncodingStage", + "TextEncodingStage", + "StepvideoPromptEncodingStage", +] diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/base.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/base.py similarity index 98% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/base.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/base.py index 8601eb1e1d13..5f66ddaa9d37 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/base.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/base.py @@ -16,8 +16,10 @@ import torch import sglang.multimodal_gen.envs as envs -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs, get_global_server_args from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/causal_denoising.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/causal_denoising.py similarity index 98% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/causal_denoising.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/causal_denoising.py index 27b5ac2a6016..a00ef3f8dcf2 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/causal_denoising.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/causal_denoising.py @@ -5,12 +5,14 @@ from sglang.multimodal_gen.runtime.distributed import get_local_torch_device from sglang.multimodal_gen.runtime.managers.forward_context import set_forward_context from sglang.multimodal_gen.runtime.models.utils import pred_noise_to_pred_video -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.denoising import DenoisingStage -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.denoising import DenoisingStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators as V, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/conditioning.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/conditioning.py similarity index 90% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/conditioning.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/conditioning.py index 38a6fd3892e5..284dac49e3ae 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/conditioning.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/conditioning.py @@ -7,12 +7,14 @@ import torch -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import PipelineStage -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators as V, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/decoding.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/decoding.py similarity index 96% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/decoding.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/decoding.py index f4198bf5dcfe..d54e64f6a130 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/decoding.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/decoding.py @@ -10,19 +10,21 @@ import torch from sglang.multimodal_gen.configs.models.vaes.base import VAEArchConfig -from sglang.multimodal_gen.configs.pipelines.qwen_image import ( +from sglang.multimodal_gen.configs.pipeline_configs.qwen_image import ( QwenImageEditPipelineConfig, QwenImagePipelineConfig, ) from sglang.multimodal_gen.runtime.distributed import get_local_torch_device from sglang.multimodal_gen.runtime.loader.component_loader import VAELoader from sglang.multimodal_gen.runtime.models.vaes.common import ParallelTiledVAE -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import OutputBatch, Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import OutputBatch, Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import ( PipelineStage, StageParallelismType, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs, get_global_server_args from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger from sglang.multimodal_gen.utils import PRECISION_TO_TYPE diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/denoising.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/denoising.py similarity index 99% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/denoising.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/denoising.py index 1c99da75e34f..bb0c6c3a5745 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/denoising.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/denoising.py @@ -19,7 +19,7 @@ from einops import rearrange from tqdm.auto import tqdm -from sglang.multimodal_gen.configs.pipelines.base import ModelTaskType, STA_Mode +from sglang.multimodal_gen.configs.pipeline_configs.base import ModelTaskType, STA_Mode from sglang.multimodal_gen.runtime.distributed import ( cfg_model_parallel_all_reduce, get_local_torch_device, @@ -44,15 +44,17 @@ ) from sglang.multimodal_gen.runtime.loader.component_loader import TransformerLoader from sglang.multimodal_gen.runtime.managers.forward_context import set_forward_context -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import ( PipelineStage, StageParallelismType, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators as V, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.platforms.interface import AttentionBackendEnum from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/denoising_dmd.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/denoising_dmd.py similarity index 97% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/denoising_dmd.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/denoising_dmd.py index 47516fa70c92..1dd64a67cc61 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/denoising_dmd.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/denoising_dmd.py @@ -22,9 +22,9 @@ FlowMatchEulerDiscreteScheduler, ) from sglang.multimodal_gen.runtime.models.utils import pred_noise_to_pred_video -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages import DenoisingStage -from sglang.multimodal_gen.runtime.pipelines.stages.denoising import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages import DenoisingStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.denoising import ( st_attn_available, vsa_available, ) diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/encoding.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/encoding.py similarity index 91% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/encoding.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/encoding.py index e06937f7a24e..91fe9c43d8df 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/encoding.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/encoding.py @@ -9,12 +9,14 @@ from sglang.multimodal_gen.runtime.distributed import get_local_torch_device from sglang.multimodal_gen.runtime.models.vaes.common import ParallelTiledVAE -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import PipelineStage -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( V, # Import validators ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger from sglang.multimodal_gen.utils import PRECISION_TO_TYPE diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/image_encoding.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/image_encoding.py similarity index 97% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/image_encoding.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/image_encoding.py index 421eff15c12a..53ec3d1c2248 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/image_encoding.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/image_encoding.py @@ -10,7 +10,7 @@ import PIL import torch -from sglang.multimodal_gen.configs.pipelines.qwen_image import ( +from sglang.multimodal_gen.configs.pipeline_configs.qwen_image import ( QwenImageEditPipelineConfig, QwenImagePipelineConfig, _pack_latents, @@ -25,12 +25,14 @@ pil_to_numpy, resize, ) -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import PipelineStage -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators as V, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ExecutionMode, ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger from sglang.multimodal_gen.utils import PRECISION_TO_TYPE diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/input_validation.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/input_validation.py similarity index 94% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/input_validation.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/input_validation.py index b992c7791b74..c92942e46502 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/input_validation.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/input_validation.py @@ -9,15 +9,15 @@ import torchvision.transforms.functional as TF from PIL import Image -from sglang.multimodal_gen.configs.pipelines import WanI2V480PConfig -from sglang.multimodal_gen.configs.pipelines.base import ModelTaskType -from sglang.multimodal_gen.configs.pipelines.qwen_image import ( +from sglang.multimodal_gen.configs.pipeline_configs import WanI2V480PConfig +from sglang.multimodal_gen.configs.pipeline_configs.base import ModelTaskType +from sglang.multimodal_gen.configs.pipeline_configs.qwen_image import ( QwenImageEditPipelineConfig, ) from sglang.multimodal_gen.runtime.models.vision_utils import load_image, load_video -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import PipelineStage -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators, VerificationResult, ) diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/latent_preparation.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/latent_preparation.py similarity index 94% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/latent_preparation.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/latent_preparation.py index 1bfccf0f4892..34d7d82d45dc 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/latent_preparation.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/latent_preparation.py @@ -7,12 +7,14 @@ from diffusers.utils.torch_utils import randn_tensor from sglang.multimodal_gen.runtime.distributed import get_local_torch_device -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import PipelineStage -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators as V, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/stepvideo_encoding.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/stepvideo_encoding.py similarity index 90% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/stepvideo_encoding.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/stepvideo_encoding.py index 81e39d7b6116..eed0edd99875 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/stepvideo_encoding.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/stepvideo_encoding.py @@ -5,12 +5,14 @@ import torch from sglang.multimodal_gen.runtime.managers.forward_context import set_forward_context -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import PipelineStage -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators as V, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/text_encoding.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/text_encoding.py similarity index 96% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/text_encoding.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/text_encoding.py index cf6c342f2a77..47a5ef3c6518 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/text_encoding.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/text_encoding.py @@ -10,15 +10,17 @@ import torch from sglang.multimodal_gen.configs.models.encoders import BaseEncoderOutput -from sglang.multimodal_gen.configs.pipelines import FluxPipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs import FluxPipelineConfig from sglang.multimodal_gen.runtime.distributed import get_local_torch_device from sglang.multimodal_gen.runtime.managers.forward_context import set_forward_context -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import PipelineStage -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import PipelineStage +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators as V, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/timestep_preparation.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/timestep_preparation.py similarity index 92% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/timestep_preparation.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/timestep_preparation.py index 28275f11ceb5..91bc6e69532a 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines/stages/timestep_preparation.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/timestep_preparation.py @@ -12,21 +12,23 @@ import numpy as np -from sglang.multimodal_gen.configs.pipelines import FluxPipelineConfig -from sglang.multimodal_gen.configs.pipelines.qwen_image import ( +from sglang.multimodal_gen.configs.pipeline_configs import FluxPipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs.qwen_image import ( QwenImageEditPipelineConfig, QwenImagePipelineConfig, ) from sglang.multimodal_gen.runtime.distributed import get_local_torch_device -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req -from sglang.multimodal_gen.runtime.pipelines.stages.base import ( +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.stages.base import ( PipelineStage, StageParallelismType, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import ( +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( StageValidators as V, ) -from sglang.multimodal_gen.runtime.pipelines.stages.validators import VerificationResult +from sglang.multimodal_gen.runtime.pipelines_core.stages.validators import ( + VerificationResult, +) from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/pipelines/stages/validators.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/validators.py similarity index 100% rename from python/sglang/multimodal_gen/runtime/pipelines/stages/validators.py rename to python/sglang/multimodal_gen/runtime/pipelines_core/stages/validators.py diff --git a/python/sglang/multimodal_gen/runtime/scheduler_client.py b/python/sglang/multimodal_gen/runtime/scheduler_client.py index 5569ae209f8d..4b70de3fb031 100644 --- a/python/sglang/multimodal_gen/runtime/scheduler_client.py +++ b/python/sglang/multimodal_gen/runtime/scheduler_client.py @@ -5,7 +5,7 @@ import zmq import zmq.asyncio -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger diff --git a/python/sglang/multimodal_gen/runtime/server_args.py b/python/sglang/multimodal_gen/runtime/server_args.py index 5fc85b3d4e59..a6d51434bc86 100644 --- a/python/sglang/multimodal_gen/runtime/server_args.py +++ b/python/sglang/multimodal_gen/runtime/server_args.py @@ -15,9 +15,9 @@ from enum import Enum from typing import Any, Optional -from sglang.multimodal_gen.configs.pipelines import FluxPipelineConfig -from sglang.multimodal_gen.configs.pipelines.base import PipelineConfig, STA_Mode -from sglang.multimodal_gen.configs.pipelines.qwen_image import ( +from sglang.multimodal_gen.configs.pipeline_configs import FluxPipelineConfig +from sglang.multimodal_gen.configs.pipeline_configs.base import PipelineConfig, STA_Mode +from sglang.multimodal_gen.configs.pipeline_configs.qwen_image import ( QwenImageEditPipelineConfig, QwenImagePipelineConfig, ) diff --git a/python/sglang/multimodal_gen/runtime/sync_scheduler_client.py b/python/sglang/multimodal_gen/runtime/sync_scheduler_client.py index 2e246fb82027..8e89728f6ebe 100644 --- a/python/sglang/multimodal_gen/runtime/sync_scheduler_client.py +++ b/python/sglang/multimodal_gen/runtime/sync_scheduler_client.py @@ -2,7 +2,7 @@ import zmq -from sglang.multimodal_gen.runtime.pipelines.schedule_batch import Req +from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req from sglang.multimodal_gen.runtime.server_args import ServerArgs from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger