Skip to content

Commit d4e2f7d

Browse files
authored
Merge pull request #939 from d8ahazard/dev
Rock and ROLL!
2 parents 43ae9d5 + 9c18904 commit d4e2f7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+5830
-5910
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ liberapay: # Replace with a single Liberapay username
1010
issuehunt: # Replace with a single IssueHunt username
1111
otechie: # Replace with a single Otechie username
1212
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13-
custom: ['https://www.paypal.com/donate/?hosted_button_id=UWE4GTY3JR7GY']
13+
custom: [ 'https://www.paypal.com/donate/?hosted_button_id=UWE4GTY3JR7GY' ]

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ labels: ''
66
assignees: ''
77

88
---
9+
910
### Kindly read the entire form below and fill it out with the requested information.
1011

1112
**WHAT**

.github/autoclose.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Autocloser
2-
on: [issues]
2+
on: [ issues ]
33
jobs:
44
autoclose:
55
runs-on: ubuntu-latest
66
steps:
7-
- name: Auto-close issues that did not follow issue template
8-
uses: roots/issue-closer@v1.1
9-
with:
10-
repo-token: ${{ secrets.GITHUB_TOKEN }}
11-
issue-close-message: "@${issue.user.login} This issue was automatically closed because you didn't use the template. Go here and try again: https://github.com/d8ahazard/sd_dreambooth_extension/issues/new/choose"
12-
issue-pattern: ".### Kindly read the entire form below and fill it out with the requested information."
7+
- name: Auto-close issues that did not follow issue template
8+
uses: roots/issue-closer@v1.1
9+
with:
10+
repo-token: ${{ secrets.GITHUB_TOKEN }}
11+
issue-close-message: "@${issue.user.login} This issue was automatically closed because you didn't use the template. Go here and try again: https://github.com/d8ahazard/sd_dreambooth_extension/issues/new/choose"
12+
issue-pattern: ".### Kindly read the entire form below and fill it out with the requested information."

