[Feat] support HSDP for Qwen-image series, Z-Image, GLM-Image (#2029)

Signed-off-by: Lancer <maruixiang6688@gmail.com>
This commit is contained in:
Lancer authored and GitHub committed 2026-04-01 20:01:09 +08:00
1 parent 4e4bbc42a6
commit 70a62651b9
15 files changed
+83 -17

No files matched your search

@@ -170,7 +170,7 @@ class ZImagePipeline(nn.Module, DiffusionPipelineProfilerMixin):
self.text_encoder = AutoModel.from_pretrained(
model, subfolder="text_encoder", local_files_only=local_files_only
)
).to(self._execution_device)
self.vae = DistributedAutoencoderKL.from_pretrained(
model, subfolder="vae", local_files_only=local_files_only
).to(self._execution_device)
@@ -580,6 +580,12 @@ class ZImageTransformer2DModel(CachedTransformer):
_repeated_blocks = ["ZImageTransformerBlock"]
@staticmethod
def _is_transformer_block(name: str, module) -> bool:
return "layers" in name and name.split(".")[-1].isdigit()
_hsdp_shard_conditions = [_is_transformer_block]
# Sequence Parallelism for Z-Image (following diffusers' _cp_plan pattern)
# Similar to how Wan uses `rope` module's split_output to shard rotary embeddings,
# Z-Image uses `unified_prepare` module's split_output to shard unified tensors.