edenartlab
/
sdxl-lora-trainer
LoRa trainer for both SDXL and SD15
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
|
{
"type": "object",
"title": "Input",
"required": [
"lora_training_urls"
],
"properties": {
"name": {
"type": "string",
"title": "Name",
"default": "unnamed",
"x-order": 0,
"description": "Name of new LORA concept"
},
"seed": {
"type": "integer",
"title": "Seed",
"x-order": 15,
"description": "Random seed for reproducible training. Leave empty to use a random seed"
},
"ti_lr": {
"type": "number",
"title": "Ti Lr",
"default": 0.001,
"x-order": 8,
"description": "Learning rate for training textual inversion embeddings. Don't alter unless you know what you're doing."
},
"unet_lr": {
"type": "number",
"title": "Unet Lr",
"default": 0.0003,
"x-order": 7,
"description": "final learning rate of unet (after warmup), increasing this usually leads to strong overfitting"
},
"n_tokens": {
"type": "integer",
"title": "N Tokens",
"default": 3,
"maximum": 4,
"minimum": 1,
"x-order": 10,
"description": "How many new tokens to train (highly recommended to leave this at 2)"
},
"lora_rank": {
"type": "integer",
"title": "Lora Rank",
"default": 16,
"x-order": 9,
"description": "Rank of LoRA embeddings for the unet."
},
"resolution": {
"type": "integer",
"title": "Resolution",
"default": 512,
"x-order": 6,
"description": "Square pixel resolution which your images will be resized to for training, highly recommended: 512 or 768"
},
"concept_mode": {
"enum": [
"style",
"face",
"object"
],
"type": "string",
"title": "concept_mode",
"description": "What are you trying to learn?",
"default": "style",
"x-order": 2
},
"n_sample_imgs": {
"type": "integer",
"title": "N Sample Imgs",
"default": 4,
"x-order": 12,
"description": "Number of sample images in validation grid"
},
"max_train_steps": {
"type": "integer",
"title": "Max Train Steps",
"default": 300,
"x-order": 4,
"description": "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"
},
"sd_model_version": {
"enum": [
"sdxl",
"sd15"
],
"type": "string",
"title": "sd_model_version",
"description": "SDXL gives much better LoRa's if you just need static images. If you want to make AnimateDiff animations, train an SD15 lora.",
"default": "sdxl",
"x-order": 3
},
"train_batch_size": {
"type": "integer",
"title": "Train Batch Size",
"default": 4,
"x-order": 11,
"description": "Batch size (per device) for training (dont increase unless running on a BIG GPU)"
},
"lora_training_urls": {
"type": "string",
"title": "Lora Training Urls",
"x-order": 1,
"description": "Training images for new LORA concept (can be image urls or an url to a .zip file of images)"
},
"checkpointing_steps": {
"type": "integer",
"title": "Checkpointing Steps",
"default": 10000,
"x-order": 5,
"description": "Save a checkpoint every n steps (The final checkpoint will always be saved)"
},
"validation_img_size": {
"type": "integer",
"title": "Validation Img Size",
"default": 1024,
"x-order": 13,
"description": "Resolution of sample images in validation grid"
},
"sample_imgs_lora_scale": {
"type": "number",
"title": "Sample Imgs Lora Scale",
"x-order": 14,
"description": "Scale factor for LoRa when generating sample images. If not provided, will be set automatically"
}
}
}
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"
}