Skip to content

Commit 18adf88

Browse files
committed
fix(flux2klein): route component XProf traces to output/flux2klein_generation/tensorboard/profile_* subdirectories
1 parent 20b15e9 commit 18adf88

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/maxdiffusion/flux2klein_pipeline.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ def put_data_on_devices(x, sharding):
404404
prompt_mask = put_data_on_devices(prompt_mask, data_sharding)
405405
do_prof_qwen3 = profile_target in ("all", "qwen3")
406406
if do_prof_qwen3:
407-
jax.profiler.start_trace("/tmp/xprof_qwen3")
407+
tb_dir = getattr(self._config, "tensorboard_dir", "/tmp")
408+
jax.profiler.start_trace(os.path.join(tb_dir, "profile_qwen3"))
408409
with jax.named_scope("qwen3_text_encoder"):
409410
prompt_embeds_jax = self._jitted_qwen3_forward(qwen3_params, prompt_ids, prompt_mask)
410411
prompt_embeds_jax.block_until_ready()
@@ -468,7 +469,8 @@ def put_data_on_devices(x, sharding):
468469

469470
do_prof_denoise = profile_target in ("all", "denoise")
470471
if do_prof_denoise:
471-
jax.profiler.start_trace("/tmp/xprof_denoise")
472+
tb_dir = getattr(self._config, "tensorboard_dir", "/tmp")
473+
jax.profiler.start_trace(os.path.join(tb_dir, "profile_denoise"))
472474
with jax.named_scope("fused_flux_denoise_loop"):
473475
latents_jax = self._jitted_fused_denoise_loop(
474476
params,
@@ -519,7 +521,8 @@ def put_data_on_devices(x, sharding):
519521

520522
do_prof_vae = profile_target in ("all", "vae")
521523
if do_prof_vae:
522-
jax.profiler.start_trace("/tmp/xprof_vae")
524+
tb_dir = getattr(self._config, "tensorboard_dir", "/tmp")
525+
jax.profiler.start_trace(os.path.join(tb_dir, "profile_vae"))
523526
with jax.named_scope("vae_decoder"):
524527
decoded_out = self._jitted_vae_decode(vae_params, latents_jax, vae_bn_mean_jax, vae_bn_std_jax, height, width)
525528
images_rgb = decoded_out.sample

src/maxdiffusion/pipelines/flux/flux2klein_pipeline.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ def put_data_on_devices(x, sharding):
404404
prompt_mask = put_data_on_devices(prompt_mask, data_sharding)
405405
do_prof_qwen3 = profile_target in ("all", "qwen3")
406406
if do_prof_qwen3:
407-
jax.profiler.start_trace("/tmp/xprof_qwen3")
407+
tb_dir = getattr(self._config, "tensorboard_dir", "/tmp")
408+
jax.profiler.start_trace(os.path.join(tb_dir, "profile_qwen3"))
408409
with jax.named_scope("qwen3_text_encoder"):
409410
prompt_embeds_jax = self._jitted_qwen3_forward(qwen3_params, prompt_ids, prompt_mask)
410411
prompt_embeds_jax.block_until_ready()
@@ -468,7 +469,8 @@ def put_data_on_devices(x, sharding):
468469

469470
do_prof_denoise = profile_target in ("all", "denoise")
470471
if do_prof_denoise:
471-
jax.profiler.start_trace("/tmp/xprof_denoise")
472+
tb_dir = getattr(self._config, "tensorboard_dir", "/tmp")
473+
jax.profiler.start_trace(os.path.join(tb_dir, "profile_denoise"))
472474
with jax.named_scope("fused_flux_denoise_loop"):
473475
latents_jax = self._jitted_fused_denoise_loop(
474476
params,
@@ -519,7 +521,8 @@ def put_data_on_devices(x, sharding):
519521

520522
do_prof_vae = profile_target in ("all", "vae")
521523
if do_prof_vae:
522-
jax.profiler.start_trace("/tmp/xprof_vae")
524+
tb_dir = getattr(self._config, "tensorboard_dir", "/tmp")
525+
jax.profiler.start_trace(os.path.join(tb_dir, "profile_vae"))
523526
with jax.named_scope("vae_decoder"):
524527
decoded_out = self._jitted_vae_decode(vae_params, latents_jax, vae_bn_mean_jax, vae_bn_std_jax, height, width)
525528
images_rgb = decoded_out.sample

0 commit comments

Comments
 (0)