How to fine-tune Stable Diffusion with Dreambooth using DeepInfra

Published on 2023.04.05 by Yessen Kanapin

How to fine-tune Stable Diffusion with Dreambooth using DeepInfra header picture

Getting started

First install the deepctl command line tool.

curl https://deepinfra.com/get.sh | sh

Login to DeepInfra (using your GitHub account)

deepctl login

This will take you to the browser to login in DeepInfra using your GitHub account. When you are done, come back to the terminal.

Fine-tuning

Dreambooth is a fine-tuning technique that lets Stable Diffusion mimic patterns provided in the subject's instance data. You will need an archive containing 10-20 images of an instance. We recommend resizing images to 512x512, resolution which Stable Diffusion 1.5 was trained in. For instance prompt you can use 3 letter sequence (e.g. "zwt"). For max_train_steps we recommend something between 800 and 2000. You have to pass output_model_name, to use later for inference on your fine-tuned model.

deepctl infer -m 'deepinfra/dreambooth'\
              -i 'instance_prompt=["a photo of zwt person"]'\
              -i 'class_prompt=["a photo of a person"]'\
              -i instance_data=@/path/to/instance_data.zip\
              -i max_train_steps=800\
              -i output_model_name=your_github_username/your_custom_model_name

You can use it with either our rest API or our deepctl command line too. Here is how to use it with the command line tool:

deepctl infer -m your_github_username/your_custom_model_name\
              -i prompt="a colorful painting of zwt person"\
              -o images=zwt_gta5.png

To see the full documentation of how to call this model checkout out the documentation page:

deepctl model info -m your_github_username/your_custom_model_name

If you have any question, just reach out to us on our Discord server.


© 2023 Deep Infra. All rights reserved.

Discord Logo