edenartlab / sdxl-lora-trainer

LoRa trainer for both SDXL and SD15

  • Public
  • 5.1K runs
  • GitHub
  • License

Run edenartlab/sdxl-lora-trainer with an API

Use one of our client libraries to get started quickly. Clicking on a library will take you to the Playground tab where you can tweak different inputs, see the results, and copy the corresponding code to use in your own project.

Input schema

The fields you can use to run this model with an API. If you don't give a value for a field its default value will be used.

Field Type Default value Description
name
string
unnamed
Name of new LORA concept
lora_training_urls
string
Training images for new LORA concept (can be image urls or an url to a .zip file of images)
concept_mode
string (enum)
style

Options:

style, face, object

What are you trying to learn?
sd_model_version
string (enum)
sdxl

Options:

sdxl, sd15

SDXL gives much better LoRa's if you just need static images. If you want to make AnimateDiff animations, train an SD15 lora.
max_train_steps
integer
300
Number of training steps. Increasing this usually leads to overfitting, only viable if you have > 100 training imgs. For faces you may want to reduce to eg 300
checkpointing_steps
integer
10000
Save a checkpoint every n steps (The final checkpoint will always be saved)
resolution
integer
512
Square pixel resolution which your images will be resized to for training, highly recommended: 512 or 768
unet_lr
number
0.0003
final learning rate of unet (after warmup), increasing this usually leads to strong overfitting
ti_lr
number
0.001
Learning rate for training textual inversion embeddings. Don't alter unless you know what you're doing.
lora_rank
integer
16
Rank of LoRA embeddings for the unet.
n_tokens
integer
3

Min: 1

Max: 4

How many new tokens to train (highly recommended to leave this at 2)
train_batch_size
integer
4
Batch size (per device) for training (dont increase unless running on a BIG GPU)
n_sample_imgs
integer
4
Number of sample images in validation grid
validation_img_size
integer
1024
Resolution of sample images in validation grid
sample_imgs_lora_scale
number
Scale factor for LoRa when generating sample images. If not provided, will be set automatically
seed
integer
Random seed for reproducible training. Leave empty to use a random seed

Output schema

The shape of the response you’ll get when you run this model with an API.

Schema
{
  "type": "array",
  "items": {
    "type": "object",
    "title": "CogOutput",
    "properties": {
      "name": {
        "type": "string",
        "title": "Name"
      },
      "files": {
        "type": "array",
        "items": {
          "type": "string",
          "format": "uri"
        },
        "title": "Files",
        "default": []
      },
      "isFinal": {
        "type": "boolean",
        "title": "Isfinal",
        "default": false
      },
      "progress": {
        "type": "number",
        "title": "Progress"
      },
      "attributes": {
        "type": "object",
        "title": "Attributes"
      },
      "thumbnails": {
        "type": "array",
        "items": {
          "type": "string",
          "format": "uri"
        },
        "title": "Thumbnails",
        "default": []
      }
    }
  },
  "title": "Output",
  "x-cog-array-type": "iterator"
}