Skip to content

Commit f7154f8

Browse files
authored
Fix --resume_from_checkpoint step in train_text_to_image.py (huggingface#1914)
fix resume step in train_text_to_image example
1 parent 675ef1f commit f7154f8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

examples/text_to_image/train_text_to_image.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,8 @@ def collate_fn(examples):
685685
accelerator.load_state(os.path.join(args.output_dir, path))
686686
global_step = int(path.split("-")[1])
687687

688-
resume_global_step = global_step * args.gradient_accumulation_steps
689-
first_epoch = resume_global_step // num_update_steps_per_epoch
690-
resume_step = resume_global_step % num_update_steps_per_epoch
688+
first_epoch = global_step // num_update_steps_per_epoch
689+
resume_step = global_step % num_update_steps_per_epoch
691690

692691
# Only show the progress bar once on each machine.
693692
progress_bar = tqdm(range(global_step, args.max_train_steps), disable=not accelerator.is_local_main_process)

0 commit comments

Comments
 (0)