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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"source": [
|
6 |
+
"#Fetch the .zip file of the UI\n",
|
7 |
+
"#Note that extensions are attached within this .zip file\n",
|
8 |
+
"#A full list of extensions used can be found under sd/extensions/Extensions download URLs.txt\n",
|
9 |
+
"%cd /content\n",
|
10 |
+
"!curl -Lo sd.zip https://huggingface.co/Nekos4Lyfe/sd-kit/resolve/main/sd.zip\n",
|
11 |
+
"!unzip sd.zip \n",
|
12 |
+
"!rm sd.zip #remove .zip file"
|
13 |
+
],
|
14 |
+
"metadata": {
|
15 |
+
"id": "V1X7OSaLJuHa"
|
16 |
+
},
|
17 |
+
"execution_count": null,
|
18 |
+
"outputs": []
|
19 |
+
},
|
20 |
+
{
|
21 |
+
"cell_type": "code",
|
22 |
+
"source": [
|
23 |
+
"#Download some basic ControlNET models \n",
|
24 |
+
"!curl -Lo /content/sd/extensions/controlnet/models/control_v11p_sd15_canny.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_canny_fp16.safetensors\n",
|
25 |
+
"!curl -Lo /content/sd/extensions/controlnet/models/t2iadapter_canny_sd14v1.pth https://huggingface.co/nolanaatama/models/resolve/main/t2iadapter_canny_sd14v1.pth\n",
|
26 |
+
"!curl -Lo /content/sd/extensions/controlnet/models/control_v11p_sd15_lineart.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15_lineart_fp16.safetensors\n",
|
27 |
+
"!curl -Lo /content/sd/extensions/controlnet/models/control_v11p_sd15s2_lineart_anime.safetensors https://huggingface.co/nolanaatama/models/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors\n"
|
28 |
+
],
|
29 |
+
"metadata": {
|
30 |
+
"id": "3ab7ebbQIP-v"
|
31 |
+
},
|
32 |
+
"execution_count": null,
|
33 |
+
"outputs": []
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"cell_type": "code",
|
37 |
+
"source": [
|
38 |
+
"from google.colab import drive\n",
|
39 |
+
"drive.mount('/content/drive')\n",
|
40 |
+
"\n",
|
41 |
+
"#Choose a model to store on Drive as backup. Here are some examples\n",
|
42 |
+
"#!curl -Lo /content/drive/MyDrive/models/mistoon.safetensors https://civitai.com/api/download/models/28861\n",
|
43 |
+
"#!curl -Lo /content/drive/MyDrive/models/ghostmix.safetensors https://civitai.com/api/download/models/64503\n",
|
44 |
+
"#!curl -Lo /content/drive/MyDrive/models/darkside.safetensors https://civitai.com/api/download/models/63193\n",
|
45 |
+
"#!curl -Lo /content/drive/MyDrive/models/lyriel.safetensors https://civitai.com/api/download/models/72396\n",
|
46 |
+
"#!curl -Lo /content/drive/MyDrive/models/beenyou.safetensors https://civitai.com/api/download/models/64889\n",
|
47 |
+
"#!curl -Lo /content/drive/MyDrive/models/analogmadness.safetensors https://civitai.com/api/download/models/56498\n",
|
48 |
+
"\n",
|
49 |
+
"#Store VAE on your drive for easy access in the future \n",
|
50 |
+
"#!curl -Lo /content/drive/MyDrive/VAE/mse840000.vae.pt https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt #<--Commonly used VAE For photoreal models\n",
|
51 |
+
"#!curl -Lo /content/drive/MyDrive/VAE/kl-f8-anime2.vae.pt https://civitai.com/api/download/models/28569 #<--Commonly used VAE For anime models\n",
|
52 |
+
"\n",
|
53 |
+
"#Add a preloaded model from your Google drive (recommended as civitai is slow/offline sometimes)\n",
|
54 |
+
"#import shutil\n",
|
55 |
+
"#shutil.copy(\"/content/drive/MyDrive/models/analogmadness.safetensors\", \n",
|
56 |
+
"# \"/content/sd/models/Stable-diffusion/analogmadness.safetensors\")\n",
|
57 |
+
"\n",
|
58 |
+
"#Add VAE to model\n",
|
59 |
+
"#shutil.copy(\"/content/drive/MyDrive/VAE/mse840000.vae.pt\", \n",
|
60 |
+
"# \"/content/sd/models/Stable-diffusion/analogmadness.vae.pt\")"
|
61 |
+
],
|
62 |
+
"metadata": {
|
63 |
+
"colab": {
|
64 |
+
"base_uri": "https://localhost:8080/"
|
65 |
+
},
|
66 |
+
"id": "pFkOt218iAKp",
|
67 |
+
"outputId": "ae13e74f-1822-48e1-9f5d-b03479f8ab41"
|
68 |
+
},
|
69 |
+
"execution_count": null,
|
70 |
+
"outputs": [
|
71 |
+
{
|
72 |
+
"output_type": "stream",
|
73 |
+
"name": "stdout",
|
74 |
+
"text": [
|
75 |
+
"Mounted at /content/drive\n"
|
76 |
+
]
|
77 |
+
}
|
78 |
+
]
|
79 |
+
},
|
80 |
+
{
|
81 |
+
"cell_type": "code",
|
82 |
+
"source": [
|
83 |
+
"#--------------Add a model from civitai:-------------------------------#\n",
|
84 |
+
"#Baked VAE (No external VAE required)\n",
|
85 |
+
"!curl -Lo /content/sd/models/Stable-diffusion/azovya-rpg.safetensors https://civitai.com/api/download/models/87886 #<---baked VAE\n",
|
86 |
+
"\n",
|
87 |
+
"#Photoreal models\n",
|
88 |
+
"#!curl -Lo /content/sd/models/Stable-diffusion/analogmadness.safetensors https://civitai.com/api/download/models/56498\n",
|
89 |
+
"\n",
|
90 |
+
"#Anime models\n",
|
91 |
+
"#!curl -Lo /content/sd/models/Stable-diffusion/mistoon.safetensors https://civitai.com/api/download/models/28861\n",
|
92 |
+
"#!curl -Lo /content/sd/models/Stable-diffusion/beenyou.safetensors https://civitai.com/api/download/models/85614\n",
|
93 |
+
"\n",
|
94 |
+
"#model from Google Drive\n",
|
95 |
+
"#import shutil\n",
|
96 |
+
"#shutil.copy(\"/content/drive/MyDrive/models/analogmadness.safetensors\", \n",
|
97 |
+
" # \"/content/sd/models/Stable-diffusion/analogmadness.safetensors\")\n",
|
98 |
+
"\n",
|
99 |
+
"#---------------Add VAE stored on drive to model:-----------------------#\n",
|
100 |
+
"\n",
|
101 |
+
"#Add VAE for anime models:\n",
|
102 |
+
"#import shutil\n",
|
103 |
+
"#shutil.copy(\"/content/drive/MyDrive/VAE/kl-f8-anime2.vae.pt\", \n",
|
104 |
+
"# \"/content/sd/models/Stable-diffusion/mistoon.vae.pt\")\n",
|
105 |
+
"\n",
|
106 |
+
"#Add VAE for photoreal models:\n",
|
107 |
+
"#import shutil\n",
|
108 |
+
"#shutil.copy(\"/content/drive/MyDrive/VAE/mse840000.vae.pt\", \n",
|
109 |
+
"# \"/content/sd/models/Stable-diffusion/analogmadness.vae.pt\")\n"
|
110 |
+
],
|
111 |
+
"metadata": {
|
112 |
+
"id": "TtUGrBEN7AsN"
|
113 |
+
},
|
114 |
+
"execution_count": null,
|
115 |
+
"outputs": []
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"cell_type": "code",
|
119 |
+
"source": [
|
120 |
+
"#Install dependencies\n",
|
121 |
+
"!pip install --upgrade fastapi==0.90.1\n",
|
122 |
+
"!pip install -q torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 torchtext==0.15.1 torchdata==0.6.0 --extra-index-url https://download.pytorch.org/whl/cu118 -U\n",
|
123 |
+
"!pip install -q xformers==0.0.18 triton==2.0.0 -U\n",
|
124 |
+
"\n",
|
125 |
+
"#run the webui once \n",
|
126 |
+
"#Three blue links will appear to the UI\n",
|
127 |
+
"#(This cell will run indefinetely until you press the square shaped \"Stop\" button <---)\n",
|
128 |
+
"#\n",
|
129 |
+
"%cd /content/sd\n",
|
130 |
+
"!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --enable-insecure-extension --gradio-queue --remotemoe --disable-console-progressbars\" REQS_FILE=\"requirements.txt\" python launch.py\n",
|
131 |
+
"# If remotemoe failed to start, change '--remotemoe' to '--cloudflared' on the COMMANDLINE_ARGS line above to use cloudflare tunnel"
|
132 |
+
],
|
133 |
+
"metadata": {
|
134 |
+
"id": "XFottHPM31pS"
|
135 |
+
},
|
136 |
+
"execution_count": null,
|
137 |
+
"outputs": []
|
138 |
+
},
|
139 |
+
{
|
140 |
+
"cell_type": "code",
|
141 |
+
"source": [
|
142 |
+
"#Add some embeddings after running the UI\n",
|
143 |
+
"%cd /content\n",
|
144 |
+
"!curl -Lo embeddings.zip https://huggingface.co/Nekos4Lyfe/sd-kit/resolve/main/embeddings.zip \n",
|
145 |
+
"!unzip /content/embeddings.zip #Create new temporary embeddings folder with content\n",
|
146 |
+
"\n",
|
147 |
+
"!mv embeddings/* /content/sd/embeddings #Add content to UI embedding folder\n",
|
148 |
+
"import shutil\n",
|
149 |
+
"shutil.rmtree(\"embeddings\") #Remove temporary folder\n",
|
150 |
+
"!rm embeddings.zip #remove .zip file\n",
|
151 |
+
"\n",
|
152 |
+
"#How to use: \n",
|
153 |
+
"# For example , write \"no_Sketch\" in the negative prompt to activate no_Sketch.pt\n",
|
154 |
+
"# or write angry512 in the positive prompt to activate angry512.pt"
|
155 |
+
],
|
156 |
+
"metadata": {
|
157 |
+
"id": "P3MTYF8fmVDY"
|
158 |
+
},
|
159 |
+
"execution_count": null,
|
160 |
+
"outputs": []
|
161 |
+
},
|
162 |
+
{
|
163 |
+
"cell_type": "code",
|
164 |
+
"execution_count": null,
|
165 |
+
"metadata": {
|
166 |
+
"id": "b7FqKKN4tE3m"
|
167 |
+
},
|
168 |
+
"outputs": [],
|
169 |
+
"source": [
|
170 |
+
"#Add some LoRa:s after running the UI \n",
|
171 |
+
"#Here the LoRa trigger words are the same as the LoRa .safetensor names\n",
|
172 |
+
"!curl -Lo /content/sd/models/Lora/epinoise.safetensors https://civitai.com/api/download/models/16576\n",
|
173 |
+
"!curl -Lo /content/sd/models/Lora/dieselpunkai.safetensors https://civitai.com/api/download/models/27755\n",
|
174 |
+
"!curl -Lo /content/sd/models/Lora/hipoly.safetensors https://civitai.com/api/download/models/44566\n",
|
175 |
+
"!curl -Lo /content/sd/models/Lora/1990s\\(style\\).safetensors https://civitai.com/api/download/models/54221\n",
|
176 |
+
"!curl -Lo /content/sd/models/Lora/kids_illustration.safetensors https://civitai.com/api/download/models/67980\n",
|
177 |
+
"!curl -Lo /content/sd/models/Lora/\\(illumination\\).safetensors https://civitai.com/api/download/models/42981\n",
|
178 |
+
"!curl -Lo /content/sd/models/Lora/kusanagi_motoko.safetensors https://civitai.com/api/download/models/7692\n",
|
179 |
+
"!curl -Lo /content/sd/models/Lora/WH40K_ork.safetensors https://civitai.com/api/download/models/63475\n",
|
180 |
+
"!curl -Lo /content/sd/models/Lora/MSHN.safetensors https://civitai.com/api/download/models/62552\n",
|
181 |
+
"!curl -Lo /content/sd/models/Lora/blame.safetensors https://civitai.com/api/download/models/55412\n",
|
182 |
+
"!curl -Lo /content/sd/models/Lora/WH40K_Imperial_Guardsman.safetensors https://civitai.com/api/download/models/56778\n",
|
183 |
+
"!curl -Lo /content/sd/models/Lora/WH40K_Commissar.safetensors https://civitai.com/api/download/models/56414\n",
|
184 |
+
"!curl -Lo /content/sd/models/Lora/Squeezer1.safetensors https://civitai.com/api/download/models/54302\n",
|
185 |
+
"!curl -Lo /content/sd/models/Lora/Squeezer2.safetensors https://civitai.com/api/download/models/44493\n",
|
186 |
+
"!curl -Lo /content/sd/models/Lora/scared_expression.safetensors https://civitai.com/api/download/models/49924\n",
|
187 |
+
"!curl -Lo /content/sd/models/Lora/graphic_novel.safetensors https://civitai.com/api/download/models/39455\n",
|
188 |
+
"!curl -Lo /content/sd/models/Lora/>_<-@_@-=_=-X-X-._.-JITOME-:I.safetensors https://civitai.com/api/download/models/30666\n",
|
189 |
+
"!curl -Lo /content/sd/models/Lora/emotion.safetensors https://civitai.com/models/11998/emotion-puppeteer-lora\n",
|
190 |
+
"!curl -Lo /content/sd/models/Lora/adepta_sororitas.safetensors https://civitai.com/api/download/models/12730\n",
|
191 |
+
"!curl -Lo /content/sd/models/Lora/gmod.safetensors https://civitai.com/api/download/models/5988\n",
|
192 |
+
"\n",
|
193 |
+
"#How to use: \n",
|
194 |
+
"# For example , write <lora:epinoise:1> epinoise in the prompt to activate the Lora epinoise.safetensors"
|
195 |
+
]
|
196 |
+
},
|
197 |
+
{
|
198 |
+
"cell_type": "code",
|
199 |
+
"source": [
|
200 |
+
"#Add some Wildcards after running the UI \n",
|
201 |
+
"#These are not my own but fetched from here: https://www.sdcompendium.com/doku.php?id=start\n",
|
202 |
+
"#(using the dynamic prompts extension baked into sd.zip)\n",
|
203 |
+
"%cd /content\n",
|
204 |
+
"!curl -Lo wildcards.zip https://huggingface.co/Nekos4Lyfe/sd-kit/resolve/main/wildcards.zip \n",
|
205 |
+
"!unzip /content/wildcards.zip #Create new temporary embeddings folder with content\n",
|
206 |
+
"\n",
|
207 |
+
"!mv wildcards/* /content/sd/extensions/sd-dynamic-prompts/wildcards #Add content to UI embedding folder\n",
|
208 |
+
"import shutil\n",
|
209 |
+
"shutil.rmtree(\"wildcards\") #Remove temporary folder\n",
|
210 |
+
"!rm wildcards.zip #remove .zip file\n",
|
211 |
+
"\n",
|
212 |
+
"#How to use: \n",
|
213 |
+
"# refer to sd-dynamic-prompts guide available on github"
|
214 |
+
],
|
215 |
+
"metadata": {
|
216 |
+
"id": "3hPt2WCNEy9f"
|
217 |
+
},
|
218 |
+
"execution_count": null,
|
219 |
+
"outputs": []
|
220 |
+
},
|
221 |
+
{
|
222 |
+
"cell_type": "code",
|
223 |
+
"source": [
|
224 |
+
"#Run the UI again with the LoRa and embeddings\n",
|
225 |
+
"#To access the LoRa and embeddings, click one of the buttons beneath the big \"Generate!\" button. \n",
|
226 |
+
"#It's the button beneath \"Generate!\" right in the middle with some orange on it. \n",
|
227 |
+
"#Scroll up to find the UI links\n",
|
228 |
+
"%cd /content/sd\n",
|
229 |
+
"!COMMANDLINE_ARGS=\"--share --disable-safe-unpickle --no-half-vae --xformers --enable-insecure-extension --gradio-queue --remotemoe --disable-console-progressbars\" REQS_FILE=\"requirements.txt\" python launch.py\n",
|
230 |
+
"# If remotemoe failed to start, change '--remotemoe' to '--cloudflared' on the COMMANDLINE_ARGS line above to use cloudflare tunnel"
|
231 |
+
],
|
232 |
+
"metadata": {
|
233 |
+
"id": "2jdGVvT19hk2"
|
234 |
+
},
|
235 |
+
"execution_count": null,
|
236 |
+
"outputs": []
|
237 |
+
}
|
238 |
+
],
|
239 |
+
"metadata": {
|
240 |
+
"colab": {
|
241 |
+
"provenance": [],
|
242 |
+
"gpuType": "T4"
|
243 |
+
},
|
244 |
+
"kernelspec": {
|
245 |
+
"display_name": "Python 3",
|
246 |
+
"name": "python3"
|
247 |
+
},
|
248 |
+
"language_info": {
|
249 |
+
"name": "python"
|
250 |
+
},
|
251 |
+
"accelerator": "GPU"
|
252 |
+
},
|
253 |
+
"nbformat": 4,
|
254 |
+
"nbformat_minor": 0
|
255 |
+
}
|