anotherjesse
/
dreambooth
this is where I test new dreambooths
- Public
- 276.5K runs
-
A100 (80GB)
Run anotherjesse/dreambooth 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 |
---|---|---|---|
pretrained_model |
string
(enum)
|
stabilityai/stable-diffusion-2-1
Options: stabilityai/stable-diffusion-2-1-base, stabilityai/stable-diffusion-2-1 |
Model identifier from huggingface.co/models
|
instance_prompt |
string
|
The prompt you use to describe your training images, in the format: `a [identifier] [class noun]`, where the `[identifier]` should be a rare token. Relatively short sequences with 1-3 letters work the best (e.g. `sks`, `xjy`). `[class noun]` is a coarse class descriptor of the subject (e.g. cat, dog, watch, etc.). For example, your `instance_prompt` can be: `a sks dog`, or with some extra description `a photo of a sks dog`. The trained model will learn to bind a unique identifier with your specific subject in the `instance_data`.
|
|
class_prompt |
string
|
The prompt or description of the coarse class of your training images, in the format of `a [class noun]`, optionally with some extra description. `class_prompt` is used to alleviate overfitting to your customised images (the trained model should still keep the learnt prior so that it can still generate different dogs when the `[identifier]` is not in the prompt). Corresponding to the examples of the `instant_prompt` above, the `class_prompt` can be `a dog` or `a photo of a dog`.
|
|
with_prior_preservation |
boolean
|
True
|
Flag to add prior preservation loss.
|
prior_loss_weight |
number
|
1
|
The weight of prior preservation loss.
|
instance_data |
string
|
A ZIP file containing your training images (JPG, PNG, etc. size not restricted). These images contain your 'subject' that you want the trained model to embed in the output domain for later generating customized scenes beyond the training images. For best results, use images without noise or unrelated objects in the background.
|
|
class_data |
string
|
An optional ZIP file containing the training data of class images. This corresponds to `class_prompt` above, also with the purpose of keeping the model generalizable. By default, the pretrained stable-diffusion model will generate N images (determined by the `num_class_images` you set) based on the `class_prompt` provided. But to save time or to have your preferred specific set of `class_data`, you can also provide them in a ZIP file.
|
|
num_class_images |
integer
|
50
|
Minimal class images for prior preservation loss. If not enough images are provided in class_data, additional images will be sampled with class_prompt.
|
seed |
integer
|
1337
|
A seed for reproducible training.
|
resolution |
integer
(enum)
|
768
Options: 512, 768 |
The resolution for input images. All the images in the train/validation dataset will be resized to this resolution.
|
center_crop |
boolean
|
False
|
Whether to center crop the input images to the resolution. If not set, the images will be randomly cropped. The images will be resized to the resolution first before cropping.
|
train_text_encoder |
boolean
|
True
|
Whether to train the text encoder. If set, the text encoder should be float32 precision.
|
train_batch_size |
integer
|
1
|
Batch size (per device) for the training dataloader.
|
sample_batch_size |
integer
|
4
|
Batch size (per device) for sampling images.
|
num_train_epochs |
integer
|
1
|
None
|
max_train_steps |
integer
|
2000
|
Total number of training steps to perform. If provided, overrides num_train_epochs.
|
gradient_accumulation_steps |
integer
|
1
|
Number of updates steps to accumulate before performing a backward/update pass.
|
gradient_checkpointing |
boolean
|
False
|
Whether or not to use gradient checkpointing to save memory at the expense of slower backward pass.
|
learning_rate |
number
|
0.000005
|
Initial learning rate (after the potential warmup period) to use.
|
scale_lr |
boolean
|
False
|
Scale the learning rate by the number of GPUs, gradient accumulation steps, and batch size.
|
lr_scheduler |
string
(enum)
|
constant
Options: linear, cosine, cosine_with_restarts, polynomial, constant, constant_with_warmup |
The scheduler type to use
|
lr_warmup_steps |
integer
|
0
|
Number of steps for the warmup in the lr scheduler.
|
lr_num_cycles |
integer
|
1
|
Number of hard resets of the lr in cosine_with_restarts scheduler.
|
lr_power |
number
|
1
|
Power factor of the polynomial scheduler.
|
use_8bit_adam |
boolean
|
False
|
Whether or not to use 8-bit Adam from bitsandbytes.
|
adam_beta1 |
number
|
0.9
|
The beta1 parameter for the Adam optimizer.
|
adam_beta2 |
number
|
0.999
|
The beta2 parameter for the Adam optimizer.
|
adam_weight_decay |
number
|
0.01
|
Weight decay to use
|
adam_epsilon |
number
|
0.00000001
|
Epsilon value for the Adam optimizer
|
max_grad_norm |
number
|
1
|
Max gradient norm.
|
hflip |
boolean
|
False
|
Whether or not to horizontally flip training images 50 percent of the time.
|
generate_images |
string
|
json of samples to generate: [{"name": "sample_name", "input": {"prompt": "a sks dog", "num_samples": 4, "save_guidance_scale": 7.5, "save_infer_steps": 50}}]
|
{
"type": "object",
"title": "Input",
"required": [
"instance_prompt",
"class_prompt",
"instance_data",
"generate_images"
],
"properties": {
"seed": {
"type": "integer",
"title": "Seed",
"default": 1337,
"x-order": 8,
"description": "A seed for reproducible training."
},
"hflip": {
"type": "boolean",
"title": "Hflip",
"default": false,
"x-order": 30,
"description": "Whether or not to horizontally flip training images 50 percent of the time."
},
"lr_power": {
"type": "number",
"title": "Lr Power",
"default": 1,
"x-order": 23,
"description": "Power factor of the polynomial scheduler."
},
"scale_lr": {
"type": "boolean",
"title": "Scale Lr",
"default": false,
"x-order": 19,
"description": "Scale the learning rate by the number of GPUs, gradient accumulation steps, and batch size."
},
"adam_beta1": {
"type": "number",
"title": "Adam Beta1",
"default": 0.9,
"x-order": 25,
"description": "The beta1 parameter for the Adam optimizer."
},
"adam_beta2": {
"type": "number",
"title": "Adam Beta2",
"default": 0.999,
"x-order": 26,
"description": "The beta2 parameter for the Adam optimizer."
},
"class_data": {
"type": "string",
"title": "Class Data",
"format": "uri",
"x-order": 6,
"description": "An optional ZIP file containing the training data of class images. This corresponds to `class_prompt` above, also with the purpose of keeping the model generalizable. By default, the pretrained stable-diffusion model will generate N images (determined by the `num_class_images` you set) based on the `class_prompt` provided. But to save time or to have your preferred specific set of `class_data`, you can also provide them in a ZIP file."
},
"resolution": {
"enum": [
512,
768
],
"type": "integer",
"title": "resolution",
"description": "The resolution for input images. All the images in the train/validation dataset will be resized to this resolution.",
"default": 768,
"x-order": 9
},
"center_crop": {
"type": "boolean",
"title": "Center Crop",
"default": false,
"x-order": 10,
"description": "Whether to center crop the input images to the resolution. If not set, the images will be randomly cropped. The images will be resized to the resolution first before cropping."
},
"adam_epsilon": {
"type": "number",
"title": "Adam Epsilon",
"default": 1e-08,
"x-order": 28,
"description": "Epsilon value for the Adam optimizer"
},
"class_prompt": {
"type": "string",
"title": "Class Prompt",
"x-order": 2,
"description": "The prompt or description of the coarse class of your training images, in the format of `a [class noun]`, optionally with some extra description. `class_prompt` is used to alleviate overfitting to your customised images (the trained model should still keep the learnt prior so that it can still generate different dogs when the `[identifier]` is not in the prompt). Corresponding to the examples of the `instant_prompt` above, the `class_prompt` can be `a dog` or `a photo of a dog`."
},
"lr_scheduler": {
"enum": [
"linear",
"cosine",
"cosine_with_restarts",
"polynomial",
"constant",
"constant_with_warmup"
],
"type": "string",
"title": "lr_scheduler",
"description": "The scheduler type to use",
"default": "constant",
"x-order": 20
},
"instance_data": {
"type": "string",
"title": "Instance Data",
"format": "uri",
"x-order": 5,
"description": "A ZIP file containing your training images (JPG, PNG, etc. size not restricted). These images contain your 'subject' that you want the trained model to embed in the output domain for later generating customized scenes beyond the training images. For best results, use images without noise or unrelated objects in the background."
},
"learning_rate": {
"type": "number",
"title": "Learning Rate",
"default": 5e-06,
"x-order": 18,
"description": "Initial learning rate (after the potential warmup period) to use."
},
"lr_num_cycles": {
"type": "integer",
"title": "Lr Num Cycles",
"default": 1,
"x-order": 22,
"description": "Number of hard resets of the lr in cosine_with_restarts scheduler."
},
"max_grad_norm": {
"type": "number",
"title": "Max Grad Norm",
"default": 1,
"x-order": 29,
"description": "Max gradient norm."
},
"use_8bit_adam": {
"type": "boolean",
"title": "Use 8Bit Adam",
"default": false,
"x-order": 24,
"description": "Whether or not to use 8-bit Adam from bitsandbytes."
},
"generate_images": {
"type": "string",
"title": "Generate Images",
"x-order": 31,
"description": "json of samples to generate: [{\"name\": \"sample_name\", \"input\": {\"prompt\": \"a sks dog\", \"num_samples\": 4, \"save_guidance_scale\": 7.5, \"save_infer_steps\": 50}}]"
},
"instance_prompt": {
"type": "string",
"title": "Instance Prompt",
"x-order": 1,
"description": "The prompt you use to describe your training images, in the format: `a [identifier] [class noun]`, where the `[identifier]` should be a rare token. Relatively short sequences with 1-3 letters work the best (e.g. `sks`, `xjy`). `[class noun]` is a coarse class descriptor of the subject (e.g. cat, dog, watch, etc.). For example, your `instance_prompt` can be: `a sks dog`, or with some extra description `a photo of a sks dog`. The trained model will learn to bind a unique identifier with your specific subject in the `instance_data`."
},
"lr_warmup_steps": {
"type": "integer",
"title": "Lr Warmup Steps",
"default": 0,
"x-order": 21,
"description": "Number of steps for the warmup in the lr scheduler."
},
"max_train_steps": {
"type": "integer",
"title": "Max Train Steps",
"default": 2000,
"x-order": 15,
"description": "Total number of training steps to perform. If provided, overrides num_train_epochs."
},
"num_class_images": {
"type": "integer",
"title": "Num Class Images",
"default": 50,
"x-order": 7,
"description": "Minimal class images for prior preservation loss. If not enough images are provided in class_data, additional images will be sampled with class_prompt."
},
"num_train_epochs": {
"type": "integer",
"title": "Num Train Epochs",
"default": 1,
"x-order": 14
},
"pretrained_model": {
"enum": [
"stabilityai/stable-diffusion-2-1-base",
"stabilityai/stable-diffusion-2-1"
],
"type": "string",
"title": "pretrained_model",
"description": "Model identifier from huggingface.co/models",
"default": "stabilityai/stable-diffusion-2-1",
"x-order": 0
},
"train_batch_size": {
"type": "integer",
"title": "Train Batch Size",
"default": 1,
"x-order": 12,
"description": "Batch size (per device) for the training dataloader."
},
"adam_weight_decay": {
"type": "number",
"title": "Adam Weight Decay",
"default": 0.01,
"x-order": 27,
"description": "Weight decay to use"
},
"prior_loss_weight": {
"type": "number",
"title": "Prior Loss Weight",
"default": 1,
"x-order": 4,
"description": "The weight of prior preservation loss."
},
"sample_batch_size": {
"type": "integer",
"title": "Sample Batch Size",
"default": 4,
"x-order": 13,
"description": "Batch size (per device) for sampling images."
},
"train_text_encoder": {
"type": "boolean",
"title": "Train Text Encoder",
"default": true,
"x-order": 11,
"description": "Whether to train the text encoder. If set, the text encoder should be float32 precision."
},
"gradient_checkpointing": {
"type": "boolean",
"title": "Gradient Checkpointing",
"default": false,
"x-order": 17,
"description": "Whether or not to use gradient checkpointing to save memory at the expense of slower backward pass."
},
"with_prior_preservation": {
"type": "boolean",
"title": "With Prior Preservation",
"default": true,
"x-order": 3,
"description": "Flag to add prior preservation loss."
},
"gradient_accumulation_steps": {
"type": "integer",
"title": "Gradient Accumulation Steps",
"default": 1,
"x-order": 16,
"description": "Number of updates steps to accumulate before performing a backward/update pass."
}
}
}
Output schema
The shape of the response you’ll get when you run this model with an API.
{
"type": "array",
"items": {
"type": "string",
"format": "uri"
},
"title": "Output"
}