diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Fix saving text encoder weights and kohya weights in advanced dreambooth lora script

Open DN6 opened this issue 1 year ago • 1 comments

What does this PR do?

There seems to be an issue with

  1. Saving Kohya style weights in the dreambooth advanced lora script. The save path can output a weird directory when using a relative path. e.g. setting output_dir=../checkpoints/my-dog-model will result in the following line creating a path like '../checkpoints/my-dog-model/../checkpoints/my-dog-model.safetensors' https://github.com/huggingface/diffusers/blob/610a71d7d467e4cc892c824db882071ff0d282e1/examples/advanced_diffusion_training/train_dreambooth_lora_sd15_advanced.py#L1984

I've changed this to save the kohya weight as args.output_dir/kohya_lora_weights.safetensors but I'm open to any better naming.

  1. When passing in the train_text_encoder argument, I believe there is a missing else statement resulting in an ValueError always being raised.

Fixes # (issue)

Before submitting

  • [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • [ ] Did you read the contributor guideline?
  • [ ] Did you read our philosophy doc (important for complex PRs)?
  • [ ] Was this discussed/approved via a GitHub issue or the forum? Please add a link to it if that's the case.
  • [ ] Did you make sure to update the documentation with your changes? Here are the documentation guidelines, and here are tips on formatting docstrings.
  • [ ] Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag members/contributors who may be interested in your PR.

DN6 avatar Jul 02 '24 06:07 DN6

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.