From c1416bb3ee580660295f757a2e029d16f1ee879a Mon Sep 17 00:00:00 2001 From: Xiaoyu Zhang <1182563586@qq.com> Date: Sat, 20 Jun 2026 15:54:06 +0800 Subject: [PATCH] [Diffusion] Keep FastHunyuan VAE resident on high-memory GPUs (#28773) --- .../configs/pipeline_configs/hunyuan.py | 9 +++++++++ .../pipeline_configs/model_deployment_config.py | 2 +- .../runtime/server_args_auto_tune.py | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/python/sglang/multimodal_gen/configs/pipeline_configs/hunyuan.py b/python/sglang/multimodal_gen/configs/pipeline_configs/hunyuan.py index 66ec770fc..7ca5e4da0 100644 --- a/python/sglang/multimodal_gen/configs/pipeline_configs/hunyuan.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/hunyuan.py @@ -20,6 +20,9 @@ from sglang.multimodal_gen.configs.pipeline_configs.base import ( PipelineConfig, TextConditioningOutput, ) +from sglang.multimodal_gen.configs.pipeline_configs.model_deployment_config import ( + ModelDeploymentConfig, +) PROMPT_TEMPLATE_ENCODE_VIDEO = ( "<|start_header_id|>system<|end_header_id|>\n\nDescribe the video by detailing the following aspects: " @@ -158,3 +161,9 @@ class FastHunyuanConfig(HunyuanConfig): # No need to re-specify guidance_scale or embedded_cfg_scale as they # already have the desired values from HunyuanConfig + + def get_model_deployment_config(self) -> ModelDeploymentConfig: + return ModelDeploymentConfig( + auto_disable_component_offload_min_available_memory_gb=150, + auto_disable_component_offload_components=("vae",), + ) diff --git a/python/sglang/multimodal_gen/configs/pipeline_configs/model_deployment_config.py b/python/sglang/multimodal_gen/configs/pipeline_configs/model_deployment_config.py index 2c16ffbd2..e01994075 100644 --- a/python/sglang/multimodal_gen/configs/pipeline_configs/model_deployment_config.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/model_deployment_config.py @@ -6,7 +6,7 @@ ModelDeploymentConfig provides model-specific config on how to deploy a model op from dataclasses import dataclass from typing import Literal -OffloadComponentName = Literal["dit", "text_encoder", "image_encoder"] +OffloadComponentName = Literal["dit", "text_encoder", "image_encoder", "vae"] @dataclass(frozen=True) diff --git a/python/sglang/multimodal_gen/runtime/server_args_auto_tune.py b/python/sglang/multimodal_gen/runtime/server_args_auto_tune.py index bceb24fe4..1dc42aa86 100644 --- a/python/sglang/multimodal_gen/runtime/server_args_auto_tune.py +++ b/python/sglang/multimodal_gen/runtime/server_args_auto_tune.py @@ -107,6 +107,20 @@ class ServerArgsAutoTuner: components = ( self._deployment_config().auto_disable_component_offload_components ) + if ( + args.layerwise_offload_components is not None + and not args.is_arg_explicitly_set("layerwise_offload_components") + ): + layerwise_components = [ + component_name + for component_name in args.layerwise_offload_components + if component_name not in components + ] + if layerwise_components != args.layerwise_offload_components: + args.layerwise_offload_components = layerwise_components or None + changed.append( + f"layerwise_offload_components={args.layerwise_offload_components}" + ) if ( args.dit_cpu_offload and "dit" in components