Skip to content

Commit 177d687

Browse files
fix(wan): prevent duplicate batch concatenation on replicated VAE output
1 parent 62f6e69 commit 177d687

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/maxdiffusion/pipelines/wan/wan_pipeline.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,10 @@ def _decode_latents_to_video(self, latents: jax.Array, trace: Optional[dict] = N
940940
trace["vae_decode_tpu"] = time.perf_counter() - t_vae_tpu_start
941941

942942
if hasattr(video, "addressable_shards") and len(video.addressable_shards) > 0:
943-
video = np.concatenate([np.asarray(shard.data) for shard in video.addressable_shards], axis=0)
943+
if video.addressable_shards[0].data.shape[0] < video.shape[0]:
944+
video = np.concatenate([np.asarray(shard.data) for shard in video.addressable_shards], axis=0)
945+
else:
946+
video = np.asarray(video.addressable_shards[0].data)
944947
else:
945948
video = np.asarray(video)
946949
return video

0 commit comments

Comments
 (0)