D8-DreamBooth.ipynb

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"provenance": []
7+
},
8+
"kernelspec": {
9+
"name": "python3",
10+
"display_name": "Python 3"
11+
},
12+
"language_info": {
13+
"name": "python"
14+
},
15+
"accelerator": "GPU",
16+
"gpuClass": "standard"
17+
},
18+
"cells": [
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {
22+
"id": "view-in-github"
23+
},
24+
"source": [
25+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/d8ahazard/sd_dreambooth_extension/blob/Torch2/D8-DreamBooth.ipynb)"
26+
]
27+
},
28+
{
29+
"cell_type": "code",
30+
"source": [
31+
"from google.colab import drive\n",
32+
"import os\n",
33+
"\n",
34+
"drive.mount(\"/content/gdrive\", force_remount=True)\n",
35+
"\n",
36+
"if not os.path.exists(\"/content/gdrive/MyDrive/sd-db-d8\"):\n",
37+
" os.mkdirs(\"/content/gdrive/MyDrive/sd-db-d8\")\n",
38+
"\n",
39+
"if not os.path.exists(\"/content/working/\"):\n",
40+
" os.mkdirs(\"/content/working/\")\n",
41+
"\n",
42+
"!rm -f /content/working/stable-diffusion-webui\n",
43+
"!ln -s /content/gdrive/MyDrive/sd-db-d8 /content/working/stable-diffusion-webui"
44+
],
45+
"metadata": {
46+
"id": "W4eFr-nSHE85"
47+
},
48+
"execution_count": null,
49+
"outputs": []
50+
},
51+
{
52+
"cell_type": "markdown",
53+
"source": [
54+
"Install various packages"
55+
],
56+
"metadata": {
57+
"id": "PLbCegoEyO4M"
58+
}
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": null,
63+
"metadata": {
64+
"id": "upF9RGj0tTiH"
65+
},
66+
"outputs": [],
67+
"source": [
68+
"# **fast-DreamBooth colab From https://github.com/d8ahazard/sd_dreambooth_extension, modified from https://github.com/camenduru/stable-diffusion-webui-collab**\n",
69+
"!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui /content/working/stable-diffusion-webui/\n",
70+
"!wget https://raw.githubusercontent.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py -O /content/working/stable-diffusion-webui/scripts/run_n_times.py\n",
71+
"!git clone https://github.com/AlUlkesh/stable-diffusion-webui-images-browser /content/working/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser\n",
72+
"!git clone https://github.com/camenduru/stable-diffusion-webui-huggingface /content/working/stable-diffusion-webui/extensions/stable-diffusion-webui-huggingface\n",
73+
"!git clone https://github.com/camenduru/sd-civitai-browser /content/working/stable-diffusion-webui/extensions/sd-civitai-browser\n",
74+
"!git clone https://github.com/camenduru/sd-webui-additional-networks /content/working/stable-diffusion-webui/extensions/sd-webui-additional-networks\n",
75+
"!git clone -b Torch2 https://github.com/d8ahazard/sd_dreambooth_extension /content/working/stable-diffusion-webui/extensions/sd_dreambooth_extension\n",
76+
"\n",
77+
"%cd /content/working/stable-diffusion-webui\n"
78+
]
79+
},
80+
{
81+
"cell_type": "markdown",
82+
"source": [
83+
"Bump Python Version (RUN ONCE)"
84+
],
85+
"metadata": {
86+
"id": "no--xkmZyJGx"
87+
}
88+
},
89+
{
90+
"cell_type": "code",
91+
"source": [
92+
"\n",
93+
"!wget https://github.com/korakot/kora/releases/download/v0.10/py310.sh\n",
94+
"!bash ./py310.sh -b -f -p /usr/local\n",
95+
"!python -m ipykernel install --name \"py310\" --user\n"
96+
],
97+
"metadata": {
98+
"id": "IJxdOKeBvUGp"
99+
},
100+
"execution_count": null,
101+
"outputs": []
102+
},
103+
{
104+
"cell_type": "markdown",
105+
"source": [
106+
"Download the 1.5 Model"
107+
],
108+
"metadata": {
109+
"id": "sQirFY6cyr1O"
110+
}
111+
},
112+
{
113+
"cell_type": "code",
114+
"source": [
115+
"!wget https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors -O /content/working/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned.safetensors\n"
116+
],
117+
"metadata": {
118+
"id": "F42Hh4v8yjyB"
119+
},
120+
"execution_count": null,
121+
"outputs": []
122+
},
123+
{
124+
"cell_type": "markdown",
125+
"source": [
126+
"And/Or download the 2.1 Model"
127+
],
128+
"metadata": {
129+
"id": "K0uL_P3OyvC5"
130+
}
131+
},
132+
{
133+
"cell_type": "code",
134+
"source": [
135+
"!wget https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-nonema-pruned.safetensors -O /content/working/stable-diffusion-webui/models/Stable-diffusion/v2-1_768-nonema-pruned.safetensors\n",
136+
"\n",
137+
"!wget https://huggingface.co/ckpt/stable-diffusion-2-1/raw/main/v2-inference-v.yaml -O /content/working/stable-diffusion-webui/models/Stable-diffusion/v2-1_768-nonemaema-pruned.yaml\n"
138+
],
139+
"metadata": {
140+
"id": "FKyzSN7SyfbZ"
141+
},
142+
"execution_count": null,
143+
"outputs": []
144+
},
145+
{
146+
"cell_type": "markdown",
147+
"source": [
148+
"Install Dreambooth and Auto1111 dependencies (RUN ONCE)"
149+
],
150+
"metadata": {
151+
"id": "kzh_c4qvyFUs"
152+
}
153+
},
154+
{
155+
"cell_type": "code",
156+
"source": [
157+
"!%cd /content/working/stable-diffusion-webui/\n",
158+
"# Clone Auto1111 repos\n",
159+
"!git clone \"https://github.com/Stability-AI/stablediffusion.git\" \"/content/working/stable-diffusion-webui/repositories/stable-diffusion-stability-ai\" \n",
160+
"!%cd \"/content/working/stable-diffusion-webui/repositories/stable-diffusion-stability-ai\" \n",
161+
"!git checkout \"47b6b607fdd31875c9279cd2f4f16b92e4ea958e\"\n",
162+
"!git clone \"https://github.com/CompVis/taming-transformers.git\" \"/content/working/stable-diffusion-webui/repositories/taming-transformers\" \n",
163+
"!%cd \"/content/working/stable-diffusion-webui/repositories/taming-transformers\" \n",
164+
"!git checkout \"24268930bf1dce879235a7fddd0b2355b84d7ea6\"\n",
165+
"!git clone \"https://github.com/crowsonkb/k-diffusion.git\" \"/content/working/stable-diffusion-webui/repositories/k-diffusion\"\n",
166+
"!%cd \"/content/working/stable-diffusion-webui/repositories/k-diffusion\"\n",
167+
"!git checkout \"5b3af030dd83e0297272d861c19477735d0317ec\"\n",
168+
"!git clone \"https://github.com/sczhou/CodeFormer.git\" \"/content/working/stable-diffusion-webui/repositories/CodeFormer\"\n",
169+
"!%cd \"/content/working/stable-diffusion-webui/repositories/CodeFormer\" \n",
170+
"!git checkout \"c5b4593074ba6214284d6acd5f1719b6c5d739af\"\n",
171+
"!git clone \"https://github.com/salesforce/BLIP.git\" \"/content/working/stable-diffusion-webui/repositories/BLIP\" \n",
172+
"!%cd \"/content/working/stable-diffusion-webui/repositories/BLIP\"\n",
173+
"!git checkout \"48211a1594f1321b00f14c9f7a5b4813144b2fb9\"\n"
174+
],
175+
"metadata": {
176+
"id": "q4-o5-Grx_sw"
177+
},
178+
"execution_count": null,
179+
"outputs": []
180+
},
181+
{
182+
"cell_type": "markdown",
183+
"source": [
184+
"Setup VENV"
185+
],
186+
"metadata": {
187+
"id": "_G-NX4mvIv-G"
188+
}
189+
},
190+
{
191+
"cell_type": "code",
192+
"source": [
193+
"# Install PIP stuff\n",
194+
"!%cd /content/working/stable-diffusion-webui/\n",
195+
"!pip install virtualenv\n",
196+
"!virtualenv venv\n",
197+
"!source venv/bin/activate\n",
198+
"# Install Auto1111 PIP packages\n",
199+
"!pip install git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379\n",
200+
"!pip install git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1\n",
201+
"!pip install git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b\n",
202+
"\n",
203+
"# Install Requirements\n",
204+
"!pip install -r /content/working/stable-diffusion-webui/requirements_versions.txt\n",
205+
"!pip install -r /content/working/stable-diffusion-webui./extensions/sd_dreambooth_extension/requirements.txt\n",
206+
"!pip install https://github.com/ArrowM/xformers/releases/download/xformers-0.0.17%2B36e23c5.d20230209-cp310-cu118/xformers-0.0.17+36e23c5.d20230209-cp310-cp310-linux_x86_64.whl\n",
207+
"!pip install https://download.pytorch.org/whl/nightly/cu118/torch-2.0.0.dev20230209%2Bcu118-cp310-cp310-linux_x86_64.whl https://download.pytorch.org/whl/nightly/cu118/torchvision-0.15.0.dev20230209%2Bcu118-cp310-cp310-linux_x86_64.whl\n"
208+
],
209+
"metadata": {
210+
"id": "XIdP81K-Isiw"
211+
},
212+
"execution_count": null,
213+
"outputs": []
214+
},
215+
{
216+
"cell_type": "markdown",
217+
"source": [
218+
"Run Auto1111"
219+
],
220+
"metadata": {
221+
"id": "A_AePD55yYeQ"
222+
}
223+
},
224+
{
225+
"cell_type": "code",
226+
"source": [
227+
"!%cd /content/working/stable-diffusion-webui/extensions/sd_dreambooth_extension/\n",
228+
"!git fetch && git pull\n",
229+
"!%cd /content/working/stable-diffusion-webui/ \n",
230+
"!python launch.py --share --xformers --enable-insecure-extension-access --torch2 --skip-install --skip-torch-cuda-test"
231+
],
232+
"metadata": {
233+
"id": "qa5T38izv6CX"
234+
},
235+
"execution_count": null,
236+
"outputs": []
237+
}
238+
]
239+
}

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ We also need a newer version of diffusers, as SD-WebUI uses version 0.3.0, while
2424
having the right diffusers version is the cause of the 'UNet2DConditionModel' object has no attribute '
2525
enable_gradient_checkpointing' error message, as well as safety checker warnings.
2626

