Skip to content
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7100f71
Fix typos
tolgacangoz Feb 21, 2024
9e9c819
Add license header to train_text_to_image_flax.py
tolgacangoz Feb 21, 2024
1ae2e98
Fix image saving bug in text_to_image scripts
tolgacangoz Feb 21, 2024
bc78790
Fix exponential moving average (EMA) during training
tolgacangoz Feb 21, 2024
1b141c1
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 21, 2024
2b370a3
Discard changes to examples/text_to_image/README.md
tolgacangoz Feb 21, 2024
7ab995d
Discard changes to examples/text_to_image/README_sdxl.md
tolgacangoz Feb 21, 2024
314befa
Discard changes to examples/text_to_image/train_text_to_image.py
tolgacangoz Feb 21, 2024
98469c3
Discard changes to examples/text_to_image/train_text_to_image_flax.py
tolgacangoz Feb 21, 2024
1c11a0d
Discard changes to examples/text_to_image/train_text_to_image_lora.py
tolgacangoz Feb 21, 2024
6fd8aa1
Discard changes to examples/text_to_image/train_text_to_image_lora_sd…
tolgacangoz Feb 21, 2024
0271c39
Update train_text_to_image_sdxl.py
tolgacangoz Feb 21, 2024
46a2bd3
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 22, 2024
775ff68
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 22, 2024
451599e
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 23, 2024
c18645e
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 23, 2024
b4dc9ae
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 24, 2024
5e062a0
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 24, 2024
a043b48
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 25, 2024
4f4b2e6
Merge branch 'main' into update_train_text_to_image_folder
tolgacangoz Feb 26, 2024
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
5 changes: 5 additions & 0 deletions examples/text_to_image/train_text_to_image_sdxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,9 @@ def collate_fn(examples):
unet, optimizer, train_dataloader, lr_scheduler
)

if args.use_ema:
ema_unet.to(accelerator.device)

# We need to recalculate our total training steps as the size of the training dataloader may have changed.
num_update_steps_per_epoch = math.ceil(len(train_dataloader) / args.gradient_accumulation_steps)
if overrode_max_train_steps:
Expand Down Expand Up @@ -1126,6 +1129,8 @@ def compute_time_ids(original_size, crops_coords_top_left):

# Checks if the accelerator has performed an optimization step behind the scenes
if accelerator.sync_gradients:
if args.use_ema:
ema_unet.step(unet.parameters())
progress_bar.update(1)
global_step += 1
accelerator.log({"train_loss": train_loss}, step=global_step)
Expand Down