Fix Wuerstchen LoRA scheduler steps for distributed epochs - #14748
Open
wunianze666-netizen wants to merge 2 commits into
Open
Fix Wuerstchen LoRA scheduler steps for distributed epochs#14748wunianze666-netizen wants to merge 2 commits into
wunianze666-netizen wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #8384. This PR addresses one unchecked script and must not close the umbrella tracker.
Coordination and reproduction evidence: #8384 (comment)
This updates only
examples/research_projects/wuerstchen/text_to_image/train_text_to_image_lora_prior.pyto size the learning-rate scheduler using the post-sharding update count and Accelerate's process-scaled scheduler contract.Root cause
The scheduler was created before
accelerator.prepare()from the unsharded dataloader length, while warmup and training steps were multiplied by gradient accumulation instead of the number of processes. In distributed epoch-based training, the optimizer therefore consumed only part of the intended schedule.The change mirrors the established #8312 pattern:
accelerator.num_processes;accelerator.prepare();Focused reproduction
With five pre-sharding batches, two CPU/Gloo processes, gradient accumulation 2, and one epoch:
0.333333;0.000000on both ranks.Additional uneven-sharding arithmetic cases (7 batches / 3 processes and 11 batches / 2 processes) also match the actual process-scaled scheduler call count after the change.
Minimal training command
Validation
ruff checkon the changed scriptruff format --checkon the changed scriptpython -m py_compileon the changed scriptgit diff --check upstream/main...HEADAI assistance and self-review
This contribution was developed with Codex assistance. I read the repository's AI-agent guidance and ran the repository self-review rubric after syncing with current
main.@sayakpaul @geniuspatrick