Skip to content

[examples] Fix LR scheduler step count when num_train_epochs is set - #14743

Open
adi-IL wants to merge 1 commit into
huggingface:mainfrom
adi-IL:fix/lr-scheduler-num-train-epochs-umbrella
Open

[examples] Fix LR scheduler step count when num_train_epochs is set#14743
adi-IL wants to merge 1 commit into
huggingface:mainfrom
adi-IL:fix/lr-scheduler-num-train-epochs-umbrella

Conversation

@adi-IL

@adi-IL adi-IL commented Sep 9, 2026

Copy link
Copy Markdown

Why

Several example training scripts under-count LR scheduler steps when num_train_epochs is used (especially distributed). That leaves the scheduler short of the intended schedule.

Scope

One PR with the same fix across:

  • examples/text_to_image/train_text_to_image_sdxl.py (+ test)
  • examples/text_to_image/train_text_to_image_lora_sdxl.py (+ test)
  • examples/t2i_adapter/train_t2i_adapter_sdxl.py (+ test)
  • examples/textual_inversion/textual_inversion.py
  • examples/kandinsky2_2/text_to_image/train_text_to_image_prior.py

This supersedes #14527, #14528, #14540, #14546, and #14597 so review can happen once.

Verification

  • Ported tip contents from those five PRs onto current main.
  • Existing example tests updated where those PRs already covered them.

Happy to split again if maintainers prefer per-example PRs.

…stently

Same fix across training examples where num_train_epochs under-counted scheduler steps, especially in distributed runs.

Supersedes huggingface#14527 huggingface#14528 huggingface#14540 huggingface#14546 huggingface#14597.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant