Skip to content

Commit 9374611

Browse files
committed
Add process_allgather to VAE decode outputs for multi-host execution
1 parent b93edad commit 9374611

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/maxdiffusion/pipelines/flux/flux2klein_pipeline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ def __call__(
298298
# VAE output is in decoded_out.sample
299299
images_rgb = decoded_out.sample
300300
images_rgb.block_until_ready()
301+
if jax.process_count() > 1:
302+
from jax.experimental import multihost_utils
303+
images_rgb = multihost_utils.process_allgather(images_rgb, tiled=True)
301304

302305
trace["vae_decode"] = time.perf_counter() - t0
303306
max_logging.log(f" -> [TIMING] VAE Decoding: {trace['vae_decode']:.4f} seconds ⏱️")

0 commit comments

Comments
 (0)