Nekos4Lyfe commited on
Commit
6c350c3
1 Parent(s): 508b6f5

Upload Neko_sd.ipynb

Browse files
Files changed (1) hide show
  1. Neko_sd.ipynb +241 -0
Neko_sd.ipynb ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "id": "pFkOt218iAKp"
64
+ },
65
+ "execution_count": null,
66
+ "outputs": []
67
+ },
68
+ {
69
+ "cell_type": "code",
70
+ "source": [
71
+ "#--------------Add a model from civitai (some examples provided):-------------------------------#\n",
72
+ "#Baked VAE (No external VAE required)\n",
73
+ "!curl -Lo /content/sd/models/Stable-diffusion/azovya-rpg.safetensors https://civitai.com/api/download/models/87886 #<---baked VAE\n",
74
+ "\n",
75
+ "#Photoreal models\n",
76
+ "#!curl -Lo /content/sd/models/Stable-diffusion/analogmadness.safetensors https://civitai.com/api/download/models/56498\n",
77
+ "\n",
78
+ "#Anime models\n",
79
+ "#!curl -Lo /content/sd/models/Stable-diffusion/mistoon.safetensors https://civitai.com/api/download/models/28861\n",
80
+ "#!curl -Lo /content/sd/models/Stable-diffusion/beenyou.safetensors https://civitai.com/api/download/models/85614\n",
81
+ "\n",
82
+ "#model from Google Drive\n",
83
+ "#import shutil\n",
84
+ "#shutil.copy(\"/content/drive/MyDrive/models/analogmadness.safetensors\", \n",
85
+ " # \"/content/sd/models/Stable-diffusion/analogmadness.safetensors\")\n",
86
+ "\n",
87
+ "#---------------Add VAE stored on drive to model:-----------------------#\n",
88
+ "\n",
89
+ "#Add VAE for anime models:\n",
90
+ "#import shutil\n",
91
+ "#shutil.copy(\"/content/drive/MyDrive/VAE/kl-f8-anime2.vae.pt\", \n",
92
+ "# \"/content/sd/models/Stable-diffusion/mistoon.vae.pt\")\n",
93
+ "\n",
94
+ "#Add VAE for photoreal models:\n",
95
+ "#import shutil\n",
96
+ "#shutil.copy(\"/content/drive/MyDrive/VAE/mse840000.vae.pt\", \n",
97
+ "# \"/content/sd/models/Stable-diffusion/analogmadness.vae.pt\")\n"
98
+ ],
99
+ "metadata": {
100
+ "id": "TtUGrBEN7AsN"
101
+ },
102
+ "execution_count": null,
103
+ "outputs": []
104
+ },
105
+ {
106
+ "cell_type": "code",
107
+ "source": [
108
+ "#Install dependencies\n",
109
+ "!pip install --upgrade fastapi==0.90.1\n",
110
+ "!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",
111
+ "!pip install -q xformers==0.0.18 triton==2.0.0 -U\n",
112
+ "\n",
113
+ "#run the webui once \n",
114
+ "#Three blue links will appear to the UI\n",
115
+ "#(This cell will run indefinetely until you press the square shaped \"Stop\" button <---)\n",
116
+ "#\n",
117
+ "%cd /content/sd\n",
118
+ "!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",
119
+ "# If remotemoe failed to start, change '--remotemoe' to '--cloudflared' on the COMMANDLINE_ARGS line above to use cloudflare tunnel"
120
+ ],
121
+ "metadata": {
122
+ "id": "XFottHPM31pS"
123
+ },
124
+ "execution_count": null,
125
+ "outputs": []
126
+ },
127
+ {
128
+ "cell_type": "code",
129
+ "source": [
130
+ "#Add some embeddings after running the UI\n",
131
+ "%cd /content\n",
132
+ "!curl -Lo embeddings.zip https://huggingface.co/Nekos4Lyfe/sd-kit/resolve/main/embeddings.zip \n",
133
+ "!unzip /content/embeddings.zip #Create new temporary embeddings folder with content\n",
134
+ "\n",
135
+ "!mv embeddings/* /content/sd/embeddings #Add content to UI embedding folder\n",
136
+ "import shutil\n",
137
+ "shutil.rmtree(\"embeddings\") #Remove temporary folder\n",
138
+ "!rm embeddings.zip #remove .zip file\n",
139
+ "\n",
140
+ "#How to use: \n",
141
+ "# For example , write \"no_Sketch\" in the negative prompt to activate no_Sketch.pt\n",
142
+ "# or write angry512 in the positive prompt to activate angry512.pt"
143
+ ],
144
+ "metadata": {
145
+ "id": "P3MTYF8fmVDY"
146
+ },
147
+ "execution_count": null,
148
+ "outputs": []
149
+ },
150
+ {
151
+ "cell_type": "code",
152
+ "execution_count": null,
153
+ "metadata": {
154
+ "id": "b7FqKKN4tE3m"
155
+ },
156
+ "outputs": [],
157
+ "source": [
158
+ "#Add some LoRa:s after running the UI \n",
159
+ "#Here the LoRa trigger words are the same as the LoRa .safetensor names\n",
160
+ "!curl -Lo /content/sd/models/Lora/epinoise.safetensors https://civitai.com/api/download/models/16576\n",
161
+ "!curl -Lo /content/sd/models/Lora/dieselpunkai.safetensors https://civitai.com/api/download/models/27755\n",
162
+ "!curl -Lo /content/sd/models/Lora/hipoly.safetensors https://civitai.com/api/download/models/44566\n",
163
+ "!curl -Lo /content/sd/models/Lora/1990s\\(style\\).safetensors https://civitai.com/api/download/models/54221\n",
164
+ "!curl -Lo /content/sd/models/Lora/kids_illustration.safetensors https://civitai.com/api/download/models/67980\n",
165
+ "!curl -Lo /content/sd/models/Lora/\\(illumination\\).safetensors https://civitai.com/api/download/models/42981\n",
166
+ "!curl -Lo /content/sd/models/Lora/kusanagi_motoko.safetensors https://civitai.com/api/download/models/7692\n",
167
+ "!curl -Lo /content/sd/models/Lora/WH40K_ork.safetensors https://civitai.com/api/download/models/63475\n",
168
+ "!curl -Lo /content/sd/models/Lora/MSHN.safetensors https://civitai.com/api/download/models/62552\n",
169
+ "!curl -Lo /content/sd/models/Lora/blame.safetensors https://civitai.com/api/download/models/55412\n",
170
+ "!curl -Lo /content/sd/models/Lora/WH40K_Imperial_Guardsman.safetensors https://civitai.com/api/download/models/56778\n",
171
+ "!curl -Lo /content/sd/models/Lora/WH40K_Commissar.safetensors https://civitai.com/api/download/models/56414\n",
172
+ "!curl -Lo /content/sd/models/Lora/scared_expression.safetensors https://civitai.com/api/download/models/49924\n",
173
+ "!curl -Lo /content/sd/models/Lora/graphic_novel.safetensors https://civitai.com/api/download/models/39455\n",
174
+ "!curl -Lo /content/sd/models/Lora/>_<-@_@-=_=-X-X-._.-JITOME-:I.safetensors https://civitai.com/api/download/models/30666\n",
175
+ "!curl -Lo /content/sd/models/Lora/emotion.safetensors https://civitai.com/api/download/models/14177\n",
176
+ "!curl -Lo /content/sd/models/Lora/adepta_sororitas.safetensors https://civitai.com/api/download/models/12730\n",
177
+ "!curl -Lo /content/sd/models/Lora/gmod.safetensors https://civitai.com/api/download/models/5988\n",
178
+ "\n",
179
+ "#How to use: \n",
180
+ "# For example , write <lora:epinoise:1> epinoise in the prompt to activate the Lora epinoise.safetensors"
181
+ ]
182
+ },
183
+ {
184
+ "cell_type": "code",
185
+ "source": [
186
+ "#Add some Wildcards after running the UI \n",
187
+ "#These are not my own but fetched from here: https://www.sdcompendium.com/doku.php?id=start\n",
188
+ "#(using the dynamic prompts extension baked into sd.zip)\n",
189
+ "%cd /content\n",
190
+ "!curl -Lo wildcards.zip https://huggingface.co/Nekos4Lyfe/sd-kit/resolve/main/wildcards.zip \n",
191
+ "!unzip /content/wildcards.zip #Create new temporary embeddings folder with content\n",
192
+ "\n",
193
+ "!mv wildcards/* /content/sd/extensions/sd-dynamic-prompts/wildcards #Add content to UI embedding folder\n",
194
+ "import shutil\n",
195
+ "shutil.rmtree(\"wildcards\") #Remove temporary folder\n",
196
+ "!rm wildcards.zip #remove .zip file\n",
197
+ "\n",
198
+ "#How to use: \n",
199
+ "# refer to sd-dynamic-prompts guide available on github"
200
+ ],
201
+ "metadata": {
202
+ "id": "3hPt2WCNEy9f"
203
+ },
204
+ "execution_count": null,
205
+ "outputs": []
206
+ },
207
+ {
208
+ "cell_type": "code",
209
+ "source": [
210
+ "#Run the UI again with the LoRa and embeddings\n",
211
+ "#To access the LoRa and embeddings, click one of the buttons beneath the big \"Generate!\" button. \n",
212
+ "#It's the button beneath \"Generate!\" right in the middle with some orange on it. \n",
213
+ "#Scroll up to find the UI links\n",
214
+ "%cd /content/sd\n",
215
+ "!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",
216
+ "# If remotemoe failed to start, change '--remotemoe' to '--cloudflared' on the COMMANDLINE_ARGS line above to use cloudflare tunnel"
217
+ ],
218
+ "metadata": {
219
+ "id": "2jdGVvT19hk2"
220
+ },
221
+ "execution_count": null,
222
+ "outputs": []
223
+ }
224
+ ],
225
+ "metadata": {
226
+ "colab": {
227
+ "provenance": [],
228
+ "gpuType": "T4"
229
+ },
230
+ "kernelspec": {
231
+ "display_name": "Python 3",
232
+ "name": "python3"
233
+ },
234
+ "language_info": {
235
+ "name": "python"
236
+ },
237
+ "accelerator": "GPU"
238
+ },
239
+ "nbformat": 4,
240
+ "nbformat_minor": 0
241
+ }