[train_text_to_image_lora_sdxl.py] Fix the LR scheduler when num_train_epochs is passed in a distributed training env - #14528
Open
adi-IL wants to merge 1 commit into
Conversation
…ted training Scale warmup and training steps by accelerator.num_processes so --num_train_epochs builds the same schedule as the other official trainers after huggingface#8312.
Member
|
What is the difference from #14527? |
Author
|
#14527 updates the full fine-tuning script ( |
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.
Fixes #8384
Follow-up to #14527, still one script. This PR only updates
examples/text_to_image/train_text_to_image_lora_sdxl.py.What was wrong
When
--num_train_epochsis used, this trainer still built the LR schedule from the unsharded dataloader and ignoredaccelerator.num_processes. The official README already documents--num_train_epochs=2for this script, so the broken path is the documented one.What changed
Same #8312 math already in
train_text_to_image_lora.pyand the DreamBooth trainers:get_schedulerare scaled byaccelerator.num_processes.accelerator.prepare, we warn if the prepared dataloader length does not match that assumption.test_text_to_image_lora_sdxl_num_train_epochsso the--num_train_epochspath is covered.Coordination
Covered by the existing #8384 thread. No new issue comment. @sayakpaul @geniuspatrick
Minimal training command using
num_train_epochsTests I ran
That passed. I did not run the example pytest here because this machine does not have the package or its test extras installed. CI should run the new
test_text_to_image_lora_sdxl_num_train_epochsplus the existing LoRA SDXL smoke tests.Self-review
train_text_to_image_lora.py, not reinvented.num_train_epochsis passed in a distributed training env #8384 scripts alone.