Skip to content

[training] fix training resuming problem for fp16 (SD LoRA DreamBooth) #6554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 16, 2024

Conversation

a-r-r-o-w
Copy link
Member

@a-r-r-o-w a-r-r-o-w commented Jan 12, 2024

What does this PR do?

Part of #6552.

I'm yet to test it on a training run. I think Sayak mentioned he'll be opening a follow-up PR to add a utility function that removes the duplicated code.

First run:

CUDA_VISIBLE_DEVICES=0 accelerate launch train_dreambooth_lora.py \
  --pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5 \
  --instance_data_dir="dog" \
  --mixed_precision="fp16" \
  --instance_prompt="a photo of sks dog" \
  --output_dir="lora-dog-sd" \
  --resolution=512 \
  --train_batch_size=1 \
  --gradient_accumulation_steps=1 --gradient_checkpointing \
  --learning_rate=1e-4 \
  --lr_scheduler="constant" \
  --lr_warmup_steps=0 \
  --max_train_steps=4 --checkpointing_steps=2 --checkpoints_total_limit=2 \
  --use_8bit_adam \
  --seed="42"

Resume training:

CUDA_VISIBLE_DEVICES=0 accelerate launch train_dreambooth_lora.py \
  --pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5 \
  --instance_data_dir="dog" \
  --mixed_precision="fp16" \
  --instance_prompt="a photo of sks dog" \
  --output_dir="lora-dog-sd" \
  --resolution=512 \
  --train_batch_size=1 \
  --gradient_accumulation_steps=1 --gradient_checkpointing \
  --learning_rate=1e-4 \
  --lr_scheduler="constant" \
  --lr_warmup_steps=0 \
  --max_train_steps=4 --checkpointing_steps=2 --checkpoints_total_limit=2 \
  --resume_from_checkpoint="latest" \
  --use_8bit_adam \
  --seed="42"

Before submitting

Who can review?

@sayakpaul

@sayakpaul
Copy link
Member

Super fast! I have updated the description of #6552. It should be clear now.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sayakpaul
Copy link
Member

@a-r-r-o-w let me know if I can test it.

@a-r-r-o-w
Copy link
Member Author

Hi Sayak, this is ready for testing I believe, and seems to be working well. Here are my logs:

image

@sayakpaul
Copy link
Member

Just tested. Seems to be working well! Thank you!

@sayakpaul sayakpaul merged commit c11de13 into huggingface:main Jan 16, 2024
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants