From eda2f70033d06a6bb88d0b84ffb8cd5b6dff93ef Mon Sep 17 00:00:00 2001 From: Mick Date: Fri, 21 Nov 2025 14:35:29 +0800 Subject: [PATCH] [diffusion] doc: minor update docs (#13177) --- python/sglang/multimodal_gen/README.md | 4 ++-- python/sglang/multimodal_gen/configs/models/base.py | 2 +- .../sglang/multimodal_gen/configs/models/dits/base.py | 2 +- .../sglang/multimodal_gen/configs/models/vaes/base.py | 2 +- .../multimodal_gen/csrc/attn/vmoba_attn/README.md | 2 +- python/sglang/multimodal_gen/docs/cli.md | 10 +++++----- python/sglang/multimodal_gen/docs/install.md | 4 ++-- python/sglang/multimodal_gen/docs/support_matrix.md | 2 +- .../sglang/multimodal_gen/docs/support_new_models.md | 9 ++++++--- python/sglang/multimodal_gen/envs.py | 2 +- .../runtime/distributed/device_communicators/pynccl.py | 2 +- .../runtime/distributed/parallel_state.py | 2 +- .../multimodal_gen/runtime/entrypoints/cli/generate.py | 2 +- .../multimodal_gen/runtime/entrypoints/cli/main.py | 2 +- .../multimodal_gen/runtime/entrypoints/cli/serve.py | 2 +- .../runtime/entrypoints/diffusion_generator.py | 2 +- .../sglang/multimodal_gen/runtime/entrypoints/utils.py | 2 +- python/sglang/multimodal_gen/runtime/launch_server.py | 4 ++-- .../runtime/layers/attention/selector.py | 4 ++-- .../sglang/multimodal_gen/runtime/loader/fsdp_load.py | 2 +- .../multimodal_gen/runtime/models/vaes/hunyuanvae.py | 2 +- python/sglang/multimodal_gen/runtime/server_args.py | 4 ++-- python/sglang/multimodal_gen/utils.py | 4 ++-- 23 files changed, 38 insertions(+), 35 deletions(-) diff --git a/python/sglang/multimodal_gen/README.md b/python/sglang/multimodal_gen/README.md index 4f7dc7051..fbde0767a 100644 --- a/python/sglang/multimodal_gen/README.md +++ b/python/sglang/multimodal_gen/README.md @@ -2,9 +2,9 @@ -**sgl-diffusion is an inference framework for accelerated image/video generation.** +**SGLang diffusion is an inference framework for accelerated image/video generation.** -SGLang-Diffusion features an end-to-end unified pipeline for accelerating diffusion models. It is designed to be modular and extensible, allowing users to easily add new models and optimizations. +SGLang diffusion features an end-to-end unified pipeline for accelerating diffusion models. It is designed to be modular and extensible, allowing users to easily add new models and optimizations. ## Key Features diff --git a/python/sglang/multimodal_gen/configs/models/base.py b/python/sglang/multimodal_gen/configs/models/base.py index 2820a4585..6de428ad9 100644 --- a/python/sglang/multimodal_gen/configs/models/base.py +++ b/python/sglang/multimodal_gen/configs/models/base.py @@ -46,7 +46,7 @@ class ModelConfig: # Diffuser/Transformer parameters arch_config: ArchConfig = field(default_factory=ArchConfig) - # sgl-diffusion-specific parameters here + # sglang-diffusion-specific parameters here # i.e. STA, quantization, teacache def __getattr__(self, name): diff --git a/python/sglang/multimodal_gen/configs/models/dits/base.py b/python/sglang/multimodal_gen/configs/models/dits/base.py index 366c816ba..22da409a1 100644 --- a/python/sglang/multimodal_gen/configs/models/dits/base.py +++ b/python/sglang/multimodal_gen/configs/models/dits/base.py @@ -43,7 +43,7 @@ class DiTArchConfig(ArchConfig): class DiTConfig(ModelConfig): arch_config: DiTArchConfig = field(default_factory=DiTArchConfig) - # sgl-diffusionDiT-specific parameters + # sglang-diffusion DiT-specific parameters prefix: str = "" quant_config: QuantizationConfig | None = None diff --git a/python/sglang/multimodal_gen/configs/models/vaes/base.py b/python/sglang/multimodal_gen/configs/models/vaes/base.py index 3e31760e2..e7a078b6e 100644 --- a/python/sglang/multimodal_gen/configs/models/vaes/base.py +++ b/python/sglang/multimodal_gen/configs/models/vaes/base.py @@ -26,7 +26,7 @@ class VAEArchConfig(ArchConfig): class VAEConfig(ModelConfig): arch_config: VAEArchConfig = field(default_factory=VAEArchConfig) - # sgl-diffusionVAE-specific parameters + # sglang-diffusion VAE-specific parameters load_encoder: bool = True load_decoder: bool = True diff --git a/python/sglang/multimodal_gen/csrc/attn/vmoba_attn/README.md b/python/sglang/multimodal_gen/csrc/attn/vmoba_attn/README.md index 3fc24e366..7b41bd51b 100644 --- a/python/sglang/multimodal_gen/csrc/attn/vmoba_attn/README.md +++ b/python/sglang/multimodal_gen/csrc/attn/vmoba_attn/README.md @@ -1,4 +1,4 @@ -# Attention Kernel Used in sgl-diffusion +# Attention Kernel Used in SGLang diffusion ## VMoBA: Mixture-of-Block Attention for Video Diffusion Models (VMoBA) diff --git a/python/sglang/multimodal_gen/docs/cli.md b/python/sglang/multimodal_gen/docs/cli.md index 86a9643d3..e9471c593 100644 --- a/python/sglang/multimodal_gen/docs/cli.md +++ b/python/sglang/multimodal_gen/docs/cli.md @@ -1,11 +1,11 @@ -# sgl-diffusion CLI Inference +# SGLang diffusion CLI Inference -The sgl-diffusion CLI provides a quick way to access the sgl-diffusion inference pipeline for image and video generation. +The SGLang-diffusion CLI provides a quick way to access the inference pipeline for image and video generation. ## Prerequisites -- A working sgl-diffusion installation and the `sgl-diffusion` CLI available in `$PATH`. -- Python 3.10+ if you plan to use the OpenAI Python SDK. +- A working SGLang diffusion installation and the `sglang` CLI available in `$PATH`. +- Python 3.11+ if you plan to use the OpenAI Python SDK. ## Supported Arguments @@ -127,7 +127,7 @@ sglang generate --help ## Serve -Launch the sgl-diffusion HTTP server and interact with it using the OpenAI SDK and curl. The server implements an OpenAI-compatible subset for Videos under the `/v1/videos` namespace. +Launch the SGLang diffusion HTTP server and interact with it using the OpenAI SDK and curl. The server implements an OpenAI-compatible subset for Videos under the `/v1/videos` namespace. ### Start the server diff --git a/python/sglang/multimodal_gen/docs/install.md b/python/sglang/multimodal_gen/docs/install.md index c8c0f45de..894a414ba 100644 --- a/python/sglang/multimodal_gen/docs/install.md +++ b/python/sglang/multimodal_gen/docs/install.md @@ -1,6 +1,6 @@ -# Install sgl-diffusion +# Install SGLang-diffusion -You can install sgl-diffusion using one of the methods below. +You can install sglang-diffusion using one of the methods below. This page primarily applies to common NVIDIA GPU platforms. diff --git a/python/sglang/multimodal_gen/docs/support_matrix.md b/python/sglang/multimodal_gen/docs/support_matrix.md index bbbacb83d..99c5b2efa 100644 --- a/python/sglang/multimodal_gen/docs/support_matrix.md +++ b/python/sglang/multimodal_gen/docs/support_matrix.md @@ -10,7 +10,7 @@ The symbols used have the following meanings: ## Models x Optimization -The `HuggingFace Model ID` can be passed directly to `from_pretrained()` methods, and sgl-diffusion will use the optimal +The `HuggingFace Model ID` can be passed directly to `from_pretrained()` methods, and sglang-diffusion will use the optimal default parameters when initializing and generating videos. ### Video Generation Models diff --git a/python/sglang/multimodal_gen/docs/support_new_models.md b/python/sglang/multimodal_gen/docs/support_new_models.md index c92dee7bd..e51bd68d7 100644 --- a/python/sglang/multimodal_gen/docs/support_new_models.md +++ b/python/sglang/multimodal_gen/docs/support_new_models.md @@ -1,10 +1,12 @@ # How to Support New Diffusion Models -This document explains how to add support for new diffusion models in SGLang Diffusion. +This document explains how to add support for new diffusion models in SGLang diffusion. ## Architecture Overview -SGLang Diffusion is engineered for both performance and flexibility, built upon a modular pipeline architecture. This design allows developers to easily construct complex, customized pipelines for various diffusion models by combining and reusing different components. +SGLang diffusion is engineered for both performance and flexibility, built upon a modular pipeline architecture. This +design allows developers to easily construct complex, customized pipelines for various diffusion models by combining and +reusing different components. At its core, the architecture revolves around two key concepts, as highlighted in our [blog post](https://lmsys.org/blog/2025-11-07-sglang-diffusion/#architecture): @@ -101,4 +103,5 @@ To illustrate the process, let's look at how `Qwen-Image-Edit` is implemented. T 5. **Register Configs**: - Register the configs in the central registry ([`registry.py`](https://github.com/sgl-project/sglang/blob/main/python/sglang/multimodal_gen/registry.py)) via `_register_configs` to enable automatic loading and instantiation for the model. Modules are automatically loaded and injected based on the config and repository structure. -By following this modular pattern of defining configurations and composing pipelines, you can integrate new diffusion models into SGLang with clarity and ease. +By following this pattern of defining configurations and composing pipelines, you can integrate new diffusion models +into SGLang with ease. diff --git a/python/sglang/multimodal_gen/envs.py b/python/sglang/multimodal_gen/envs.py index 17a0a14c3..c07786090 100644 --- a/python/sglang/multimodal_gen/envs.py +++ b/python/sglang/multimodal_gen/envs.py @@ -163,7 +163,7 @@ def maybe_convert_int(value: str | None) -> int | None: environment_variables: dict[str, Callable[[], Any]] = { # ================== Installation Time Env Vars ================== - # Target device of sgl-diffusion, supporting [cuda (by default), + # Target device of sglang-diffusion, supporting [cuda (by default), # rocm, neuron, cpu, openvino] "SGLANG_DIFFUSION_TARGET_DEVICE": lambda: os.getenv( "SGLANG_DIFFUSION_TARGET_DEVICE", "cuda" diff --git a/python/sglang/multimodal_gen/runtime/distributed/device_communicators/pynccl.py b/python/sglang/multimodal_gen/runtime/distributed/device_communicators/pynccl.py index 0ab2e1adb..2d1ef558a 100644 --- a/python/sglang/multimodal_gen/runtime/distributed/device_communicators/pynccl.py +++ b/python/sglang/multimodal_gen/runtime/distributed/device_communicators/pynccl.py @@ -74,7 +74,7 @@ class PyNcclCommunicator: self.available = True self.disabled = False - logger.info("sgl-diffusion is using nccl==%s", self.nccl.ncclGetVersion()) + logger.info("sglang-diffusion is using nccl==%s", self.nccl.ncclGetVersion()) if self.rank == 0: # get the unique id from NCCL diff --git a/python/sglang/multimodal_gen/runtime/distributed/parallel_state.py b/python/sglang/multimodal_gen/runtime/distributed/parallel_state.py index a99195aab..82dbb5887 100644 --- a/python/sglang/multimodal_gen/runtime/distributed/parallel_state.py +++ b/python/sglang/multimodal_gen/runtime/distributed/parallel_state.py @@ -13,7 +13,7 @@ # Copyright 2023 The vLLM team. # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. -"""sgl-diffusion distributed state. +"""sglang-diffusion distributed state. It takes over the control of the distributed environment from PyTorch. The typical workflow is: diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/cli/generate.py b/python/sglang/multimodal_gen/runtime/entrypoints/cli/generate.py index 22e53bdd6..948b86375 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/cli/generate.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/cli/generate.py @@ -62,7 +62,7 @@ def generate_cmd(args: argparse.Namespace): class GenerateSubcommand(CLISubcommand): - """The `generate` subcommand for the sgl-diffusion CLI""" + """The `generate` subcommand for the sglang-diffusion CLI""" def __init__(self) -> None: self.name = "generate" diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/cli/main.py b/python/sglang/multimodal_gen/runtime/entrypoints/cli/main.py index 5158aab01..c35dec33d 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/cli/main.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/cli/main.py @@ -21,7 +21,7 @@ def cmd_init() -> list[CLISubcommand]: def main() -> None: - parser = FlexibleArgumentParser(description="sgl-diffusion CLI") + parser = FlexibleArgumentParser(description="sglang-diffusion CLI") parser.add_argument("-v", "--version", action="version", version="0.1.0") subparsers = parser.add_subparsers(required=False, dest="subparser") diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/cli/serve.py b/python/sglang/multimodal_gen/runtime/entrypoints/cli/serve.py index 3df5e3fd0..5f939a28d 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/cli/serve.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/cli/serve.py @@ -35,7 +35,7 @@ def execute_serve_cmd(args: argparse.Namespace, unknown_args: list[str] | None = class ServeSubcommand(CLISubcommand): - """The `serve` subcommand for the sgl-diffusion CLI""" + """The `serve` subcommand for the sglang-diffusion CLI""" def __init__(self) -> None: self.name = "serve" diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py b/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py index 787379f78..c1a95d930 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 """ -DiffGenerator module for sgl-diffusion. +DiffGenerator module for sglang-diffusion. This module provides a consolidated interface for generating videos using diffusion models. diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/utils.py b/python/sglang/multimodal_gen/runtime/entrypoints/utils.py index 7dc5f19e7..4ba679fe9 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/utils.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/utils.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 """ -DiffGenerator module for sgl-diffusion. +DiffGenerator module for sglang-diffusion. This module provides a consolidated interface for generating videos using diffusion models. diff --git a/python/sglang/multimodal_gen/runtime/launch_server.py b/python/sglang/multimodal_gen/runtime/launch_server.py index 36bc44c6e..0f34166ae 100644 --- a/python/sglang/multimodal_gen/runtime/launch_server.py +++ b/python/sglang/multimodal_gen/runtime/launch_server.py @@ -66,7 +66,7 @@ def launch_server(server_args: ServerArgs, launch_http_server: bool = True): task_pipes_to_slaves_w, result_pipes_from_slaves_r, ), - name=f"sgl-diffusionWorker-{i}", + name=f"sglang-diffusionWorker-{i}", daemon=True, ) else: # Slave workers @@ -83,7 +83,7 @@ def launch_server(server_args: ServerArgs, launch_http_server: bool = True): task_pipes_to_slaves_r[i - 1], result_pipes_from_slaves_w[i - 1], ), - name=f"sgl-diffusionWorker-{i}", + name=f"sglang-diffusionWorker-{i}", daemon=True, ) scheduler_pipe_readers.append(reader) diff --git a/python/sglang/multimodal_gen/runtime/layers/attention/selector.py b/python/sglang/multimodal_gen/runtime/layers/attention/selector.py index 19c407663..b5d589f79 100644 --- a/python/sglang/multimodal_gen/runtime/layers/attention/selector.py +++ b/python/sglang/multimodal_gen/runtime/layers/attention/selector.py @@ -41,7 +41,7 @@ def backend_name_to_enum(backend_name: str) -> AttentionBackendEnum | None: def get_env_variable_attn_backend() -> AttentionBackendEnum | None: """ - Get the backend override specified by the sgl-diffusion attention + Get the backend override specified by the sglang-diffusion attention backend environment variable, if one is specified. Returns: @@ -169,7 +169,7 @@ def global_force_attn_backend_context_manager( attn_backend: AttentionBackendEnum, ) -> Generator[None, None, None]: """ - Globally force a sgl-diffusion attention backend override within a + Globally force a sglang-diffusion attention backend override within a context manager, reverting the global attention backend override to its prior state upon exiting the context manager. diff --git a/python/sglang/multimodal_gen/runtime/loader/fsdp_load.py b/python/sglang/multimodal_gen/runtime/loader/fsdp_load.py index d11da7dc6..38c73c902 100644 --- a/python/sglang/multimodal_gen/runtime/loader/fsdp_load.py +++ b/python/sglang/multimodal_gen/runtime/loader/fsdp_load.py @@ -4,7 +4,7 @@ # Adapted from torchtune # Copyright 2024 The TorchTune Authors. -# Copyright 2025 The sgl-diffusion Authors. +# Copyright 2025 The sglang-diffusion Authors. import contextlib from collections.abc import Callable, Generator diff --git a/python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py b/python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py index d0e611db2..a9de61a54 100644 --- a/python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py +++ b/python/sglang/multimodal_gen/runtime/models/vaes/hunyuanvae.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # Adapted from diffusers -# Copyright 2024 The Hunyuan Team, The HuggingFace Team and The sgl-diffusion Team. All rights reserved. +# Copyright 2024 The Hunyuan Team, The HuggingFace Team and The sglang-diffusion Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/python/sglang/multimodal_gen/runtime/server_args.py b/python/sglang/multimodal_gen/runtime/server_args.py index a6d51434b..6b05fb7a5 100644 --- a/python/sglang/multimodal_gen/runtime/server_args.py +++ b/python/sglang/multimodal_gen/runtime/server_args.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # Inspired by SGLang: https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/server_args.py -"""The arguments of sgl-diffusion Inference.""" +"""The arguments of sglang-diffusion Inference.""" import argparse import dataclasses import inspect @@ -393,7 +393,7 @@ class ServerArgs: type=str, choices=ExecutionMode.choices(), default=ServerArgs.mode.value, - help="The mode to run sgl-diffusion", + help="The mode to run SGLang-diffusion", ) # Workload type diff --git a/python/sglang/multimodal_gen/utils.py b/python/sglang/multimodal_gen/utils.py index ae0386e5b..6a8f5958c 100644 --- a/python/sglang/multimodal_gen/utils.py +++ b/python/sglang/multimodal_gen/utils.py @@ -450,8 +450,8 @@ def import_pynvml(): status without initializing CUDA context in the current process. Historically, there are two packages that provide pynvml: - `nvidia-ml-py` (https://pypi.org/project/nvidia-ml-py/): The official - wrapper. It is a dependency of sgl-diffusion, and is installed when users - install sgl-diffusion. It provides a Python module named `pynvml`. + wrapper. It is a dependency of sglang-diffusion, and is installed when users + install sglang-diffusion. It provides a Python module named `pynvml`. - `pynvml` (https://pypi.org/project/pynvml/): An unofficial wrapper. Prior to version 12.0, it also provides a Python module `pynvml`, and therefore conflicts with the official one which is a standalone Python file.