27-
## IF YOU ARE HAVING ISSUES WITH REQUIREMENTS AFTER INSTALLING, LOOK BELOW
27+
## IF YOU ARE HAVING ISSUES WITH REQUIREMENTS AFTER INSTALLING, LOOK BELOW
2828

29-
To force sd-web-ui to *only* install one set of requirements and resolve many issues on install, we can specify the command line argument:
29+
To force sd-web-ui to *only* install one set of requirements and resolve many issues on install, we can specify the
30+
command line argument:
3031

3132
set/export REQS_FILE=.\extensions\sd_dreambooth_extension\requirements.txt
3233

@@ -85,21 +86,21 @@ Generate Samples* - Click this while training to generate samples before the nex
8586

8687
*Model* - The model to use. Training parameters will not be automatically loaded to the UI when changing models.
8788

88-
*Lora Model* - An existing lora checkpoint to load if resuming training, or to merge with the base model if generating a checkpoint.
89+
*Lora Model* - An existing lora checkpoint to load if resuming training, or to merge with the base model if generating a
90+
checkpoint.
8991

9092
*Half Model* - Enable this to save the model using half precision. Results in a smaller checkpoint with little
9193
noticeable difference in image output.
9294

9395
*Save Checkpoint to Subdirectory* - Save the checkpoint to a subdirectory using the model name.
9496

