[examples] Fix LR scheduler step count when num_train_epochs is set by adi-IL · Pull Request #14743 · huggingface/diffusers · GitHub
Skip to content

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

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

adi-IL wants to merge 2 commits 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

Fixes #8384

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.
@github-actions

Copy link
Copy Markdown
Contributor

Resolve check_min_version conflicts by taking main's 0.42.0.dev0.
@github-actions github-actions Bot added fixes-issue size/M PR with diff < 200 LOC labels Oct 19, 2026
@adi-IL

adi-IL commented Oct 20, 2026

Copy link
Copy Markdown
Author

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples fixes-issue size/M PR with diff < 200 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Community] Help us fix the LR schedulers when num_train_epochs is passed in a distributed training env

1 participant