Fine-tuning Stable Diffusion
Build a config
Once your config is set, use it to create a
You can get your run's status with:
Once the run starts (
RUNNING), stream logs with:
- If you want a higher model quality at the expense of longer fine-tuning time:
- Increase the number of images in your dataset.
- For a faster fine-tuning run but lower model quality, do the opposite.
- If your instance prompt uses words that Stable Diffusion might not be familiar with, set
- If you don't have a lot of data, keep the learning rate low. For Stable Diffusion,
Monitor your run with Weights & Biases
Blueprint fine-tuning can integrate with Weights & Biases to monitor your fine-tuning run:
wandb_api_key="YOUR_API_KEY"to enable the integration.
image_log_stepsto control how many steps you see images for
This will enable you to see your model generate images as it is being fine-tuned.
FullStableDiffusionConfig reference for a complete list of parameters.
Your model will be automatically deployed
Once the fine-tuning run is complete, your model will be automatically deployed. You'll receive an email when the deployment is finished and the model is ready to invoke.
You can turn off this behavior by setting
FinetuningRun.create() and instead deploy your model manually.
Once your model is deployed, you can invoke it:
The model returns:
- The generated image (using Pillow)
- A URL to the generated image
For more on your newly deployed model, see the
Here's an example output from the above invocation: