repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/denoising.py | .py | # SPDX-License-Identifier: Apache-2.0
"""MiniMax H3 denoise sink for packed-token DiT stepping, CFG-distilled
single-branch execution, and payload validation.
"""
from __future__ import annotations
from collections.abc import Mapping
from contextlib import contextmanager
from functools import partial
from typing impo... | 1,041 | 39,218 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/visual_encoding.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import torch
from sglang.multimodal_gen.runtime.disaggregation.roles import RoleType
from sglang.multimodal_gen.runtime.managers.memory_managers.component_manager import (
ComponentUse,
)
from sglang.multimodal_gen.runtime.pipelines_core.sch... | 369 | 15,881 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/__init__.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Pipeline lifecycle stages for the native MiniMax H3 implementation."""
| 3 | 112 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/audio_encoding.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import torch
from sglang.multimodal_gen.runtime.disaggregation.roles import RoleType
from sglang.multimodal_gen.runtime.managers.memory_managers.component_manager import (
ComponentUse,
)
from sglang.multimodal_gen.runtime.pipelines_core.sch... | 212 | 8,948 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/text_encoding.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import torch
from sglang.multimodal_gen.runtime.managers.forward_context import set_forward_context
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specif... | 551 | 23,552 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/timestep_preparation.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
from collections.abc import Mapping
import torch
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_g... | 184 | 7,448 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/latent_preparation.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import torch
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 impor... | 178 | 7,434 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/decoding.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import functools
from collections.abc import Mapping
import torch
from sglang.multimodal_gen.runtime.disaggregation.roles import RoleType
from sglang.multimodal_gen.runtime.distributed import (
get_world_group,
model_parallel_is_initial... | 444 | 18,323 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/replica_broadcast.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Request-replica broadcast helpers for MiniMax H3 encoding stages."""
from __future__ import annotations
from typing import Any
def minimax_h3_replica_ctx() -> tuple[int, int]:
from sglang.multimodal_gen.runtime.distributed.parallel_state import (
get_world_group,... | 60 | 1,810 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/self_forcing.py | .py | # SPDX-License-Identifier: Apache-2.0
"""SANA-WM self-forcing chunk SAMPLER utilities (not a diffusers scheduler).
Owns the autoregressive chunk grid, per-block KV-cache accumulation /
eviction, and the explicit per-chunk sigma list for streaming (self-forcing)
SANA-WM generation. The actual stepping scheduler is the ... | 209 | 8,028 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/__init__.py | .py | # SPDX-License-Identifier: Apache-2.0
"""SANA-WM pipeline stages (package).
The realtime serving framework drives ``SanaWMRealtimeStage`` over the
``/v1/realtime_video`` WebSocket. Base stages + helpers are re-exported here
for back-compat.
"""
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_s... | 34 | 1,088 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/streaming_refiner.py | .py | # SPDX-License-Identifier: Apache-2.0
"""SANA-WM chunked streaming LTX-2 refiner — S2b.
Runs the refiner block-by-block carrying a refiner KV cache: a ``sink`` prefix
(captured pre-RoPE, re-RoPE'd per block at shifted positions) plus a sliding
``history`` of refined-block K/V (post-RoPE), injected into each ``attn1`` ... | 727 | 28,718 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/realtime_chain.py | .py | # SPDX-License-Identifier: Apache-2.0
"""SANA-WM realtime stage chain.
Per-tick pipeline:
RealtimeInputValidationStage (framework)
SanaWMRealtimeTextEncodingStage (framework cache via MRO)
SanaWMCondFrameEncodeStage -> batch.image_latent (+ inputs snapshot)
SanaWMRealtimeLate... | 558 | 22,780 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/parity_probe.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Env-gated parity dump/probe helpers (no-op in production).
Single home for the debug harness that localized the realtime<->batch parity
bugs (previously copy-pasted across streaming/realtime/refiner/sana_wm).
Env vars:
- ``SANAWM_FORK_DUMP_DIR`` — batch-path dumps (init_noise... | 83 | 2,832 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/realtime_stage.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
from contextlib import contextmanager
from pathlib import Path
from typing import Any
import numpy as np
import torch
from PIL import Image
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req
from sglang.multim... | 449 | 16,000 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/streaming.py | .py | # SPDX-License-Identifier: Apache-2.0
"""SANA-WM streaming (self-forcing) denoising stage — S1c.
Generates video chunk-by-chunk via the DiT's chunk-causal ``forward_long``, a
rolling per-block KV cache carrying recurrent GDN state + softmax K/V window.
Gotchas vs the dense ``SanaWMDenoisingStage`` (one-shot bidirecti... | 772 | 31,666 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py | .py | # SPDX-License-Identifier: Apache-2.0
import inspect
import math
import os
import time
from pathlib import Path
from typing import Any
import numpy as np
import torch
import torch.nn.functional as F
import torchvision.transforms.functional as TF
from diffusers.utils.torch_utils import randn_tensor
from PIL import Ima... | 2,339 | 89,645 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/refiner.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
from typing import Any
import torch
from torch import nn
from sglang.multimodal_gen.configs.pipeline_configs.ltx_2 import (
STAGE_2_DISTILLED_SIGMA_VALUES as _STAGE_2_DISTILLED_SIGMA_VALUES,
)
from sglang.multimodal_gen.configs.p... | 800 | 29,494 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/hunyuan3d/__init__.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Hunyuan3D-specific pipeline stages"""
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.hunyuan3d.paint import (
Hunyuan3DPaintPostprocessStage,
Hunyuan3DPaintPreprocessStage,
Hunyuan3DPaintTexGenStage,
)
from sglang.multimodal_gen.runt... | 26 | 794 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/hunyuan3d/paint.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Hunyuan3D texture-generation stages."""
from __future__ import annotations
import concurrent.futures
import inspect
import os
from dataclasses import dataclass
from typing import Any
import cv2
import numpy as np
import torch
from diffusers.image_processor import VaeImageProc... | 848 | 33,208 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/hunyuan3d/shape.py | .py | # SPDX-License-Identifier: Apache-2.0
"""
Hunyuan3D shape generation stages.
Four-stage pipeline: BeforeDenoising -> Denoising -> Export -> Save.
"""
from __future__ import annotations
import os
from typing import Any
import numpy as np
import torch
from sglang.multimodal_gen.configs.pipeline_configs.hunyuan3d imp... | 610 | 22,522 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/lingbot_world/lingbot_world_causal_denoising.py | .py | # SPDX-License-Identifier: Apache-2.0
# Adapted from: https://github.com/Robbyant/lingbot-world
"""LingBot-World causal DMD denoising stage."""
from typing import Any
import torch
from sglang.multimodal_gen import envs
from sglang.multimodal_gen.runtime.distributed.parallel_state import (
get_ring_parallel_worl... | 738 | 25,834 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/lingbot_world/__init__.py | .py | # SPDX-License-Identifier: Apache-2.0
"""LingBot-World-specific pipeline stages."""
def __getattr__(name: str):
if name == "LingBotWorldCausalDMDDenoisingStage":
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.lingbot_world.lingbot_world_causal_denoising import (
... | 18 | 554 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/lingbot_world/constants.py | .py | # SPDX-License-Identifier: Apache-2.0
LINGBOT_CAMERA_ACTIONS_CONDITION = "camera_actions"
LINGBOT_PROMPT_UPDATED_CONDITION = "lingbot_prompt_updated"
LINGBOT_INTERACTIVE_KV_WINDOW_CACHE = "lingbot_interactive_kv_window"
LINGBOT_C2WS_PLUCKER_EMB_CACHE = "lingbot_c2ws_plucker_emb"
LINGBOT_CAM_CONDITIONER_CACHE = "lingb... | 12 | 500 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/realtime/__init__.py | .py | # SPDX-License-Identifier: Apache-2.0
"""realtime pipeline stages shared by interactive diffusion models"""
from sglang.multimodal_gen.runtime.pipelines_core.stages.realtime.base import (
RealtimeDiffusionStage,
RealtimeStageComponent,
)
from sglang.multimodal_gen.runtime.pipelines_core.stages.realtime.input_... | 32 | 1,033 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/realtime/input_validation.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req
from sglang.multimodal_gen.runtime.pipelines_core.stages.input_validation import (
InputValidationStage,
)
from sglang.multimodal_gen.runtime.realtime.session import... | 140 | 4,820 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/realtime/text_encoding.py | .py | # SPDX-License-Identifier: Apache-2.0
# Adapted from: https://github.com/Robbyant/lingbot-world
"""
LingBot-World realtime text stages.
The reference lingbot_fast_server initializes prompt embeddings once per session.
Cache text encoder outputs across realtime chunks so condition sampling stays
closer to the actual d... | 169 | 5,423 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/realtime/latent_preparation.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import torch
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req
from sglang.multimodal_gen.runtime.pipelines_core.stages.latent_preparation import (
LatentPreparationSpec,
LatentPreparationStage,
)
from sglang.m... | 74 | 2,514 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/realtime/vae.py | .py | # SPDX-License-Identifier: Apache-2.0
import torch
from sglang.multimodal_gen.runtime.distributed import get_local_torch_device
from sglang.multimodal_gen.runtime.models.vaes.wanvae import (
unpatchify as wan_unpatchify,
)
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import OutputBatch, Req
fr... | 207 | 6,993 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/stages/realtime/base.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from dataclasses import dataclass
import torch
from sglang.multimodal_gen.runtime.disaggregation.roles import RoleType
from sglang.multimodal_gen.runtime.distributed import get_local_torch_device
from sglang.multimodal_gen.runtime.managers.mem... | 126 | 4,421 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/executors/sync_executor.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""
Synchronous pipeline executor implementation.
"""
from typing import Any, Callable, List
from sglang.multimodal_gen.runtime.pipelines_core.executors.pipeline_executor import (
PipelineExecutor,
)
from sgl... | 85 | 2,493 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/executors/parallel_executor.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
from typing import Any, Callable, List
import torch
from sglang.multimodal_gen.runtime.distributed.parallel_state import (
get_cfg_group,
get_classifier_free_guidance_rank,
get_world_group,
get_world_rank,
)
from sglang.multimodal_gen... | 182 | 6,940 |
sglang | python/sglang/multimodal_gen/runtime/pipelines_core/executors/pipeline_executor.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""
Base class for all pipeline executors.
"""
import contextlib
import time
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Callable, List
import torch
from sglang.multimodal_gen.runt... | 302 | 10,080 |
sglang | python/sglang/multimodal_gen/runtime/post_training/sp_utils.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Sequence Parallel helpers for post-training rollout code."""
from __future__ import annotations
import torch
from sglang.multimodal_gen.runtime.distributed import (
get_local_torch_device,
get_sp_world_size,
)
from sglang.multimodal_gen.runtime.distributed.communicati... | 62 | 1,910 |
sglang | python/sglang/multimodal_gen/runtime/post_training/weights_updater.py | .py | """
In-place weight updates for diffusion pipeline modules.
This module provides WeightsUpdater, which swaps model weights at runtime
without restarting the server. It is the diffusion-engine counterpart of the
LLM engine's ModelRunner.update_weights_from_disk.
Detailed usage of higher level API can be found in
/py... | 763 | 29,594 |
sglang | python/sglang/multimodal_gen/runtime/post_training/scheduler_rl_debug_mixin.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Debug tensor helpers for rollout-enabled schedulers."""
import torch
from sglang.multimodal_gen.runtime.distributed import (
get_local_torch_device,
get_sp_world_size,
)
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req
from sglang.multimodal_... | 117 | 5,071 |
sglang | python/sglang/multimodal_gen/runtime/post_training/scheduler_post_training_mixin.py | .py | from __future__ import annotations
from typing import Any, List
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import OutputBatch
class SchedulerPostTrainingMixin:
def _handle_update_weights_from_disk(self, reqs: List[Any]) -> OutputBatch:
req = reqs[0]
success, message = self.... | 47 | 1,678 |
sglang | python/sglang/multimodal_gen/runtime/post_training/rl_dataclasses.py | .py | # SPDX-License-Identifier: Apache-2.0
"""RL-specific dataclasses used by post-training and rollout paths."""
from dataclasses import dataclass, field
from typing import Any
import torch
@dataclass
class RolloutSessionData:
"""Per-batch rollout state created by prepare_rollout(), lives on the batch object.
... | 65 | 2,196 |
sglang | python/sglang/multimodal_gen/runtime/post_training/rollout_scheduler.py | .py | from typing import Any
from sglang.multimodal_gen.runtime.models.schedulers.scheduling_flow_match_euler_discrete import (
FlowMatchEulerDiscreteScheduler,
)
from sglang.multimodal_gen.runtime.models.schedulers.scheduling_flow_unipc_multistep import (
FlowUniPCMultistepScheduler,
)
from sglang.multimodal_gen.ru... | 42 | 1,372 |
sglang | python/sglang/multimodal_gen/runtime/post_training/rollout_denoising_mixin.py | .py | """Mixin for rollout-related denoising hooks.
Moved out of DenoisingStage to keep the core stage lean.
"""
from __future__ import annotations
from typing import Any
import torch
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Req
from sglang.multimodal_gen.runtime.post_training.rl_dataclass... | 210 | 7,654 |
sglang | python/sglang/multimodal_gen/runtime/post_training/scheduler_rl_mixin.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Flow-matching rollout step utilities for log-prob computation."""
import math
from typing import Any, Union
import torch
from sglang.multimodal_gen.runtime.distributed import (
get_sp_world_size,
)
from sglang.multimodal_gen.runtime.pipelines_core.schedule_batch import Re... | 296 | 12,380 |
sglang | python/sglang/multimodal_gen/runtime/post_training/tensor_update_checker.py | .py | """Verification helpers for diffusion update_weights_from_tensor workflows."""
from __future__ import annotations
import hashlib
from collections.abc import Iterable
import torch
from torch.distributed.tensor import DTensor
from sglang.multimodal_gen.runtime.managers.memory_managers.layerwise_offload import (
i... | 264 | 9,463 |
sglang | python/sglang/multimodal_gen/runtime/post_training/gpu_worker_post_training_mixin.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from sglang.multimodal_gen.runtime.distributed import (
get_tp_rank,
get_tp_world_size,
get_world_group,
)
from sglang.multimodal_gen.runtime.loader.weight_utils import compute_weights_checksum
from sglang.multimodal_gen.runtime.managers.... | 204 | 7,297 |
sglang | python/sglang/multimodal_gen/runtime/platforms/musa.py | .py | """
This file is a platform abstraction for MThreads (MUSA) GPUs,
adjusted to match the structure and interface of `cuda.py`.
"""
import os
from collections.abc import Callable
from functools import lru_cache, wraps
from typing import Any, TypeVar
import psutil
import pymtml
# isort: off
import torch
import torchada... | 394 | 13,881 |
sglang | python/sglang/multimodal_gen/runtime/platforms/npu.py | .py | # SPDX-License-Identifier: Apache-2.0
# Adapted from vllm-ascend: https://github.com/vllm-project/vllm-ascend/blob/main/vllm_ascend/platform.py
import os
from typing import Any
import torch
from sglang.multimodal_gen import envs
from sglang.multimodal_gen.runtime.platforms.interface import (
AttentionBackendEnum... | 195 | 7,415 |
sglang | python/sglang/multimodal_gen/runtime/platforms/cpu.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
# Adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/platforms/cpu.py
import platform
from functools import lru_cache
from typing import Any
import psutil
import torch
from sglang.multimoda... | 124 | 3,753 |
sglang | python/sglang/multimodal_gen/runtime/platforms/rocm.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
# Adapted from rocm/vllm: https://github.com/ROCm/vllm/blob/v0.7.3%2Brocm/vllm/platforms/rocm.py
"""
This file is a platform abstraction for ROCm GPUs,
adjusted to match the structure and interface of `cuda.py`.
""... | 405 | 15,323 |
sglang | python/sglang/multimodal_gen/runtime/platforms/__init__.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
# Adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/platforms/__init__.py
import os
import traceback
# imported by other files, do not remove
from sglang.multimodal_gen.runtime.platforms.in... | 280 | 9,303 |
sglang | python/sglang/multimodal_gen/runtime/platforms/xpu.py | .py | # SPDX-License-Identifier: Apache-2.0
# Intel XPU Platform support for SGLang Diffusion
import torch
from sglang.multimodal_gen import envs
from sglang.multimodal_gen.runtime.platforms.interface import (
AttentionBackendEnum,
DeviceCapability,
Platform,
PlatformEnum,
)
from sglang.multimodal_gen.runti... | 194 | 7,390 |
sglang | python/sglang/multimodal_gen/runtime/platforms/mps.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
from functools import lru_cache
from typing import Any
import psutil
import torch
from sglang.multimodal_gen.runtime.platforms import (
AttentionBackendEnum,
Platform,
PlatformEnum,
)
from sglang.multimodal_gen.runtime.platforms.interface ... | 137 | 3,965 |
sglang | python/sglang/multimodal_gen/runtime/platforms/interface.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
# Adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/platforms/interface.py
from __future__ import annotations
import enum
import random
from collections.abc import Callable
from functools im... | 433 | 13,108 |
sglang | python/sglang/multimodal_gen/runtime/platforms/cuda.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
# Adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/vllm/platforms/cuda.py
"""Code inside this file can safely assume cuda platform, e.g. importing
pynvml. However, it should not initialize cuda c... | 816 | 31,012 |
sglang | python/sglang/multimodal_gen/runtime/platforms/aiter.py | .py | # SPDX-License-Identifier: Apache-2.0
from sglang.srt.utils import (
get_bool_env_var,
is_gfx95_supported,
is_gfx942_supported,
is_hip,
)
USE_AITER = get_bool_env_var("SGLANG_USE_AITER") and is_hip()
USE_AITER_GFX942 = USE_AITER and is_gfx942_supported()
USE_AITER_GFX95 = USE_AITER and is_gfx95_suppor... | 13 | 326 |
sglang | python/sglang/multimodal_gen/runtime/breakable_cuda_graph/runner.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 534 | 20,793 |
sglang | python/sglang/multimodal_gen/runtime/breakable_cuda_graph/replay_token.py | .py | """Replay-token tracking for diffusion BCG replays.
The SRT BCG core does not stamp replays; the diffusion runner sets a fresh
token around each graph replay so replay-local caches (e.g. varlen attention
mask metadata in ``DynamicVarlenMaskMeta``) can be rebuilt once per replay
while still being reused across the brea... | 32 | 975 |
sglang | python/sglang/multimodal_gen/runtime/breakable_cuda_graph/prompt_padding.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 308 | 10,362 |
sglang | python/sglang/multimodal_gen/runtime/breakable_cuda_graph/model_padders/qwen_image.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 103 | 3,689 |
sglang | python/sglang/multimodal_gen/runtime/breakable_cuda_graph/model_padders/minimax_h3.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0
# ==============================================================================
"""MiniMax H3 breakable CUDA graph packed-prompt padding."""
from __future__ import annotations
from typing import Any
import torch
from sglang.multimod... | 164 | 5,991 |
sglang | python/sglang/multimodal_gen/runtime/breakable_cuda_graph/model_padders/ideogram.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0
# ==============================================================================
"""Ideogram-4 breakable CUDA graph (BCG) prompt padding."""
from __future__ import annotations
from typing import Any
import torch
from sglang.multimoda... | 132 | 4,334 |
sglang | python/sglang/multimodal_gen/runtime/breakable_cuda_graph/model_padders/zimage.py | .py | # Copyright 2023-2026 SGLang Team
# Licensed under the Apache License, Version 2.0
# ==============================================================================
"""Z-Image breakable CUDA graph (BCG) prompt padding."""
from __future__ import annotations
from typing import Any
import torch
from sglang.multimodal_g... | 178 | 6,273 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/mova_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
"""
MOVA pipeline integration (native SGLang pipeline).
"""
from __future__ import annotations
from sglang.multimodal_gen.configs.pipeline_configs.mova import MOVAPipelineConfig
from sglang.multimodal_gen.configs.sample.mova import MOVASamplingParams
from sglang.multimodal_gen.ru... | 111 | 3,685 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/wan_i2v_dmd_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""
Wan video diffusion pipeline implementation.
This module contains an implementation of the Wan video diffusion pipeline
using the modular pipeline architecture.
"""
from sglang.multimodal_gen.runtime.models.s... | 52 | 1,739 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/qwen_image.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
from diffusers.image_processor import VaeImageProcessor
from sglang.multimodal_gen.runtime.disaggregation.roles import RoleType
from sglang.multimodal_gen.runtime.pipelines_core import LoRAPipeline
from sglang.mul... | 141 | 4,583 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/flux_2_klein.py | .py | from sglang.multimodal_gen.runtime.pipelines.flux_2 import Flux2Pipeline
class Flux2KleinPipeline(Flux2Pipeline):
pipeline_name = "Flux2KleinPipeline"
EntryClass = Flux2KleinPipeline
| 9 | 191 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/joy_image.py | .py | from sglang.multimodal_gen.runtime.pipelines_core import LoRAPipeline
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
ComposedPipelineBase,
)
from sglang.multimodal_gen.runtime.server_args import ServerArgs
class JoyImageEditPipeline(LoRAPipeline, ComposedPipelineBase):
pipel... | 31 | 850 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/lingbot_world_causal_dmd_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# Adapted from: https://github.com/Robbyant/lingbot-world
# SPDX-License-Identifier: Apache-2.0
"""
LingBot-World realtime causal DMD pipeline.
"""
from sglang.multimodal_gen.runtime.models.schedulers.scheduling_self_forcing_flow_match import (
Se... | 102 | 3,424 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/sana_wm_realtime_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from sglang.multimodal_gen.configs.pipeline_configs.sana_wm import (
SanaWMRealtimeConfig,
)
from sglang.multimodal_gen.runtime.pipelines.sana_wm_pipeline import (
SanaWMTwoStagePipeline,
)
from sglang.multimodal_gen.runtime.pipelines_cor... | 136 | 5,436 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/glm_image.py | .py | from sglang.multimodal_gen.runtime.pipelines_core import LoRAPipeline
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
ComposedPipelineBase,
)
from sglang.multimodal_gen.runtime.pipelines_core.stages import DenoisingStage
from sglang.multimodal_gen.runtime.pipelines_core.stages.mode... | 57 | 1,770 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/wan_causal_dmd_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""
Wan causal DMD pipeline implementation.
This module wires the causal DMD denoising stage into the modular pipeline.
"""
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
Co... | 52 | 1,397 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/flux.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
from sglang.multimodal_gen.runtime.pipelines_core import LoRAPipeline
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
ComposedPipelineBase,
)
from sglang.multimodal_gen.runtim... | 56 | 1,805 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/pi05.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import torch
from sglang.multimodal_gen.configs.pipeline_configs.pi05 import Pi05PipelineConfig
from sglang.multimodal_gen.configs.sample.pi05 import Pi05SamplingParams
from sglang.multimodal_gen.runtime.disaggregation.roles import RoleType
fro... | 129 | 5,061 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/sana_wm_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
import os
from sglang.multimodal_gen.configs.pipeline_configs.sana_wm import SanaWMPipelineConfig
from sglang.multimodal_gen.configs.sample.sana_wm import SanaWMSamplingParams
from sglang.multimodal_gen.runtime.loader.utils import get_memory_usage_of_component
from sglang.multimo... | 323 | 12,641 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/flux_2.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
from diffusers.pipelines.flux2.image_processor import Flux2ImageProcessor
from sglang.multimodal_gen.runtime.pipelines_core import LoRAPipeline, Req
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipel... | 64 | 1,988 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/wan_dmd_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""
Wan video diffusion pipeline implementation.
This module contains an implementation of the Wan video diffusion pipeline
using the modular pipeline architecture.
"""
from sglang.multimodal_gen.runtime.models.s... | 75 | 1,975 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/wan_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""
Wan video diffusion pipeline implementation.
This module contains an implementation of the Wan video diffusion pipeline
using the modular pipeline architecture.
"""
from sglang.multimodal_gen.runtime.models.s... | 58 | 1,891 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/longlive2_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
from sglang.multimodal_gen.configs.pipeline_configs.longlive2 import LongLive2T2VConfig
from sglang.multimodal_gen.configs.sample.longlive2 import LongLive2SamplingParams
from sglang.multimodal_gen.runtime.models.schedulers.scheduling_flow_unipc_multistep import (
FlowUniPCMult... | 62 | 2,251 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/longcat_image.py | .py | """LongCat-Image pipeline for SGLang."""
from sglang.multimodal_gen.runtime.pipelines_core import LoRAPipeline
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
ComposedPipelineBase,
)
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.longcat_image impor... | 72 | 2,555 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/minimax_h3_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from sglang.multimodal_gen.configs.pipeline_configs.minimax_h3 import (
MiniMaxH3PipelineConfig,
)
from sglang.multimodal_gen.configs.sample.minimax_h3 import MiniMaxH3SamplingParams
from sglang.multimodal_gen.runtime.disaggregation.roles imp... | 153 | 6,101 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/krea2.py | .py | """Krea-2 text-to-image pipeline (native diffusers layout).
The released repo is diffusers-style (``model_index.json`` + ``transformer/``,
``text_encoder/``, ``vae/``, ``tokenizer/``, ``scheduler/`` subfolders), so the
base ``load_modules`` loads every component from it (the MMDiT via
``Krea2Transformer2DModel``, the ... | 103 | 4,180 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/stable_diffusion_3.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""StableDiffusion3 pipeline implementation."""
import torch
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
ComposedPipelineBase,
)
from sglang.multimodal_gen.runtime.pipeli... | 110 | 3,790 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/sana.py | .py | # SPDX-License-Identifier: Apache-2.0
#
# SANA text-to-image pipeline.
#
# Stage order matches Flux (InputValidation -> TextEncoding -> TimestepPrep ->
# LatentPrep -> Denoising -> Decoding) rather than the add_standard_t2i_stages
# helper (which puts LatentPrep before TimestepPrep). Both orderings are
# functionally e... | 54 | 1,783 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/diffusers_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
"""
Diffusers backend pipeline wrapper.
This module provides a wrapper that allows running any diffusers-supported model
through sglang's infrastructure using vanilla diffusers pipelines.
"""
import argparse
import inspect
import re
import warnings
from typing import Any
import ... | 793 | 31,106 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/joy_echo_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
from sglang.multimodal_gen.configs.pipeline_configs.joy_echo import (
JoyEchoPipelineConfig,
)
from sglang.multimodal_gen.runtime.pipelines.ltx_2_pipeline import (
_add_ltx2_front_stages,
_BaseLTX2Pipeline,
prepare_ltx2_mu,
)
from sglang.multimodal_gen.runtime.pipel... | 99 | 3,653 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/cosmos3_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Cosmos3 video diffusion pipeline.
Cosmos3 has no separate text encoder — the transformer embeds text directly
via its Understanding (UND) pathway, and the Generation (GEN) pathway
cross-attends to the cached UND K/V at each denoising step.
"""
import os
from sglang.multimodal... | 127 | 5,009 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/ideogram.py | .py | # SPDX-License-Identifier: Apache-2.0
import json
import os
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, cast
from huggingface_hub import hf_hub_download, snapshot_download
from sglang.multimodal_gen.runtime.disaggregation.roles import RoleType
from sglang.multimodal_gen.... | 353 | 12,569 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/hunyuan3d_pipeline.py | .py | """
Hunyuan3D image-to-mesh pipeline implementation.
Shape pipeline: BeforeDenoising -> Denoising -> Export -> Save
Paint pipeline (optional): Preprocess -> TexGen -> Postprocess
"""
from __future__ import annotations
import glob
import importlib
import json
import os
from itertools import chain
from typing import A... | 652 | 24,035 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/flux_2_nvfp4.py | .py | # SPDX-License-Identifier: Apache-2.0
import glob
import os
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, cast
from sglang.multimodal_gen.runtime.pipelines.flux_2 import Flux2Pipeline
from sglang.multimodal_gen.runtime.server_args import ServerArgs
from sglang.multimodal_gen... | 131 | 4,566 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/hunyuan_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""
Hunyuan video diffusion pipeline implementation.
This module contains an implementation of the Hunyuan video diffusion pipeline
using the modular pipeline architecture.
"""
from sglang.multimodal_gen.runtime.... | 57 | 1,642 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/helios_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
"""
Helios video diffusion pipeline implementation.
This module contains an implementation of the Helios video diffusion pipeline
using the modular pipeline architecture. Phase 1: T2V only.
"""
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
... | 87 | 3,333 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/ernie_image.py | .py | # SPDX-License-Identifier: Apache-2.0
"""ErnieImage text-to-image pipeline."""
import json
import os
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_... | 233 | 9,112 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/ltx_2_pipeline.py | .py | import json
import math
import os
import numpy as np
import torch
from sglang.multimodal_gen.configs.pipeline_configs.ltx_2 import (
STAGE_2_DISTILLED_SIGMA_VALUES as _SHARED_STAGE_2_DISTILLED_SIGMA_VALUES,
)
from sglang.multimodal_gen.configs.pipeline_configs.ltx_2 import (
LTX2PipelineConfig,
is_ltx23_n... | 1,058 | 42,342 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/lingbot_video_moe.py | .py | # SPDX-License-Identifier: Apache-2.0
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.stages import (
DenoisingStage,
... | 61 | 1,927 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/comfyui_qwen_image_pipeline.py | .py | # SPDX-License-Identifier: Apache-2.0
import os
from itertools import chain
from typing import Any
import torch
from torch.distributed import init_device_mesh
from torch.distributed.fsdp import MixedPrecisionPolicy
from sglang.multimodal_gen.configs.models.dits.qwenimage import QwenImageDitConfig
from sglang.multimo... | 361 | 13,253 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/sana_video.py | .py | # SPDX-License-Identifier: Apache-2.0
"""SANA-Video text-to-video pipeline."""
import torch
from sglang.multimodal_gen.runtime.pipelines_core import LoRAPipeline
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
ComposedPipelineBase,
)
from sglang.multimodal_gen.runtime.pipelines_c... | 153 | 6,035 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/zimage_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
from sglang.multimodal_gen.runtime.pipelines_core import LoRAPipeline, Req
from sglang.multimodal_gen.runtime.pipelines_core.composed_pipeline_base import (
ComposedPipelineBase,
)
from sglang.multimodal_gen.ru... | 46 | 1,478 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/comfyui_zimage_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
import os
import re
from collections.abc import Generator
from itertools import chain
from typing import Any
import torch
from torch.distributed import init_device_mesh
from torch.distributed.fsdp import MixedPrec... | 411 | 16,500 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/comfyui_flux_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
import os
import re
from typing import Any, Generator
import torch
from sglang.multimodal_gen.configs.models.dits.flux import FluxConfig
from sglang.multimodal_gen.runtime.distributed import get_local_torch_devic... | 690 | 29,039 |
sglang | python/sglang/multimodal_gen/runtime/pipelines/wan_i2v_pipeline.py | .py | # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
# SPDX-License-Identifier: Apache-2.0
"""
Wan video diffusion pipeline implementation.
This module contains an implementation of the Wan video diffusion pipeline
using the modular pipeline architecture.
"""
from sglang.multimodal_gen.runtime.models.s... | 44 | 1,312 |
sglang | python/sglang/multimodal_gen/runtime/server_args/disagg.py | .py | # SPDX-License-Identifier: Apache-2.0
"""Disaggregated diffusion server argument helpers."""
from __future__ import annotations
from typing import ClassVar, Literal
from sglang.multimodal_gen.runtime.disaggregation.roles import RoleType
from sglang.multimodal_gen.runtime.utils.common import (
format_tcp_endpoint... | 237 | 8,420 |
sglang | python/sglang/multimodal_gen/runtime/server_args/__init__.py | .py | # SPDX-License-Identifier: Apache-2.0
from sglang.multimodal_gen.runtime.server_args import server_args as _server_args
from sglang.multimodal_gen.runtime.server_args.server_args import (
BREAKABLE_CUDA_GRAPH_SUPPORTED_MODEL_IDS,
BREAKABLE_CUDA_GRAPH_SUPPORTED_PIPELINE_CONFIGS,
DEFAULT_BCG_TEXT_BUCKETS,
... | 43 | 1,237 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.