Linaqruf / kohya-trainer

Adapted from https://note.com/kohya_ss/n/nbf7ce8d80f29 for easier cloning
Apache License 2.0
1.82k stars 296 forks source link

Huge Changes Incoming #78

Closed Linaqruf closed 1 year ago

Linaqruf commented 1 year ago

I am working on updating Kohya's script to the latest version. The current version is from February 3rd, but the latest version in sd-scripts is from February 11th. This update will bring many new arguments and changes. I am also restructuring the notebooks to make the code more readable, maintainable, and user-friendly.

Here are some of the changes I have made:

  1. I have switched from using git-large-textcaps for auto captioning to using blip captioning with beam search enabled. The reason being that git is slower, while blip with beam search has similar quality.
  2. . I have deleted the Image Upscaler with R-ESRGAN cell because the bucketing already upscales images when converting to latents.
  3. I have combined the Login to Huggingface Hub cell with the cell where you define the model and dataset repository, making the workflow easier.
  4. New Arguments (useful for advanced users, but may confuse end-users):

5.I have chosen not to use these and let advanced users register new arguments in additional_arguments.

  1. have combined the data cleaning cell with the RGB -> RGBA converter.
  2. I have improved the model converter cell (in both the main and dreambooth notebooks).

Here's a sneak peek: https://colab.research.google.com/github/Linaqruf/kohya-trainer/blob/8c52bc700f8cbb68a6ee58e4f73e27067d885e5d/kohya-LoRA-dreambooth.ipynb

image

cdefghijkl commented 1 year ago

It would be helpful if you can write on there a little about the function of those arguments.

noriwaru commented 1 year ago

I get an error when I try to use 「bucket_reso_steps」and 「bucket_no_upscale」

train_network.py: error: unrecognized arguments: --bucket_no_upscale Traceback (most recent call last): File "/usr/local/bin/accelerate", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/accelerate_cli.py", line 45, in main args.func(args) File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/launch.py", line 1104, in launch_command simple_launcher(args) File "/usr/local/lib/python3.8/dist-packages/accelerate/commands/launch.py", line 567, in simple_launcher raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)

Linaqruf commented 1 year ago

you need to input dev to branch field image

Linaqruf commented 1 year ago

It would be helpful if you can write on there a little about the function of those arguments.

you can read it here, https://github.com/kohya-ss/sd-scripts

shinkarom commented 1 year ago

Can you add unet scale and text encoder scale? According to https://github.com/cloneofsimo/lora/discussions/37 , in original repo both items can be changed separately, and not having them at 1.0 can sometimes be better.

noriwaru commented 1 year ago

Thanks for your hard work.

Linaqruf commented 1 year ago
v13 (25/02):

What Changes?

News

Linaqruf commented 1 year ago

Please let me know if there is bugs, and error.

younyokel commented 1 year ago

pretty confusing fr

Linaqruf commented 1 year ago

Ikr, the trainer is more advanced than before, you can use old commit notebook or just train with default value if you find it too hard.

All new optimizer types, args, offset noise, caption dropout, new bucketing option, etc, too much new args to try, but not much time to try all of them.

Linaqruf commented 1 year ago

I didn't change anything about default value nor backend script (except tag reading) compared to the previous version. You need to provide a screenshot, training logs, or copied notebook with the same hyperparams and dataset so I can figure out what is the error.

And yes, max_train_epochs is not that accurate.

You can complain about backend script here instead : https://github.com/kohya-ss/sd-scripts

Linaqruf commented 1 year ago

something not passed to the accelerate, 1680 was the default maxsteps

i think this is because the linebreak \ in the training config image

can you check the train.sh to see all hyperparams passed?

Linaqruf commented 1 year ago

i need to change this to yaml asap