Skip to content

Commit 4dce374

Browse files
authored
Fix training push_to_hub (unconditional image generation): models were not saved before pushing to hub (#868)
Fix: models were not saved before pushing to hub.
1 parent 52e8fdb commit 4dce374

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

examples/unconditional_image_generation/train_unconditional.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,9 @@ def transforms(examples):
184184

185185
if epoch % args.save_model_epochs == 0 or epoch == args.num_epochs - 1:
186186
# save the model
187+
pipeline.save_pretrained(args.output_dir)
187188
if args.push_to_hub:
188189
repo.push_to_hub(commit_message=f"Epoch {epoch}", blocking=False)
189-
else:
190-
pipeline.save_pretrained(args.output_dir)
191190
accelerator.wait_for_everyone()
192191

193192
accelerator.end_training()

0 commit comments

Comments
 (0)