You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-22Lines changed: 37 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -677,45 +677,60 @@ We added ring attention support for Wan models. Below are the stats for one `720
677
677
python src/maxdiffusion/generate_flux.py src/maxdiffusion/configs/base_flux_schnell.yml jax_cache_dir=/tmp/cache_dir run_name=flux_test output_dir=/tmp/ prompt="photograph of an electronics chip in the shape of a race car with trillium written on its side" per_device_batch_size=1 ici_data_parallelism=1 ici_fsdp_parallelism=-1 offload_encoders=False
678
678
```
679
679
680
-
## Flux.2-klein-4B
680
+
## Flux.2-klein (4B & 9B)
681
681
682
-
MaxDiffusion supports JAX+TPU inference for the**Flux.2-klein-4B**model. We provide both a standard one-shot generation script and an **interactive generation mode** that reuses the JAX/XLA compiled graphs for instant subsequent runs.
682
+
MaxDiffusion supports JAX+TPU inference for both**Flux.2-klein-4B**and **Flux.2-klein-9B** models. We provide both a standard one-shot generation script and an **interactive generation mode** that keeps parameters in TPU HBM and reuses compiled JAX/XLA execution graphs for instant subsequent image generation.
prompt="an anime corgi eating sushi in the mountains"
690
696
```
691
697
692
-
To enable **interactive mode** (reusing the compiled graphs to avoid JIT compilation latency on subsequent prompts):
698
+
> **Switching Between 4B & 9B**:
699
+
> You can switch between 4B and 9B by passing the appropriate YAML config (`base_flux2klein.yml` for 4B, `base_flux2klein_9B.yml` for 9B) or by overriding `flux_name` via CLI arguments:
700
+
> * For 4B: `flux_name="flux2-klein-4b" pretrained_model_name_or_path="black-forest-labs/FLUX.2-klein-4B"`
701
+
> * For 9B: `flux_name="flux2-klein-9b" pretrained_model_name_or_path="black-forest-labs/FLUX.2-klein-9B"`
To avoid JIT re-compilation latency when testing multiple prompts, enable `interactive=True`. The model weights remain loaded in TPU memory, and after the initial warmup pass, each new prompt generates in **~0.9s**:
0 commit comments