Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/maxdiffusion/configs/base_flux2klein.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ num_train_epochs: 1
seed: 0
output_dir: 'output/'
output_name: "flux2klein_generated_image.png"
per_device_batch_size: 1
per_device_batch_size: 1.0

warmup_steps_fraction: 0.1
learning_rate_schedule_steps: -1 # By default the length of the schedule is set to the number of steps.
Expand Down Expand Up @@ -231,6 +231,7 @@ do_classifier_free_guidance: True
guidance_scale: 4.0
guidance_rescale: 0.0
num_inference_steps: 4
num_reps: 1
save_final_checkpoint: False

# SDXL Lightning parameters
Expand Down
3 changes: 2 additions & 1 deletion src/maxdiffusion/configs/base_flux2klein_9B.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ num_train_epochs: 1
seed: 0
output_dir: 'output/'
output_name: "flux2klein_generated_image.png"
per_device_batch_size: 1
per_device_batch_size: 1.0

warmup_steps_fraction: 0.1
learning_rate_schedule_steps: -1 # By default the length of the schedule is set to the number of steps.
Expand Down Expand Up @@ -231,6 +231,7 @@ do_classifier_free_guidance: True
guidance_scale: 4.0
guidance_rescale: 0.0
num_inference_steps: 4
num_reps: 1
save_final_checkpoint: False

# SDXL Lightning parameters
Expand Down
355 changes: 220 additions & 135 deletions src/maxdiffusion/generate_flux2klein.py

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/maxdiffusion/max_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,13 @@ def device_put_replicated(x, sharding):
Although the name indicates replication, this function can be used
to also shard an array based on sharding.
"""
return jax.make_array_from_callback(x.shape, sharding, lambda index: x[index])
arr = getattr(x, "value", x)
shd = getattr(sharding, "value", sharding)
res = jax.make_array_from_callback(arr.shape, shd, lambda index: arr[index])
if hasattr(x, "set_value"):
x.set_value(res)
return x
return res


def fill_unspecified_mesh_axes(parallelism_vals, target_product, parallelism_type):
Expand Down
Loading
Loading