[diffusion] chore: refresh docs, retire stale knobs, and fix nightly attribution (#34663)
This commit is contained in:
@@ -9,7 +9,7 @@ SGLang diffusion features an end-to-end unified pipeline for accelerating diffus
|
||||
## Key Features
|
||||
|
||||
SGLang Diffusion has the following features:
|
||||
- Broad model support: Wan, FastWan, FLUX, Qwen-Image, Z-Image, Ideogram 4, Krea-2, Cosmos3, LTX-2/LTX-2.3, MiniMax-H3, LingBot World, SANA-WM, JoyEcho, MOVA, GLM-Image, ERNIE-Image, Hunyuan3D, and more
|
||||
- Broad model support: Wan, FastWan, FLUX, Qwen-Image, Z-Image, Ideogram 4, Krea-2, Cosmos3, LTX-2/LTX-2.3, MiniMax-H3, LingBot Video MoE, LingBot World, SANA-Video/SANA-WM, JoyEcho, MOVA, GLM-Image, ERNIE-Image, Hunyuan3D, and more
|
||||
- Fast inference speed: empowered by optimized `sgl-kernel` kernels, scheduler/runtime improvements, caching acceleration, and native diffusion hot-path optimizations
|
||||
- Ease of use: OpenAI-compatible api, CLI, and python sdk support
|
||||
- Multi-platform support:
|
||||
|
||||
@@ -728,12 +728,6 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Benchmark serving for diffusion models."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--backend",
|
||||
type=str,
|
||||
default=None,
|
||||
help="DEPRECATED: --task is deprecated and will be ignored. The task will be inferred from --model.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--base-url",
|
||||
type=str,
|
||||
|
||||
@@ -639,11 +639,12 @@ def _try_save_cuda_video_direct(
|
||||
stderr=stderr_file.read(),
|
||||
)
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
"Direct CUDA video save failed; falling back to imageio: %s",
|
||||
str(e),
|
||||
except Exception:
|
||||
logger.warning_once(
|
||||
"Direct CUDA video save failed; falling back to imageio. "
|
||||
"Enable debug logging for exception details."
|
||||
)
|
||||
logger.debug("Direct CUDA video save failure", exc_info=True)
|
||||
return False
|
||||
finally:
|
||||
if tmp_wav_path:
|
||||
@@ -725,11 +726,12 @@ def _try_save_cuda_videos_direct(
|
||||
try:
|
||||
with ThreadPoolExecutor(max_workers=_MAX_PARALLEL_CUDA_VIDEO_SAVES) as pool:
|
||||
return list(pool.map(save_one, range(len(samples))))
|
||||
except Exception as exc:
|
||||
logger.warning(
|
||||
"Parallel CUDA video save failed; falling back to serial output: %s",
|
||||
str(exc),
|
||||
except Exception:
|
||||
logger.warning_once(
|
||||
"Parallel CUDA video save failed; falling back to serial output. "
|
||||
"Enable debug logging for exception details."
|
||||
)
|
||||
logger.debug("Parallel CUDA video save failure", exc_info=True)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -151,8 +151,7 @@ class _SageAttentionBackendResolver(_CudaAttentionBackendResolver):
|
||||
def resolve(cls, platform) -> str | AttentionBackendEnum:
|
||||
try:
|
||||
from sageattention import sageattn # noqa: F401
|
||||
except ImportError as e:
|
||||
logger.info(e)
|
||||
except ImportError:
|
||||
logger.info(
|
||||
"Sage Attention backend is not installed (To install it, run `pip install git+https://github.com/thu-ml/SageAttention.git@d9704247a5139ab4c03bf7fc6b35cc0e2cbb5ea4 --no-build-isolation`). Falling back to Flash Attention."
|
||||
)
|
||||
@@ -176,8 +175,7 @@ class _SageAttentionBackendResolver(_CudaAttentionBackendResolver):
|
||||
)
|
||||
|
||||
return "sglang.multimodal_gen.runtime.layers.attention.backends.sage_attn.SageAttentionBackend"
|
||||
except ImportError as e:
|
||||
logger.info(e)
|
||||
except ImportError:
|
||||
logger.info(
|
||||
"Sage Attention backend failed to import. Falling back to Flash Attention."
|
||||
)
|
||||
@@ -195,8 +193,7 @@ class _SageAttention3BackendResolver(_CudaAttentionBackendResolver):
|
||||
)
|
||||
|
||||
return "sglang.multimodal_gen.runtime.layers.attention.backends.sage_attn3.SageAttention3Backend"
|
||||
except ImportError as e:
|
||||
logger.info(e)
|
||||
except ImportError:
|
||||
logger.info(
|
||||
"Sage Attention 3 backend is not installed (To install it, see https://github.com/thu-ml/SageAttention/tree/main/sageattention3_blackwell#installation). Falling back to Torch SDPA."
|
||||
)
|
||||
|
||||
@@ -86,7 +86,7 @@ from sglang.multimodal_gen.utils import (
|
||||
logger = init_logger(__name__)
|
||||
|
||||
LTX2_TWO_STAGE_DEVICE_MODES = ("original", "resident")
|
||||
LTX2_TWO_STAGE_DEVICE_MODE_CHOICES = (*LTX2_TWO_STAGE_DEVICE_MODES, "snapshot")
|
||||
LTX2_TWO_STAGE_DEVICE_MODE_CHOICES = LTX2_TWO_STAGE_DEVICE_MODES
|
||||
LTX2_TWO_STAGE_PIPELINE_NAMES = ("LTX2TwoStagePipeline", "LTX2TwoStageHQPipeline")
|
||||
# H200-class GPUs (>=130 GiB total) can usually keep both LTX2 DiTs resident.
|
||||
LTX2_RESIDENT_AUTO_ENABLE_MEM_GB = 130
|
||||
@@ -100,15 +100,7 @@ RING_CAPABLE_ATTENTION_BACKENDS = ("fa", "sage_attn")
|
||||
def _normalize_ltx2_two_stage_device_mode(mode: str | None) -> str | None:
|
||||
if mode is None:
|
||||
return None
|
||||
mode = mode.lower()
|
||||
if mode == "snapshot":
|
||||
logger.warning(
|
||||
"ltx2_two_stage_device_mode=snapshot is deprecated and is treated "
|
||||
"as original. Please use ltx2_two_stage_device_mode=original or "
|
||||
"resident instead. This alias may be removed after two release cycles."
|
||||
)
|
||||
return "original"
|
||||
return mode
|
||||
return mode.lower()
|
||||
|
||||
|
||||
def is_ltx2_two_stage_pipeline_name(pipeline_class_name: str | None) -> bool:
|
||||
@@ -2211,8 +2203,6 @@ class ServerArgs(DisaggServerArgsMixin):
|
||||
"LTX-2.3 two-stage device residency mode: "
|
||||
"'original' keeps official two-stage semantics without premerged stage2, "
|
||||
"'resident' keeps both transformers resident on GPU. "
|
||||
"'snapshot' is deprecated, treated as 'original', and may be "
|
||||
"removed after two release cycles. "
|
||||
"Default is auto: resident on H200/high-memory CUDA GPUs, otherwise original."
|
||||
),
|
||||
)
|
||||
|
||||
@@ -2001,24 +2001,19 @@ class TestOffloadDefaults(unittest.TestCase):
|
||||
["text_encoder", "image_encoder", "vae"],
|
||||
)
|
||||
|
||||
def test_ltx23_snapshot_device_mode_is_deprecated_alias_for_original(self):
|
||||
args = self._from_dict_with_pipeline_config(
|
||||
LTX2PipelineConfig(),
|
||||
memory_gb=140,
|
||||
available_memory_gb=134,
|
||||
kwargs={
|
||||
"model_path": "Lightricks/LTX-2.3",
|
||||
"num_gpus": 2,
|
||||
"pipeline_class_name": "LTX2TwoStagePipeline",
|
||||
"ltx2_two_stage_device_mode": "snapshot",
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEqual(args.ltx2_two_stage_device_mode, "original")
|
||||
self.assertEqual(
|
||||
args.layerwise_offload_components,
|
||||
["text_encoder", "image_encoder", "vae"],
|
||||
)
|
||||
def test_ltx23_snapshot_device_mode_is_rejected(self):
|
||||
with self.assertRaisesRegex(ValueError, "Expected one of"):
|
||||
self._from_dict_with_pipeline_config(
|
||||
LTX2PipelineConfig(),
|
||||
memory_gb=140,
|
||||
available_memory_gb=134,
|
||||
kwargs={
|
||||
"model_path": "Lightricks/LTX-2.3",
|
||||
"num_gpus": 2,
|
||||
"pipeline_class_name": "LTX2TwoStagePipeline",
|
||||
"ltx2_two_stage_device_mode": "snapshot",
|
||||
},
|
||||
)
|
||||
|
||||
def test_explicit_layerwise_components_preserved_in_ltx23_resident(self):
|
||||
args = self._from_dict_with_pipeline_config(
|
||||
@@ -2425,7 +2420,7 @@ class TestOffloadDefaults(unittest.TestCase):
|
||||
self.assertFalse(server_args.use_fsdp_inference)
|
||||
self.assertFalse(server_args.enable_cfg_parallel)
|
||||
|
||||
def test_ltx23_snapshot_device_mode_cli_alias_is_accepted(self):
|
||||
def test_ltx23_snapshot_device_mode_cli_is_rejected(self):
|
||||
parser = FlexibleArgumentParser()
|
||||
ServerArgs.add_cli_args(parser)
|
||||
argv = [
|
||||
@@ -2437,36 +2432,8 @@ class TestOffloadDefaults(unittest.TestCase):
|
||||
"snapshot",
|
||||
]
|
||||
|
||||
with (
|
||||
patch.object(sys, "argv", ["sglang"] + argv),
|
||||
patch.object(
|
||||
PipelineConfig, "from_kwargs", return_value=LTX2PipelineConfig()
|
||||
),
|
||||
patch(
|
||||
"sglang.multimodal_gen.runtime.platforms.current_platform.is_cpu",
|
||||
return_value=False,
|
||||
),
|
||||
patch(
|
||||
"sglang.multimodal_gen.runtime.platforms.current_platform.is_mps",
|
||||
return_value=False,
|
||||
),
|
||||
patch(
|
||||
"sglang.multimodal_gen.runtime.platforms.current_platform.is_cuda",
|
||||
return_value=True,
|
||||
),
|
||||
patch(
|
||||
"sglang.multimodal_gen.runtime.platforms.current_platform.get_device_total_memory",
|
||||
return_value=140 * 1024**3,
|
||||
),
|
||||
patch(
|
||||
"sglang.multimodal_gen.runtime.platforms.current_platform.get_available_gpu_memory",
|
||||
return_value=134,
|
||||
),
|
||||
):
|
||||
args, unknown_args = parser.parse_known_args(argv)
|
||||
server_args = ServerArgs.from_cli_args(args, unknown_args)
|
||||
|
||||
self.assertEqual(server_args.ltx2_two_stage_device_mode, "original")
|
||||
with self.assertRaises(SystemExit):
|
||||
parser.parse_known_args(argv)
|
||||
|
||||
|
||||
class TestKVGatherDegree(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user