Skip to content

Commit 20a03d2

Browse files
committed
Onboard FLUX.2-klein pipeline and models into MaxDiffusion (JAX+TPU)
1 parent 55adaa2 commit 20a03d2

15 files changed

Lines changed: 1712 additions & 3079 deletions

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,22 @@ We added ring attention support for Wan models. Below are the stats for one `720
723723
```bash
724724
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
725725
```
726+
727+
### Flux.2-Klein (4B & 9B)
728+
729+
Flux.2-Klein provides ultra-fast 4-step image generation using Qwen3 text embeddings and FLUX.2 transformer blocks.
730+
731+
Flux.2-Klein 4B:
732+
733+
```bash
734+
python src/maxdiffusion/generate_flux2klein.py src/maxdiffusion/configs/base_flux2klein.yml run_name=flux2klein_4b prompt="A detailed vector illustration of a robotic hummingbird"
735+
```
736+
737+
Flux.2-Klein 9B:
738+
739+
```bash
740+
python src/maxdiffusion/generate_flux2klein.py src/maxdiffusion/configs/base_flux2klein_9B.yml run_name=flux2klein_9b prompt="A detailed vector illustration of a robotic hummingbird"
741+
```
726742
## Fused Attention for GPU:
727743
Fused Attention for GPU is supported via TransformerEngine. Installation instructions:
728744

src/maxdiffusion/configs/base_flux2klein.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ max_sequence_length: 512
4040
time_shift: True
4141
base_shift: 0.5
4242
max_shift: 1.15
43-
# offloads t5 encoder after text encoding to save memory.
44-
offload_encoders: False
4543

4644

4745
unet_checkpoint: ''
@@ -161,9 +159,9 @@ dcn_fsdp_parallelism: -1
161159
dcn_context_parallelism: 1
162160
dcn_tensor_parallelism: 1
163161
ici_data_parallelism: 1
164-
ici_fsdp_parallelism: 1
162+
ici_fsdp_parallelism: -1
165163
ici_context_parallelism: 1
166-
ici_tensor_parallelism: 4
164+
ici_tensor_parallelism: 1
167165

168166
allow_split_physical_axes: False
169167

@@ -176,7 +174,7 @@ cache_latents_text_encoder_outputs: True
176174
dataset_save_location: '/tmp/pokemon-gpt4-captions_xl'
177175
train_data_dir: ''
178176
dataset_config_name: ''
179-
jax_cache_dir: '/tmp/jax_cache'
177+
jax_cache_dir: ''
180178
hf_data_dir: ''
181179
hf_train_files: ''
182180
hf_access_token: ''

src/maxdiffusion/configs/base_flux2klein_9B.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ max_sequence_length: 512
4040
time_shift: True
4141
base_shift: 0.5
4242
max_shift: 1.15
43-
# offloads t5 encoder after text encoding to save memory.
44-
offload_encoders: False
4543

4644

4745
unet_checkpoint: ''
@@ -176,7 +174,7 @@ cache_latents_text_encoder_outputs: True
176174
dataset_save_location: '/tmp/pokemon-gpt4-captions_xl'
177175
train_data_dir: ''
178176
dataset_config_name: ''
179-
jax_cache_dir: '/tmp/jax_cache'
177+
jax_cache_dir: ''
180178
hf_data_dir: ''
181179
hf_train_files: ''
182180
hf_access_token: ''

0 commit comments

Comments
 (0)