[diffusion] Default Hunyuan VAE to tiled decode (#36012)

This commit is contained in:
Xiaoyu Zhang
2026-08-24 13:18:06 +08:00
committed by GitHub
parent f98b60de80
commit 344613c159
3 changed files with 34 additions and 1 deletions
+9
View File
@@ -212,6 +212,15 @@ vae_sp: true
enable_torch_compile: false
```
HunyuanVideo and FastHunyuan use tiled VAE decode by default so multi-GPU runs
distribute VAE tiles instead of selecting spatial-shard decode. At
HunyuanVideo's supported 960×544×77 shape, spatial-shard decode can consume
99.8 GiB per rank before requesting another 49.61 GiB causal mask. At
FastHunyuan's default 1280×720×125 shape, the mask alone would require
197.75 GiB. You can still override the policy with
`--vae-config.parallel-decode-mode`, but `spatial` and `spatial_shard` should
only be used for smaller validated shapes.
## Generate
`sglang generate` runs a single generation job and exits when the job finishes.
@@ -93,7 +93,9 @@ class HunyuanConfig(PipelineConfig):
# DiT
dit_config: DiTConfig = field(default_factory=HunyuanVideoConfig)
# VAE
vae_config: VAEConfig = field(default_factory=HunyuanVAEConfig)
vae_config: VAEConfig = field(
default_factory=lambda: HunyuanVAEConfig(parallel_decode_mode="tiled")
)
# Denoising stage
embedded_cfg_scale: int = 6
flow_shift: int = 7
@@ -0,0 +1,22 @@
# SPDX-License-Identifier: Apache-2.0
from sglang.multimodal_gen.configs.pipeline_configs.hunyuan import (
FastHunyuanConfig,
HunyuanConfig,
)
def test_hunyuan_configs_default_to_parallel_tiled_vae_decode():
for config_cls in (HunyuanConfig, FastHunyuanConfig):
assert config_cls().vae_config.parallel_decode_mode == "tiled"
def test_hunyuan_parallel_decode_mode_can_be_overridden():
for config_cls in (HunyuanConfig, FastHunyuanConfig):
config = config_cls()
config.update_config_from_dict(
{"vae_config.parallel_decode_mode": "spatial_shard"}
)
assert config.vae_config.parallel_decode_mode == "spatial_shard"