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