{ "cells": [ { "cell_type": "markdown", "source": [ "# Notice:\n", "To train Dreambooth Stable Diffusion requires a recommended minimum of 16 GB of GPU RAM. Trying to train Dreambooth with less will trigger an Out of Memory error. This Notebook is defaulted to set up to run on the RTX5000 GPU, which requires a paid account on Gradient. \n", "\n", "Change the URL at the top where it says \"machine?=RTX5000\" to any GPU with at least 16 GB of RAM to run training. The P6000, V100, V100-32G, RTX5000, A4000, A5000, A100, and A100-80G powered machines will all be able to run this training. \n", "\n", "You can do so by changing the following URL where it says \"(YOUR-GPU-CHOICE)\":\n", "\n", " https://console.paperspace.com/github/gradient-ai/dreambooth-stable-diffusion/blob/main/sd_dreambooth_gradient.ipynb?machine=(YOUR-GPU-CHOICE)\n" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "# Dreambooth fine-tuning for Stable Diffusion using d🧨ffusers with Gradient Notebooks\n", "\n", "This notebook shows how to \"teach\" Stable Diffusion a new concept via Dreambooth using 🤗 Hugging Face [🧨 Diffusers library](https://github.com/huggingface/diffusers). \n", "\n", "![Dreambooth Example](https://dreambooth.github.io/DreamBooth_files/teaser_static.jpg)\n", "_By using just 3-5 images you can teach new concepts to Stable Diffusion and personalize the model on your own images_ \n", "\n", "Differently from Textual Inversion, this approach trains the whole model, which can yield better results to the cost of bigger models.\n", "\n", "For a general introduction to the Stable Diffusion model please refer to this [Gradient Notebook](https://console.paperspace.com/github/gradient-ai/stable-diffusion/blob/main/stable-diffusion-notebook.ipynb?machine=A4000).\n", "\n" ], "metadata": { "id": "tAZq3vFDcFiT" } }, { "cell_type": "markdown", "source": [ "## Installation" ], "metadata": { "id": "KbzZ9xe6dWwf" } }, { "cell_type": "code", "execution_count": 1, "source": [ "#@title Install the required libs\n", "!pip install -qq accelerate tensorboard ftfy\n", "!pip install -qq --upgrade diffusers[torch] --no-cache-dir\n", "!pip install -qq -U transformers\n", "!pip install -qq bitsandbytes\n", "!pip install gradio\n", "!mkdir inputs\n", "!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui" ], "outputs": [], "metadata": { "execution": { "iopub.execute_input": "2022-10-28T17:34:36.733188Z", "iopub.status.busy": "2022-10-28T17:34:36.732409Z", "iopub.status.idle": "2022-10-28T17:34:46.339367Z", "shell.execute_reply": "2022-10-28T17:34:46.338666Z", "shell.execute_reply.started": "2022-10-28T17:34:36.733122Z" }, "id": "30lu8LWXmg5j" } }, { "cell_type": "markdown", "source": [ "# Loading in the Stable Diffusion v1-5 models\n", "\n", "To make accessing the Stable Diffusion models easy and not take up any storage, we have added the Stable Diffusion models v1-5 as mountable public datasets! To access the models this way, simply navigate to the \"Data Sources\" tab using the navigator on the far left of the page. Then click \"Public\" to switch into the Gradient Public Datasets, and scroll down until you find \"stable-diffusion\" near the bottom of the list. Then, click \"mount\" to make them accessible from the \"datasets\" directory. This directory is in the root folder, so access it with the path `../datasets/stable-diffusion-diffusers/stable-diffusion-v1-5`\n", "\n", "> Note that these public dataset files will not count toward the file storage limits \n", "\n", "\n", "