Stable Diffusion Finetuning and Deployment
Recommended tutorials before starting to work with stable diffusion finetuning and deployment jobs.
1. Create and upload datasets
Firstly we need to upload your images to our platform before finetuning stable diffusion model using these images. Navigate through the Stochastic Platform in the Datasets
side tab and select Add dataset
. Next, add your dataset name, dataset description, choose Image as type and browse your images folder. Then click Upload
to create an images dataset.
The number of images should be higher than 5 and lower than 30 and the original resolution should be higher than 512x512.
2. Create finetuning job
Navigate through the Jobs
side tab and select Create job
. You can select Stable Diffusion 1
or Stable Diffusion 2
as the initialized pretrained model for your finetuning job. Stable Diffusion 2
is chosen in this example.
Next, choose your uploaded images dataset and put your Class name
. Class name of the images dataset subject. Is recommended using generic classes such as man, woman, or child (if the subject is a person) or cat or dog (if the subject is a pet).
Finally, select number of saved checkpoints and click Start
to start finetune Stable Diffusion
on your dataset.
The finetuning job usually takes about 2 hours for Stable Diffusion 2
and about 1.2 hours for Stable Diffusion 1
.
3. Deploy finetuned model
After your finetuning job succeeded. Navigate through the Jobs
side tab and expand to see your saved checkpoints. Click Save
to choose the checkpoint which will be deployed.
Navigate through the Deploy
side tab and click Create deployments
to deploy your saved models. Next, put your deployment name and select your saved model then click Deploy
to deploy it.
Wait a bit until for deployment done then click to it to checkout how to use your deployment to generate images. We also provided example code to execute the API example for each programing language.
Note that your prompt should be start with sks
prefix and include the class name
you used in the finetuning phase. Below is the example with the prompt a photo of sks handsome football player raising the world cup championship trophy
with img_height
= 768 and img_width
= 768.