95-
9697
## Training Parameters
9798

98-
*Performance Wizard (WIP)* - Tries to set the optimal training parameters based on the amount of VRAM for your GPU and number of instance images.
99+
*Performance Wizard (WIP)* - Tries to set the optimal training parameters based on the amount of VRAM for your GPU and
100+
number of instance images.
99101

100102
Probably not perfect, but at least a good starting point.
101103

102-
103104
### Intervals
104105

105106
This section contains parameters related to when things happen during training.
@@ -126,15 +127,15 @@ in seconds.
126127
*Class batch size* - How many classification images to generate simultaneously. Set this to whatever you can safely
127128
process at once using Txt2Image, or just leave it alone.
128129

129-
*Set Gradients to None When Zeroing* - instead of setting to zero, set the grads to None. This will in general have lower memory footprint, and can modestly improve performance.
130+
*Set Gradients to None When Zeroing* - instead of setting to zero, set the grads to None. This will in general have
131+
lower memory footprint, and can modestly improve performance.
130132
https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.zero_grad.html
131133

132134
*Gradient Checkpointing* - Enable this to save VRAM at the cost of a bit of speed.
133135
https://arxiv.org/abs/1604.06174v2
134136

135137
*Max Grad Norms* - The maximum number of gradient normalizati
136138

137-
138139
### Learning Rate
139140

140141
This section contains parameters related to the learning rate.
@@ -215,7 +216,9 @@ to better editability.
215216

216217
*Max Token Length* - raise the tokenizer's default limit above 75. Requires Pad Tokens for > 75.
217218

218-
*AdamW Weight Decay* - The weight decay of the AdamW Optimizer used for training. Values closer to 0 closely match your training dataset, and values closer to 1 generalize more and deviate from your training dataset. Default is 1e-2, values lower than 0.1 are recommended.
219+
*AdamW Weight Decay* - The weight decay of the AdamW Optimizer used for training. Values closer to 0 closely match your
220+
training dataset, and values closer to 1 generalize more and deviate from your training dataset. Default is 1e-2, values
221+
lower than 0.1 are recommended.
219222

220223
## Concepts
221224

0 commit comments

Comments
 (0)