Skip to content

Commit 7d83477

Browse files
committed
Fix multihost JAX Array fetching error in LTX2 pipelines by adding process_allgather before NumPy conversion
1 parent 9616d1c commit 7d83477

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/maxdiffusion/pipelines/ltx2/ltx2_pipeline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,7 @@ def convert_to_vel(lat, x0, sig):
18941894

18951895
# VAE outputs (B, T, H, W, C), but video processor expects (B, C, T, H, W)
18961896
t0_video_post = time.perf_counter()
1897+
video = jax.experimental.multihost_utils.process_allgather(video, tiled=True)
18971898
video_np = np.array(video).transpose(0, 4, 1, 2, 3)
18981899
video = self.video_processor.postprocess_video(torch.from_numpy(video_np), output_type=output_type)
18991900
video_post_time = time.perf_counter() - t0_video_post
@@ -1917,6 +1918,7 @@ def convert_to_vel(lat, x0, sig):
19171918
audio = self._jitted_vocoder(self.vocoder, generated_mel_spectrograms)
19181919

19191920
# Convert audio to numpy
1921+
audio = jax.experimental.multihost_utils.process_allgather(audio, tiled=True)
19201922
audio = np.array(audio)
19211923
vocoder_time = time.perf_counter() - t0_vocoder
19221924
max_logging.log(f"Vocoder & Audio numpy time: {vocoder_time:.2f}s")

src/maxdiffusion/pipelines/ltx2/pipeline_ltx2_latent_upsample.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def __call__(
250250
if video.dtype == jnp.bfloat16:
251251
video = video.astype(jnp.float32)
252252

253+
video = jax.experimental.multihost_utils.process_allgather(video, tiled=True)
253254
video = np.transpose(np.array(video), (0, 4, 1, 2, 3))
254255
video = self.video_processor.postprocess_video(video, output_type=output_type)
255256

0 commit comments

Comments
 (0)