edenartlab / sd-lora-trainer

LoRa trainer for SDXL and SD15
https://www.eden.art/
Other
24 stars 4 forks source link
embedding lora stable-diffusion

Trainer

This trainer was developed by the Eden team, you can try our hosted version of the trainer in our app. It's a highly optimized trainer that can be used for both full finetuning and training LoRa modules on top of Stable Diffusion. It uses a single training script and loss module that works for both SDv15 and SDXL!

The outputs of this trainer are fully compatible with ComfyUI and AUTO111, see documentation here. A full guide on training can be found in our docs.

Training images:
Image 1

Generated imgs with trained LoRa:
Image 2

The trainer can be run in 4 different ways:

Using in ComfyUI:

The trainer supports 3 default modes:

Style training example:
Image 1

Setup

Install all dependencies using

pip install -r requirements.txt

then you can simply run:

python main.py train_configs/training_args.json to start a training job.

Adjust the arguments inside training_args.json to setup a custom training job.


You can also run this through Replicate using cog (~docker image):

  1. Install Replicate 'cog':
sudo curl -o /usr/local/bin/cog -L "https://github.com/replicate/cog/releases/latest/download/cog_$(uname -s)_$(uname -m)"
sudo chmod +x /usr/local/bin/cog
  1. Build the image with cog build
  2. Run a training run with sh cog_test_train.sh
  3. You can also go into the container with cog run /bin/bash

Full unet finetuning

When running this trainer in native python, you can also perform full unet finetuning using something like (adjust to your needs) python main.py train_configs/full_finetuning_example.json

TODO's

Bugs:

Bigger improvements: