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Python 3"
|
| 16 |
+
},
|
| 17 |
+
"language_info": {
|
| 18 |
+
"name": "python"
|
| 19 |
+
},
|
| 20 |
+
"accelerator": "GPU",
|
| 21 |
+
"gpuClass": "standard"
|
| 22 |
+
},
|
| 23 |
+
"cells": [
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "markdown",
|
| 26 |
+
"source": [
|
| 27 |
+
"\n",
|
| 28 |
+
"# **NoCrypt's Colab Remastered 🔮**\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"[](https://lookup.guru/442099748669751297) [](https://ko-fi.com/nocrypt) [](https://patreon.com/nocrypt)\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"\n",
|
| 33 |
+
"y'all know what this is. check out my [QoL userscript](https://greasyfork.org/en/scripts/463547-nocrypt-colab-qol) for better experience\n",
|
| 34 |
+
"\n",
|
| 35 |
+
"<!-- [Guide for using krita with this colab](https://rentry.org/krita-ext-colab) -->\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"<!-- [Hey you, thanks for looking into my colab, please ignore messages below, I just added it to announce stuff faster] -->\n",
|
| 38 |
+
"<!-- # <font color=red>BROKEN FOR NOW, WILL FIX ASAP ⚠️ -->\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"<!-- # <font color=red>Under construction ⚠️ -->\n",
|
| 41 |
+
"\n",
|
| 42 |
+
"<small><font color=gray> V23-09-09B | [latest](https://colab.research.google.com/drive/1wEa-tS10h4LlDykd87TF5zzpXIIQoCmq) | [faq](https://rentry.org/ncpt_faq).</font></small>\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"\n",
|
| 45 |
+
"note: google hates us\n",
|
| 46 |
+
"<!-- <font color=yellow><big>Use stable build for now. Do not check latest_webui unless you know what you're doing.</big></font> -->\n",
|
| 47 |
+
"\n",
|
| 48 |
+
"<!-- <font color=yellow><big>If the image output is not what you want. Read the terminal</big></font> -->\n",
|
| 49 |
+
"\n",
|
| 50 |
+
"<details>\n",
|
| 51 |
+
" <summary><font color=gray>Latest Changes</summary>\n",
|
| 52 |
+
" \n",
|
| 53 |
+
"**Update V23-09-09B**\n",
|
| 54 |
+
"\n",
|
| 55 |
+
"```diff\n",
|
| 56 |
+
"+ cirno will stay, to remember a time when colab wasnt evil\n",
|
| 57 |
+
"```\n",
|
| 58 |
+
"</details>\n",
|
| 59 |
+
"\n",
|
| 60 |
+
"\n",
|
| 61 |
+
"<details>\n",
|
| 62 |
+
" <summary><font color=gray>Old Changes</summary>\n",
|
| 63 |
+
"\n",
|
| 64 |
+
" + the funky cirno!\n",
|
| 65 |
+
" + removed some more slanderous things \n",
|
| 66 |
+
" + Added HF OUT extension (use optional hf token to start)\n",
|
| 67 |
+
" + Fix for clipskip and other options not showing\n",
|
| 68 |
+
" + UmiAI is now in an accordion (thanks ao)\n",
|
| 69 |
+
" + Fix the order of parameters (hires fix no longer being on top)\n",
|
| 70 |
+
" + Improved interuption speed\n",
|
| 71 |
+
" + Readjusted XYZ bg colors\n",
|
| 72 |
+
" + Readjusted image gallery height\n",
|
| 73 |
+
" + Readjusted UmiAI to be auto enabled (for ur own good, wildcards etc.)\n",
|
| 74 |
+
" + Readjusted pooling speed so it didn't goes to fast (potential fix for generate button stuck)\n",
|
| 75 |
+
" + Potential fix for some tunnels having the exact same url for everyone\n",
|
| 76 |
+
" + Disabled deprication warnings!\n",
|
| 77 |
+
" + Updated custom theme (NoCrypt/miku)\n",
|
| 78 |
+
" + Added Privacy Mode Toggle in webui\n",
|
| 79 |
+
" + Added Dark/Light mode Toggle in webui\n",
|
| 80 |
+
" + Fixed \"no custom theme\" option\n",
|
| 81 |
+
" + Added disable-inpainting-overlay extension (for better inpainting)\n",
|
| 82 |
+
" + Added pixelization extension (with models, check extras tab)\n",
|
| 83 |
+
" + Adjusted defaults for Tiled Diffusion and Tilled Vae in IMG2IMG (for better experience)\n",
|
| 84 |
+
" + Attempt to reduce memory usage (especially while upscaling, thx camenduru!)\n",
|
| 85 |
+
" + Updated to webui 1.5\n",
|
| 86 |
+
" + Changes to controlnet model path (again, sorry config_to_drive users)\n",
|
| 87 |
+
" + Fixed DPMPP 2M v2 (for now)\n",
|
| 88 |
+
" + Fixed ram sd2 patch (for now)\n",
|
| 89 |
+
" + Fixed some bugs introduced on latest 1.5 using patch (extensions git failure, for now)\n",
|
| 90 |
+
" + Fix very high memory usage while idle (thanks neggles! 😭)\n",
|
| 91 |
+
" + Fix ubuntu deps broken\n",
|
| 92 |
+
" + Changed Branch back to master\n",
|
| 93 |
+
" + Keep using gradio 3.33.1 (battle-tested)\n",
|
| 94 |
+
" + Fix unable to start colab in general... (sorry for late fix, I was taking break for 7 days 🙏)\n",
|
| 95 |
+
" + Fixed ubuntu deps failing to install\n",
|
| 96 |
+
" + Updated pip deps\n",
|
| 97 |
+
" + Updated all extensions\n",
|
| 98 |
+
" + Cleaning up quicksettings area (mostly moved to Options panel under hiresfix)\n",
|
| 99 |
+
" + Some fixes and improvement with git (no more merge conflict while changing branch or latest webui hopefully)\n",
|
| 100 |
+
" + Renamed controlnet back to default (fixed deforum)\n",
|
| 101 |
+
" + Disabled Access Control mode in IIB\n",
|
| 102 |
+
" + Removed taming transformers\n",
|
| 103 |
+
" + Changed composable lora to an updated fork by a2569875\n",
|
| 104 |
+
" + Added neutral prompt extension (AND_PREP etc)\n",
|
| 105 |
+
" + Removed some files to make the size smaller\n",
|
| 106 |
+
" + Added surprise for ppl who copied this colab :p\n",
|
| 107 |
+
" + Added Amedira model\n",
|
| 108 |
+
" + Update all extensions\n",
|
| 109 |
+
" + Update all deps\n",
|
| 110 |
+
" + Added krita-ext fork by ashen\n",
|
| 111 |
+
" + Fixed anything 4.5 link\n",
|
| 112 |
+
" + Replace Holokuki2 -> Gishiki\n",
|
| 113 |
+
" + Fixed image preview looks fried\n",
|
| 114 |
+
" + Add more negative embeddings by Lykon and Luna\n",
|
| 115 |
+
" + Changed extensions paths\n",
|
| 116 |
+
" + Decrease live_preview_refresh_period\n",
|
| 117 |
+
" + Less warcrimes\n",
|
| 118 |
+
" + Switched to release_candidate branch as default\n",
|
| 119 |
+
" + Fixed \"visualize\" in two-shot\n",
|
| 120 |
+
" + Added openpose-editor\n",
|
| 121 |
+
" + Removed Posex\n",
|
| 122 |
+
" + Minor fix for gdown\n",
|
| 123 |
+
" + Using gradio 3.33.1 to fix tmp file name bug\n",
|
| 124 |
+
" + Updated to latest webui\n",
|
| 125 |
+
" + Updated extensions\n",
|
| 126 |
+
" + Fixed Controlnet v1.1 for good now (yes, including tile stuff)\n",
|
| 127 |
+
" + Removed canvas-zoom as it's unstable for mobile usage for now (can still be manually installed)\n",
|
| 128 |
+
" + [QoL Userscript] Fixed ngrok token autosave (pls update manually via ur userscript manager)\n",
|
| 129 |
+
" + Added sam models support with `sam:` prefix (thanks ZeroDuri#7380)\n",
|
| 130 |
+
" + Removed notification sound from colab since it's buggy and sometimes rang for no reason XD\n",
|
| 131 |
+
" + added more negative TIs (EN2, negative_hand, simple5.5, simple5.6)\n",
|
| 132 |
+
" + updated all extensions\n",
|
| 133 |
+
" + using different gradio for now to fix gen button stuck\n",
|
| 134 |
+
" + attempts to fix vae first load issue\n",
|
| 135 |
+
" - removed locon extension (replaced by lycoris ext fully)\n",
|
| 136 |
+
" + added waifu diffusion 1.5 b3 all aesthetic variants\n",
|
| 137 |
+
" + attempts to make colab start faster\n",
|
| 138 |
+
" + added lycoris support with lycoris prefix like this `lycoris:https://link.com`\n",
|
| 139 |
+
" + added notification sounds after download complete (in colab itself, not webui)\n",
|
| 140 |
+
" - disabled stealth pnginfo for now due to some bug\n",
|
| 141 |
+
" + change image browser to infinite img browser\n",
|
| 142 |
+
" + add adetailer\n",
|
| 143 |
+
" + add canvas-zoom\n",
|
| 144 |
+
" + update webui to the latest commit\n",
|
| 145 |
+
" + update all extensions\n",
|
| 146 |
+
" - removed custom theme as of now (y-yes im lazy)\n",
|
| 147 |
+
" + adapted to py 3.10.11\n",
|
| 148 |
+
" + updated all extension\n",
|
| 149 |
+
" + revised blapshemy\n",
|
| 150 |
+
" + updated configs to match blapshemy dir\n",
|
| 151 |
+
" + Blapshemy!\n",
|
| 152 |
+
" + Controlnet 1.1\n",
|
| 153 |
+
" + Google updated torch to 2.0.0+cu118\n",
|
| 154 |
+
" + Updated all deps to adapt the google's new update\n",
|
| 155 |
+
" + Updated xformers to 0.0.18\n",
|
| 156 |
+
" + Added 2 NMKD Upscaler (YandereNeo and Superscale)\n",
|
| 157 |
+
" + Added DEPD Upscaler\n",
|
| 158 |
+
" + Added `[REDACTED]-state` and `sd_webui_stealth_pnginfo` extension\n",
|
| 159 |
+
" + New quicksettings item: stealth_pnginfo checkbox\n",
|
| 160 |
+
" + Disabled april fools troll\n",
|
| 161 |
+
" - Revert back to STABLE COMMIT (Stable by default)\n",
|
| 162 |
+
" - Disabled pulling latest webui checkbox\n",
|
| 163 |
+
" + Added [mofu]-3d-open-pose-editor\n",
|
| 164 |
+
" + Changed image browser to AlUlkesh's fork\n",
|
| 165 |
+
" + Updated necessary deps\n",
|
| 166 |
+
" + Updated extensions\n",
|
| 167 |
+
" + Added more tunnels to \"Alternative Tunnels\"\n",
|
| 168 |
+
" + Added more ram optimization (camenduru's ram patch)\n",
|
| 169 |
+
" + Added fun stuff :>\n",
|
| 170 |
+
" + Changes to output name to be more meaningful\n",
|
| 171 |
+
" + Attempt to fix broken start link\n",
|
| 172 |
+
" - Disabled openpose-editor\n",
|
| 173 |
+
" - Disabled [mofu]-depth-lib\n",
|
| 174 |
+
" - Deleted Easter Egg (will add more in future without noticing)\n",
|
| 175 |
+
" + Change defaults: negative prompts, max res, max batch size\n",
|
| 176 |
+
" + Added [mofu]-runtime-block-merge\n",
|
| 177 |
+
" + Added multidiffusion-upscaler-for-automatic1111\n",
|
| 178 |
+
" + Added [REDACTED]-image-filters\n",
|
| 179 |
+
" + Added sd-dynamic-prompts + wildcards (credit: CtD)\n",
|
| 180 |
+
" + Fixed configs_in_drive and output_to_drive can't work together\n",
|
| 181 |
+
" + Fixed merge conflict issue that preventing webui from starting\n",
|
| 182 |
+
" + Updated xformers\n",
|
| 183 |
+
" + Added [mofu]-tunnels (fork by camenduru)\n",
|
| 184 |
+
" + Changed `[REDACTED]-images-browser` extension to `sd_images_browser` (fork by aka7774)\n",
|
| 185 |
+
" + Added sd-fast-pnginfo extension\n",
|
| 186 |
+
" + Replaced blessed_vae -> blessed2_vae\n",
|
| 187 |
+
" + Adapted to python 3.9 update\n",
|
| 188 |
+
" + Added t2iadapter models (including style)\n",
|
| 189 |
+
" + Increase ControlNet Max Models to 4\n",
|
| 190 |
+
" + New Default Extension: [[mofu]-llul] gh: hnmr293 sd + webui-llul\n",
|
| 191 |
+
" + Fixed broken img2img\n",
|
| 192 |
+
"\n",
|
| 193 |
+
" + Added Composable Lora extension\n",
|
| 194 |
+
" + Added Custom tags + easter eggs :>\n",
|
| 195 |
+
" + Added poseX and [REDACTED]-fix-image-paste extensions\n",
|
| 196 |
+
" + Added Colab Mobile Keep Alive cell (in useful utils, run it before start cell)\n",
|
| 197 |
+
" + Fixed extra networks tab after re-ordering tool buttons\n",
|
| 198 |
+
" + Added an option to disable notification sound in webui\n",
|
| 199 |
+
" + Lowered the notification sound by 40%. (thanks RileyX for the suggestion)\n",
|
| 200 |
+
" + Replaced two_shot_ext options (already built in)\n",
|
| 201 |
+
" + All_ControlNet is now enabled by default\n",
|
| 202 |
+
" + Notification sounds when finished generating, forked from https://github.com/etherealxx/batchlinks-webui\n",
|
| 203 |
+
" + New default extensions:\n",
|
| 204 |
+
" + [REDACTED]-two-shot\n",
|
| 205 |
+
" + [mofu]-supermerger\n",
|
| 206 |
+
" + batchlinks-webui\n",
|
| 207 |
+
" + a1111-[mofu]-locon\n",
|
| 208 |
+
" + [mofu]-depth-lib\n",
|
| 209 |
+
" + openpose-editor\n",
|
| 210 |
+
"\n",
|
| 211 |
+
" + Manual Downloads is now supported. Guide soon!\n",
|
| 212 |
+
" + Added Waifu Diffusion Beta2 Aesthetic\n",
|
| 213 |
+
" + Replaced WD 1.5 Beta -> Waifu Diffusion Beta2\n",
|
| 214 |
+
" + Fixed SD vae\n",
|
| 215 |
+
" + New option: fast_start. This will make the startup speed faster by bypassing dependency installations (will break extensions, use with caution)\n",
|
| 216 |
+
" + New option: configs_in_drive. This will use configs (config, uiconfig, styles) in your drive\n",
|
| 217 |
+
" + Changed git pull logic to first install only for saving time (will add old option soon)\n",
|
| 218 |
+
" + Updated xformers, deps, and some UI settings\n",
|
| 219 |
+
" + New model: All DIFF control models (see the differences [here](https://huggingface.co/kohya-ss/ControlNet-diff-modules/discussions/1))\n",
|
| 220 |
+
" + Fixed umiAI and two shot can't be installed together (Thanks Aojiru)\n",
|
| 221 |
+
" + Fixed control models hardlink (Thanks Aojiru)\n",
|
| 222 |
+
" + New model: All Control Models (fp16)\n",
|
| 223 |
+
" + New option: Two_shot Extension\n",
|
| 224 |
+
" + Support for control models in `custom_urls`\n",
|
| 225 |
+
" + Added controlnet extension by default\n",
|
| 226 |
+
" + Preload with self-trimmed and self-converted safetensors openpose model (+openpose hands and body pth models)\n",
|
| 227 |
+
" - Installation speed slowed by few seconds due to models addition (1.7gb -> 3gb)\n",
|
| 228 |
+
" - Changed console text to cyan\n",
|
| 229 |
+
" - Model replaced: WD 1.4 e1 -> WD 1.5 Beta\n",
|
| 230 |
+
" - New option: UmiAI. Now it's a separate option, no more bloated embeddings :D\n",
|
| 231 |
+
" - New option: Update extensions. Basically updating all the extension the latest version (Might be slow)\n",
|
| 232 |
+
" - New option: Colab Optimization. (basically Load in vram + aggressive gradio queue)\n",
|
| 233 |
+
" - Added support for old commits by removing inbuilt negative embeddings. (if you use commit_hash that is)\n",
|
| 234 |
+
" - Gradio server is turned off when `alternative tunnel` or `ngrok` is active.\n",
|
| 235 |
+
"\n",
|
| 236 |
+
"\n",
|
| 237 |
+
"</details>\n",
|
| 238 |
+
"\n",
|
| 239 |
+
"<img src=\"https://count.getloli.com/get/@:ncpt-colab?theme=rule34\" height=\"90px\" alt=\"counted since: May 14\"/>\n",
|
| 240 |
+
"<br>\n",
|
| 241 |
+
"<img src=\"https://media.tenor.com/6lm-svEn7dEAAAAC/cirno-fumo.gif\" height=\"90px\" alt=\"cirno day exclusive\"/>\n"
|
| 242 |
+
],
|
| 243 |
+
"metadata": {
|
| 244 |
+
"id": "mgKX41doZJ3u"
|
| 245 |
+
}
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"cell_type": "markdown",
|
| 249 |
+
"source": [
|
| 250 |
+
"# Seems like this is the end...\n",
|
| 251 |
+
"Sadly colab decided not to support any A1111 notebooks anymore... so you might starting to get disconnected for no reason at all. Thank you for everything."
|
| 252 |
+
],
|
| 253 |
+
"metadata": {
|
| 254 |
+
"id": "QJodVVDuufSW"
|
| 255 |
+
}
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"cell_type": "code",
|
| 259 |
+
"execution_count": null,
|
| 260 |
+
"metadata": {
|
| 261 |
+
"id": "8Uvqba0yKW7U",
|
| 262 |
+
"cellView": "form"
|
| 263 |
+
},
|
| 264 |
+
"outputs": [],
|
| 265 |
+
"source": [
|
| 266 |
+
"# Dear Google, I love you! Please don't ban me from colab T_T\n",
|
| 267 |
+
"#added yoinked\n",
|
| 268 |
+
"#@title # **Start** 🚀\n",
|
| 269 |
+
"# All necessary imports goes here\n",
|
| 270 |
+
"from IPython.display import clear_output, display, HTML\n",
|
| 271 |
+
"import os\n",
|
| 272 |
+
"import time\n",
|
| 273 |
+
"from datetime import timedelta\n",
|
| 274 |
+
"from google.colab import drive\n",
|
| 275 |
+
"from IPython.utils import capture\n",
|
| 276 |
+
"from subprocess import getoutput\n",
|
| 277 |
+
"from urllib.parse import unquote\n",
|
| 278 |
+
"from google.colab.output import eval_js\n",
|
| 279 |
+
"%cd /content\n",
|
| 280 |
+
"\n",
|
| 281 |
+
"try:\n",
|
| 282 |
+
" start_colab\n",
|
| 283 |
+
"except:\n",
|
| 284 |
+
" start_colab = int(time.time())-5\n",
|
| 285 |
+
"\n",
|
| 286 |
+
"print(\"\\033[96m\") #Cyan text\n",
|
| 287 |
+
"# Check if gpu exist, stop if don't.\n",
|
| 288 |
+
"try:\n",
|
| 289 |
+
" output\n",
|
| 290 |
+
"except:\n",
|
| 291 |
+
" print('⌚ Checking GPU...', end='')\n",
|
| 292 |
+
" output = getoutput('nvidia-smi --query-gpu=gpu_name --format=csv')\n",
|
| 293 |
+
" if \"name\" in output:\n",
|
| 294 |
+
" gpu_name = output[5:]\n",
|
| 295 |
+
" print('\\r✅ Current GPU:', gpu_name, flush=True)\n",
|
| 296 |
+
" else:\n",
|
| 297 |
+
" print('\\r\\033[91m❎ ERROR: No GPU detected. Please do step below to enable.\\n', flush=True)\n",
|
| 298 |
+
" display(HTML(\"<img src='https://i.ibb.co/HC9KH17/NVIDIA-Share-23-01-02-173037.png' width='800px'/>\"))\n",
|
| 299 |
+
" print('\\033[91m\\nIf it says \"Cannot connect to GPU backend\", meaning you\\'ve either reached free usage limit. OR there\\'s no gpu available.\\n\\nDon\\'t mind me... I\\'m destroying your current session for your own good...')\n",
|
| 300 |
+
" display(HTML(\"<img src='https://media.tenor.com/E9omRGF7x0AAAAAC/hitori-gotou-bocchi-rock.gif' width='500px'/>\"))\n",
|
| 301 |
+
" time.sleep(5)\n",
|
| 302 |
+
" from google.colab import runtime\n",
|
| 303 |
+
" runtime.unassign()\n",
|
| 304 |
+
"\n",
|
| 305 |
+
"# [ALL PARAMS]-----------------------------------------------\n",
|
| 306 |
+
"#@markdown ### **Install Configurations [?](https://rentry.org/ncpt_what)**\n",
|
| 307 |
+
"#@markdown These options only runs on First Install\n",
|
| 308 |
+
"latest_webui = False #@param{type:\"boolean\"}\n",
|
| 309 |
+
"latest_extensions = True #@param{type:\"boolean\"}\n",
|
| 310 |
+
"branch = \"master\" #@param [\"master\",\"release_candidate\",\"dev\"]\n",
|
| 311 |
+
"sdxl_patch = False\n",
|
| 312 |
+
"\n",
|
| 313 |
+
"#@markdown ### <br> **Configurations**\n",
|
| 314 |
+
"output_to_drive = False #@param{type:\"boolean\"}\n",
|
| 315 |
+
"configs_in_drive = False #@param{type:\"boolean\"}\n",
|
| 316 |
+
"fast_start = False #@param{type:\"boolean\"}\n",
|
| 317 |
+
"auto_vae = False #@param{type:\"boolean\"}\n",
|
| 318 |
+
"no_custom_theme = False #@param {type:\"boolean\"}\n",
|
| 319 |
+
"merge_in_vram = False #@param {type:\"boolean\"}\n",
|
| 320 |
+
"load_in_vram = False #@param {type:\"boolean\"}\n",
|
| 321 |
+
"ram_patch_for_sd2 = False #@param{type:\"boolean\"}\n",
|
| 322 |
+
"dpmpp_v2 = False #@param{type:\"boolean\"}\n",
|
| 323 |
+
"krita_paint_ext = False #@param {type:\"boolean\"}\n",
|
| 324 |
+
"verbose_download = False #@param {type:\"boolean\"}\n",
|
| 325 |
+
"commandline_arguments = \"--enable-insecure-extension-access --share --disable-safe-unpickle --theme dark --no-hashing --xformers\" #@param{type:\"string\"}\n",
|
| 326 |
+
"commit_hash = \"\" #@param{type:\"string\"}\n",
|
| 327 |
+
"ngrok_token = \"2Lc4gkhRYt3qQBJdcJIDGgclNrb_M3RiJdXAB2fot3r7AT6y\" #@param{type:\"string\"}\n",
|
| 328 |
+
"ngrok_region = \"jp\" #@param [\"us\", \"eu\", \"au\", \"ap\", \"sa\", \"jp\", \"in\"]\n",
|
| 329 |
+
"ngrok_auto_save_load = False #@param{type:\"boolean\"}\n",
|
| 330 |
+
"alternative_tunnels = False #@param{type:\"boolean\"}\n",
|
| 331 |
+
"with_bore = False #@param{type:\"boolean\"}\n",
|
| 332 |
+
"\n",
|
| 333 |
+
"#@markdown ### <br> **Models, VAEs, Embeddings, Hypernetworks, Yaml, LoRA**\n",
|
| 334 |
+
"#@markdown *Check only what you need, colab storage is not unlimited.*\n",
|
| 335 |
+
"optional_huggingface_token=\"\" #@param{type:\"string\"}\n",
|
| 336 |
+
"model_url = \"\" # waifu_diffusion_beta2\n",
|
| 337 |
+
"# waifu_diffusion_AES = False #@param{type:\"boolean\"}\n",
|
| 338 |
+
"# waifu_diffusion = False #@param{type:\"boolean\"}\n",
|
| 339 |
+
"waifu_diffusion = \"none\" #@param [\"radiance\", \"ink\", \"mofu\", \"illusion\", \"none\"]\n",
|
| 340 |
+
"# anything_v3 = False #@param{type:\"boolean\"}\n",
|
| 341 |
+
"anything_v4_5 = False #@param{type:\"boolean\"}\n",
|
| 342 |
+
"anylora = False #@param{type:\"boolean\"}\n",
|
| 343 |
+
"amedira = False #@param{type:\"boolean\"}\n",
|
| 344 |
+
"awooooooo = False #@param{type:\"boolean\"}\n",
|
| 345 |
+
"gishiki_v1_1 = False #@param{type:\"boolean\"}\n",
|
| 346 |
+
"something_v2_2 = False #@param{type:\"boolean\"}\n",
|
| 347 |
+
"anything_vae = False #@param{type:\"boolean\"}\n",
|
| 348 |
+
"blessed2_vae = False #@param{type:\"boolean\"}\n",
|
| 349 |
+
"wd_vae = False #@param{type:\"boolean\"}\n",
|
| 350 |
+
"sd_vae = False #@param{type:\"boolean\"}\n",
|
| 351 |
+
"controlnet = \"v1.1\" #@param [\"v1.1\", \"v1.0\", \"v1.0-diff\", \"t2i\", \"none\"]\n",
|
| 352 |
+
"null_model = False #@param{type:\"boolean\"}\n",
|
| 353 |
+
"custom_urls = \"https://civitai.com/api/download/models/133462, https://civitai.com/api/download/models/161948, https://civitai.com/api/download/models/152309, https://civitai.com/api/download/models/155282, https://github.com/AIrjen/OneButtonPrompt\" #@param {type:\"string\"}\n",
|
| 354 |
+
"#@markdown <font color=gray><i> Put any models, embeddings, configs, hypernetworks, loras links and separate it with comma.<br>\n",
|
| 355 |
+
"#@markdown <img src=\"https://cdn.discordapp.com/emojis/930580027135901777.webp?size=56\" width=\"18\"/> [How to use this custom url box?](https://rentry.org/custom_url_nocrypt) - [**Awesome Models List**](https://rentry.org/ncpt_fav_models) ✨\n",
|
| 356 |
+
"\n",
|
| 357 |
+
"# CONFIG DIR (not recommended to change unless you know what you're doing) modules/sd_models.py\n",
|
| 358 |
+
"destination_dir = \"/content/.downloaded/\"\n",
|
| 359 |
+
"config_dir=\"/content/sdw/config.json\"\n",
|
| 360 |
+
"models_dir = \"/content/sdw/models/Stable-diffusion/\"\n",
|
| 361 |
+
"vaes_dir = \"/content/sdw/models/VAE/\"\n",
|
| 362 |
+
"hypernetworks_dir = \"/content/sdw/models/hypernetworks/\"\n",
|
| 363 |
+
"embeddings_dir = \"/content/sdw/embeddings/\"\n",
|
| 364 |
+
"loras_dir = \"/content/sdw/models/Lora/\"\n",
|
| 365 |
+
"# lycoris_dir = \"/content/sdw/models/LyCORIS/\"\n",
|
| 366 |
+
"patches_dir = \"/content/patches/\"\n",
|
| 367 |
+
"extensions_dir = \"/content/sdw/extensions/\"\n",
|
| 368 |
+
"control_dir = \"/content/sdw/models/ControlNet/\"\n",
|
| 369 |
+
"drive_config_dir = \"/content/gdrive/MyDrive/WebUI/configs/\"\n",
|
| 370 |
+
"sam_dir = \"/content/sdw/models/sam/\"\n",
|
| 371 |
+
"\n",
|
| 372 |
+
"# -----------------------------------------------\n",
|
| 373 |
+
"\n",
|
| 374 |
+
"# Append models to model_url\n",
|
| 375 |
+
"model_url+=custom_urls+\", \" if custom_urls else \"\"\n",
|
| 376 |
+
"# if anything_v3:\n",
|
| 377 |
+
"# model_url+=\"https://huggingface.co/NoCrypt/safetensor_models/resolve/main/Anything-V3.0-pruned-fp32.safetensors, \"\n",
|
| 378 |
+
"\n",
|
| 379 |
+
"if anylora:\n",
|
| 380 |
+
" model_url+=\"https://huggingface.co/Lykon/AnyLoRA/resolve/main/AnyLoRA_noVae_fp16-pruned.safetensors, \"\n",
|
| 381 |
+
"if amedira:\n",
|
| 382 |
+
" model_url+=\"https://huggingface.co/AshtakaOOf/Amedira/resolve/main/Amedira-bV.safetensors, \"\n",
|
| 383 |
+
"if anything_v4_5:\n",
|
| 384 |
+
" model_url+=\"https://huggingface.co/ckpt/anything-v4.0/resolve/main/anything-v4.5-pruned.safetensors, \"\n",
|
| 385 |
+
"if gishiki_v1_1:\n",
|
| 386 |
+
" model_url+=\"https://huggingface.co/Aotsuyu/Gishiki/resolve/main/Gishikiv1.1.safetensors, \"\n",
|
| 387 |
+
"if something_v2_2:\n",
|
| 388 |
+
" model_url+=\"https://huggingface.co/NoCrypt/SomethingV2_2/resolve/main/SomethingV2_2.safetensors, \"\n",
|
| 389 |
+
"if waifu_diffusion == \"radiance\":\n",
|
| 390 |
+
" model_url+=\"https://huggingface.co/waifu-diffusion/wd-1-5-beta3/resolve/main/wd-radiance-fp16.safetensors, \"\n",
|
| 391 |
+
"if waifu_diffusion == \"ink\":\n",
|
| 392 |
+
" model_url+=\"https://huggingface.co/waifu-diffusion/wd-1-5-beta3/resolve/main/wd-ink-fp16.safetensors, \"\n",
|
| 393 |
+
"if waifu_diffusion == \"mofu\": #mofu!\n",
|
| 394 |
+
" model_url+=\"https://huggingface.co/waifu-diffusion/wd-1-5-beta3/resolve/main/wd-mofu-fp16.safetensors, \"\n",
|
| 395 |
+
"if waifu_diffusion == \"illusion\":\n",
|
| 396 |
+
" model_url+=\"https://huggingface.co/waifu-diffusion/wd-1-5-beta3/resolve/main/wd-illusion-fp16.safetensors, \"\n",
|
| 397 |
+
"if awooooooo:\n",
|
| 398 |
+
" model_url+=\"https://huggingface.co/yoinked/merges/resolve/main/awoo/awooooooo.safetensors, \"\n",
|
| 399 |
+
"\n",
|
| 400 |
+
"if anything_vae or anything_v4_5 or anylora:\n",
|
| 401 |
+
" model_url+=\" https://huggingface.co/NoCrypt/resources/resolve/main/VAE/any.vae.safetensors, \"\n",
|
| 402 |
+
"if blessed2_vae:\n",
|
| 403 |
+
" model_url+=\"https://huggingface.co/NoCrypt/resources/resolve/main/VAE/blessed2.vae.safetensors, \"\n",
|
| 404 |
+
"if wd_vae or waifu_diffusion!=\"none\":\n",
|
| 405 |
+
" model_url+=\"https://huggingface.co/NoCrypt/resources/resolve/main/VAE/wd.vae.safetensors, \"\n",
|
| 406 |
+
"if sd_vae:\n",
|
| 407 |
+
" model_url+=\"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors, \"\n",
|
| 408 |
+
"if controlnet == \"v1.0\":\n",
|
| 409 |
+
" model_url+=\"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_canny-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_depth-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_hed-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_mlsd-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_normal-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_openpose-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_scribble-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_seg-fp16.safetensors, \"\n",
|
| 410 |
+
"if controlnet == \"v1.0-diff\":\n",
|
| 411 |
+
" model_url+=\"https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_canny_fp16.safetensors, https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_depth_fp16.safetensors, https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_hed_fp16.safetensors, https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_mlsd_fp16.safetensors, https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_normal_fp16.safetensors, https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_openpose_fp16.safetensors, https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_scribble_fp16.safetensors, https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_seg_fp16.safetensors, \"\n",
|
| 412 |
+
"if controlnet == \"t2i\":\n",
|
| 413 |
+
" model_url+=\"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_canny-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_color-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_depth-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_keypose-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_openpose-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_seg-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_sketch-fp16.safetensors, https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_style-fp16.safetensors,\"\n",
|
| 414 |
+
"if controlnet == \"v1.1\":\n",
|
| 415 |
+
" model_url+=\"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_depth_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_depth_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.yaml, https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11u_sd15_tile_fp16.safetensors, control:https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11u_sd15_tile_fp16.yaml, \"\n",
|
| 416 |
+
"\n",
|
| 417 |
+
"# Image outputs to drive (part 1)\n",
|
| 418 |
+
"if output_to_drive or configs_in_drive:\n",
|
| 419 |
+
" if not os.path.exists('/content/gdrive'):\n",
|
| 420 |
+
" drive.mount('/content/gdrive')\n",
|
| 421 |
+
"\n",
|
| 422 |
+
"# Unpack Repo, Dependencies, Caches\n",
|
| 423 |
+
"if not os.path.exists(\"/content/sdw\"):\n",
|
| 424 |
+
" start_install = int(time.time())\n",
|
| 425 |
+
"\n",
|
| 426 |
+
" # [!] Copy Warning ⚠️ --------------------------------------\n",
|
| 427 |
+
" # By removing these, you understand that updates will most likely breaks some stuff.\n",
|
| 428 |
+
" # I suggest you to use \"permanent\" link for repo, deps, and cache. This will prevent this colab from breaking when I update it.\n",
|
| 429 |
+
" # How to get permanent link? Go to a commit in my repo (https://huggingface.co/NoCrypt/fast-repo/commits/main) then click browse file.\n",
|
| 430 |
+
" # Then copy repo file link from that commit, it should be something like this: https://huggingface.co/NoCrypt/fast-repo/resolve/faa7a6c0a7d4d456415326285446225d12d0d426/repo.tar.lz4\n",
|
| 431 |
+
" # Replace the repo link below (in aria2c) to permanent link\n",
|
| 432 |
+
" # -----------------------------------------------------------\n",
|
| 433 |
+
" with capture.capture_output() as cap:\n",
|
| 434 |
+
" !pip install -q ipynbname\n",
|
| 435 |
+
" from ipynbname import name as nnb\n",
|
| 436 |
+
" if not nnb().split('=')[1].startswith(\"1wEa-tS10h4LlDykd87TF5zzpXIIQoCmq\"):\n",
|
| 437 |
+
" display(HTML(\"\"\"\n",
|
| 438 |
+
" <p style=\"color:red;font-size:25px\"><u> 💀 Colab copy detected 💀</u></p>\n",
|
| 439 |
+
" <p style=\"font-size:20px\">Please keep your copy up-to-date, do not report any bugs to NoCrypt<br/><br/></p>\n",
|
| 440 |
+
" <img src=\"https://i.ibb.co/2kV0btp/download-74.png\"/><br/><br/>\n",
|
| 441 |
+
" <p style=\"font-size:20px\">Please keep your copy up-to-date, do not report any bugs to NoCrypt</p>\n",
|
| 442 |
+
" <p style=\"font-size:20px\">P.s. Feel free to remove this warning! I've included a note on how to prevent colab from breaking in the code </p>\n",
|
| 443 |
+
" \"\"\"))\n",
|
| 444 |
+
" time.sleep(10)\n",
|
| 445 |
+
" # ------------------------------------ Feel free to remove! Don't forget to read notes above ✌️\n",
|
| 446 |
+
"\n",
|
| 447 |
+
"\n",
|
| 448 |
+
" print(\"🚀 Unpacking... Please do not stop this process at all cost...\", end='')\n",
|
| 449 |
+
" with capture.capture_output() as cap:\n",
|
| 450 |
+
" # !rm -rf /usr/local/lib/python3.10/dist-packages/scipy /usr/local/lib/python3.10/dist-packages/scipy-*.dist-info/ /usr/local/lib/python3.10/dist-packages/scipy.libs\n",
|
| 451 |
+
" # !apt install -qq libunwind8-dev\n",
|
| 452 |
+
" !wget https://huggingface.co/NoCrypt/fast-repo/resolve/main/ubuntu_deps.zip ; unzip ubuntu_deps.zip -d ./deps ; dpkg -i ./deps/* ; rm -rf ubuntu_deps.zip /content/deps/\n",
|
| 453 |
+
" # !apt install liblz4-tool aria2\n",
|
| 454 |
+
" # !pip uninstall -q -y huggingface_hub\n",
|
| 455 |
+
" # !{'curl -LO https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep_13.0.0_amd64.deb && dpkg -i ripgrep_13.0.0_amd64.deb && rm -rf ripgrep_13.0.0_amd64.deb'}\n",
|
| 456 |
+
"\n",
|
| 457 |
+
" # !aria2c --summary-interval=10 -c -x 16 -k 1M -s 16 -d /content -Z \\\n",
|
| 458 |
+
" # https://huggingface.co/NoCrypt/fast-repo/resolve/main/dep.tar.lz4 \\\n",
|
| 459 |
+
" # https://huggingface.co/NoCrypt/fast-repo/resolve/main/repo.tar.lz4 \\\n",
|
| 460 |
+
" # https://huggingface.co/NoCrypt/fast-repo/resolve/main/cache.tar.lz4\n",
|
| 461 |
+
"\n",
|
| 462 |
+
" # !aria2c -d /content -o dep.tar.lz4 --summary-interval=10 -c -x 16 -k 1M -s 16 https://huggingface.co/NoCrypt/fast-repo/resolve/main/dep.tar.lz4\n",
|
| 463 |
+
" # !aria2c -d /content -o repo.tar.lz4 --summary-interval=10 -c -x 16 -k 1M -s 16 https://huggingface.co/NoCrypt/fast-repo/resolve/main/repo.tar.lz4\n",
|
| 464 |
+
" # !aria2c -d /content -o cache.tar.lz4 --summary-interval=10 -c -x 16 -k 1M -s 16 https://huggingface.co/NoCrypt/fast-repo/resolve/main/cache.tar.lz4\n",
|
| 465 |
+
"\n",
|
| 466 |
+
" !echo -e \"https://huggingface.co/NoCrypt/fast-repo/resolve/main/dep.tar.lz4\\n\\tout=dep.tar.lz4\\nhttps://huggingface.co/NoCrypt/fast-repo/resolve/main/repo.tar.lz4\\n\\tout=repo.tar.lz4\\nhttps://huggingface.co/NoCrypt/fast-repo/resolve/main/cache.tar.lz4\\n\\tout=cache.tar.lz4\\n\" \\\n",
|
| 467 |
+
" | aria2c -i- -j5 -x16 -s16 -k1M -c\n",
|
| 468 |
+
"\n",
|
| 469 |
+
" !tar -xI lz4 -f dep.tar.lz4 --overwrite-dir --directory=/usr/local/lib/python3.10/dist-packages/ #(manual dir)\n",
|
| 470 |
+
" !tar -xI lz4 -f repo.tar.lz4 --directory=/ #/content/sdw/ (auto dir)\n",
|
| 471 |
+
" !tar -xI lz4 -f cache.tar.lz4 --directory=/ #/root/.cache/huggingface (auto dir)\n",
|
| 472 |
+
"\n",
|
| 473 |
+
" !rm -rf /content/dep.tar.lz4 /content/repo.tar.lz4 /content/cache.tar.lz4\n",
|
| 474 |
+
" os.environ[\"SAFETENSORS_FAST_GPU\"]='1'\n",
|
| 475 |
+
" os.environ[\"CUDA_MODULE_LOADING\"]=\"LAZY\"\n",
|
| 476 |
+
" os.environ[\"colab_url\"] = eval_js(\"google.colab.kernel.proxyPort(7860, {'cache': false})\")\n",
|
| 477 |
+
" os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\"\n",
|
| 478 |
+
" os.environ[\"PYTHONWARNINGS\"] = \"ignore\"\n",
|
| 479 |
+
" # %env PYTHONDONTWRITEBYTECODE=1\n",
|
| 480 |
+
" os.environ[\"TCMALLOC_AGGRESSIVE_DECOMMIT\"] = \"t\"\n",
|
| 481 |
+
"\n",
|
| 482 |
+
" !rm /content/sdw/extensions/tunnels/id_rsa.pub\n",
|
| 483 |
+
" !rm /content/sdw/extensions/tunnels/id_rsa\n",
|
| 484 |
+
"\n",
|
| 485 |
+
" # os.environ['PYTORCH_CUDA_ALLOC_CONF'] = \"garbage_collection_threshold:0.9,max_split_size_mb:512\"\n",
|
| 486 |
+
" # !apt -y update -qq\n",
|
| 487 |
+
"\n",
|
| 488 |
+
" !wget https://github.com/camenduru/gperftools/releases/download/v1.0/libtcmalloc_minimal.so.4 -O /content/libtcmalloc_minimal.so.4 -c\n",
|
| 489 |
+
" %env LD_PRELOAD=/content/libtcmalloc_minimal.so.4\n",
|
| 490 |
+
" del cap\n",
|
| 491 |
+
" if not os.path.exists(hypernetworks_dir):\n",
|
| 492 |
+
" os.makedirs(hypernetworks_dir)\n",
|
| 493 |
+
" # if not 'T4' in gpu_name: # [For colab makers out there, facebook's xformers pypi already support almost all gpu now]\n",
|
| 494 |
+
" # !pip uninstall -y xformers\n",
|
| 495 |
+
" install_time = timedelta(seconds=time.time()-start_install)\n",
|
| 496 |
+
" print(\"\\r🚀 Finished unpacking. Took\",\"%02d:%02d:%02d ⚡\\n\" % (install_time.seconds / 3600, (install_time.seconds / 60) % 60, install_time.seconds % 60), end='', flush=True)\n",
|
| 497 |
+
" # Colab 🤝 Gradio (Colab timer integration for gradio)\n",
|
| 498 |
+
" !echo -n {start_colab} > /content/sdw/static/colabTimer.txt\n",
|
| 499 |
+
" print(\"🤝 Colab timer integration complete! You can see your colab time inside webui.\")\n",
|
| 500 |
+
"\n",
|
| 501 |
+
" # Update using git pull\n",
|
| 502 |
+
" if latest_webui:\n",
|
| 503 |
+
" !git config --global user.email \"you@example.com\"\n",
|
| 504 |
+
" !git config --global user.name \"Your Name\"\n",
|
| 505 |
+
" print('⌚ Pulling latest changes...', end=\"\")\n",
|
| 506 |
+
" with capture.capture_output() as cap:\n",
|
| 507 |
+
" %cd /content/sdw\n",
|
| 508 |
+
" !git restore .\n",
|
| 509 |
+
" !git pull -X theirs --rebase --autostash\n",
|
| 510 |
+
" del cap\n",
|
| 511 |
+
" print('\\r🪄 \\033[96mYou are currently using latest version of webui. Please use commit_hash if there is error', flush=True)\n",
|
| 512 |
+
"\n",
|
| 513 |
+
" if branch != \"master\":\n",
|
| 514 |
+
" print(f'⌚ Changing branch to {branch}', end=\"\")\n",
|
| 515 |
+
" with capture.capture_output() as cap:\n",
|
| 516 |
+
" !git restore .\n",
|
| 517 |
+
" !git checkout {branch}\n",
|
| 518 |
+
" !git pull\n",
|
| 519 |
+
" print(f'\\r🪄 \\033[96mYou are currently using {branch} branch of webui', flush=True)\n",
|
| 520 |
+
"\n",
|
| 521 |
+
" # 3.32.xx sucks! Pngwn made some changes on 3.33.1 and it's 300% better\n",
|
| 522 |
+
" !sed -i 's@gradio==3.32.*@gradio==3.33.1@' /content/sdw/requirements_versions.txt\n",
|
| 523 |
+
"\n",
|
| 524 |
+
" # Update extensions\n",
|
| 525 |
+
" if latest_extensions:\n",
|
| 526 |
+
" print('⌚ Updating extensions (might take a while)...', end=\"\")\n",
|
| 527 |
+
" with capture.capture_output() as cap:\n",
|
| 528 |
+
" !{'for dir in /content/sdw/extensions/*/; do cd \"$dir\" && git fetch origin && git pull; done'}\n",
|
| 529 |
+
" del cap\n",
|
| 530 |
+
" print('\\r🪄 \\033[96mInbuilt extensions are updated to its latest versions', flush=True)\n",
|
| 531 |
+
"\n",
|
| 532 |
+
" !cd /content/sdw/repositories/stable-diffusion-stability-ai && git restore .\n",
|
| 533 |
+
" if sdxl_patch:\n",
|
| 534 |
+
" !sed -i -e '''/from modules import launch_utils/a\\import os''' /content/sdw/launch.py\n",
|
| 535 |
+
" !sed -i -e '''/ prepare_environment()/a\\ os.system\\(f\\\"\"\"sed -i -e ''\\\"s/dict()))/dict())).cuda()/g\\\"'' /content/sdw/repositories/stable-diffusion-stability-ai/ldm/util.py\"\"\")''' /content/sdw/launch.py\n",
|
| 536 |
+
"\n",
|
| 537 |
+
"else:\n",
|
| 538 |
+
" print(\"🚀 Already unpacked... Skipping.\")\n",
|
| 539 |
+
" time_since_start = timedelta(seconds=time.time()-start_colab)\n",
|
| 540 |
+
" print(\"⌚ You've been running this colab for\",\"%02d:%02d:%02d\" % (time_since_start.seconds / 3600, (time_since_start.seconds / 60) % 60, time_since_start.seconds % 60))\n",
|
| 541 |
+
"\n",
|
| 542 |
+
"os.makedirs(patches_dir, exist_ok=True)\n",
|
| 543 |
+
"# Revert changes using time-machine (git reset)\n",
|
| 544 |
+
"if commit_hash:\n",
|
| 545 |
+
" print('⌚ Activating time machine...', end=\"\")\n",
|
| 546 |
+
" with capture.capture_output() as cap:\n",
|
| 547 |
+
" %cd /content/sdw\n",
|
| 548 |
+
" !git config --global user.email \"you@example.com\"\n",
|
| 549 |
+
" !git config --global user.name \"Your Name\"\n",
|
| 550 |
+
" # !git stash\n",
|
| 551 |
+
" !git reset --hard {commit_hash}\n",
|
| 552 |
+
" # !git stash apply\n",
|
| 553 |
+
" # !rm -rf /content/sdw/embeddings/*\n",
|
| 554 |
+
" del cap\n",
|
| 555 |
+
" print('\\r⌚ Time machine activated, you\\'re on commit', commit_hash, flush=True)\n",
|
| 556 |
+
" # print('✌️ Embeddings have been deleted for time machine support')\n",
|
| 557 |
+
"\n",
|
| 558 |
+
"# Colab patches for quality of life improvements\n",
|
| 559 |
+
"with capture.capture_output() as cap:\n",
|
| 560 |
+
" !wget https://gist.github.com/NoCrypt/6e7331eda3d670c2156852ae5e300a42/raw/e52dac97fcabcb054b5737e0c5188cbc600c6582/DPMPP_2M_V2.patch -P {patches_dir} -c\n",
|
| 561 |
+
" !wget https://gist.github.com/NoCrypt/6e7331eda3d670c2156852ae5e300a42/raw/e52dac97fcabcb054b5737e0c5188cbc600c6582/idgaf_about_git_ext.patch -P {patches_dir} -c\n",
|
| 562 |
+
" !wget https://gist.github.com/NoCrypt/6e7331eda3d670c2156852ae5e300a42/raw/e52dac97fcabcb054b5737e0c5188cbc600c6582/sd-lowram.patch -P {patches_dir} -c\n",
|
| 563 |
+
" if ram_patch_for_sd2:\n",
|
| 564 |
+
" pass # no needed\n",
|
| 565 |
+
" # !cd /content/sdw/ && git apply --ignore-whitespace {patches_dir}/sd-lowram.patch\n",
|
| 566 |
+
" # else:\n",
|
| 567 |
+
" # !cd /content/sdw/ && git apply --ignore-whitespace -R {patches_dir}/sd-lowram.patch\n",
|
| 568 |
+
"\n",
|
| 569 |
+
"\n",
|
| 570 |
+
" if dpmpp_v2:\n",
|
| 571 |
+
" !cd /content/sdw/ && git apply --ignore-whitespace {patches_dir}/DPMPP_2M_V2.patch\n",
|
| 572 |
+
" else:\n",
|
| 573 |
+
" !cd /content/sdw/ && git apply --ignore-whitespace -R {patches_dir}/DPMPP_2M_V2.patch\n",
|
| 574 |
+
"\n",
|
| 575 |
+
" # IGAF, get lost git ext checker thingy\n",
|
| 576 |
+
" # !cd /content/sdw/ && git apply --ignore-whitespace {patches_dir}/idgaf_about_git_ext.patch\n",
|
| 577 |
+
"\n",
|
| 578 |
+
" # Colab Optimizations modified to load_in_vram\n",
|
| 579 |
+
" if load_in_vram:\n",
|
| 580 |
+
" commandline_arguments += ' --lowram '\n",
|
| 581 |
+
"\n",
|
| 582 |
+
" # Merge in vram: self-explainotory\n",
|
| 583 |
+
" if merge_in_vram:\n",
|
| 584 |
+
" !sed -i \"s@'cpu'@'cuda'@\" /content/sdw/modules/extras.py\n",
|
| 585 |
+
" else:\n",
|
| 586 |
+
" !sed -i \"s@'cuda'@'cpu'@\" /content/sdw/modules/extras.py\n",
|
| 587 |
+
"\n",
|
| 588 |
+
" # Remove custom theme (since it's not for everyone)\n",
|
| 589 |
+
" if no_custom_theme:\n",
|
| 590 |
+
" !sed -i 's@\"gradio_theme\":.*@\"gradio_theme\": \"Default\",@' {config_dir}\n",
|
| 591 |
+
" else:\n",
|
| 592 |
+
" !sed -i 's@\"gradio_theme\":.*@\"gradio_theme\": \"NoCrypt/miku\",@' {config_dir}\n",
|
| 593 |
+
"\n",
|
| 594 |
+
"# Ngrok stuff goes here\n",
|
| 595 |
+
"if ngrok_token or ngrok_auto_save_load:\n",
|
| 596 |
+
" if ngrok_auto_save_load:\n",
|
| 597 |
+
" if not os.path.exists('/content/gdrive'):\n",
|
| 598 |
+
" drive.mount('/content/gdrive')\n",
|
| 599 |
+
" if ngrok_token:\n",
|
| 600 |
+
" if not os.path.exists(\"/content/gdrive/MyDrive/WebUI/ngrokToken.txt\"):\n",
|
| 601 |
+
" !mkdir -p /content/gdrive/MyDrive/WebUI/\n",
|
| 602 |
+
" !touch /content/gdrive/MyDrive/WebUI/ngrokToken.txt\n",
|
| 603 |
+
" f = open(\"/content/gdrive/MyDrive/WebUI/ngrokToken.txt\", \"w+\")\n",
|
| 604 |
+
" f.write(ngrok_token+\",\"+ngrok_region)\n",
|
| 605 |
+
" f.close()\n",
|
| 606 |
+
" elif os.path.exists('/content/gdrive/MyDrive/WebUI/ngrokToken.txt'):\n",
|
| 607 |
+
" ngrok_token,ngrok_region = getoutput(\"cat /content/gdrive/MyDrive/WebUI/ngrokToken.txt\").split(\",\",2)\n",
|
| 608 |
+
" else:\n",
|
| 609 |
+
" print(\"warning: ngrok token not detected\")\n",
|
| 610 |
+
" commandline_arguments += ' --ngrok ' + ngrok_token + ' --ngrok-region ' + ngrok_region\n",
|
| 611 |
+
" commandline_arguments = commandline_arguments.replace(\"--share\",\"\")\n",
|
| 612 |
+
"\n",
|
| 613 |
+
"# Configs in drive\n",
|
| 614 |
+
"if configs_in_drive:\n",
|
| 615 |
+
" config_dir = drive_config_dir+\"config.json\"\n",
|
| 616 |
+
" if not os.path.exists(drive_config_dir):\n",
|
| 617 |
+
" !mkdir -p {drive_config_dir}\n",
|
| 618 |
+
" !cp /content/sdw/styles.csv /content/sdw/ui-config.json /content/sdw/config.json {drive_config_dir}\n",
|
| 619 |
+
" commandline_arguments += ' --ui-config-file ' + drive_config_dir+\"ui-config.json\"\n",
|
| 620 |
+
" commandline_arguments += ' --ui-settings-file ' + drive_config_dir+\"config.json\"\n",
|
| 621 |
+
" commandline_arguments += ' --styles-file ' + drive_config_dir+\"styles.csv\"\n",
|
| 622 |
+
"\n",
|
| 623 |
+
"# Image outputs to drive (part 2)\n",
|
| 624 |
+
"if output_to_drive:\n",
|
| 625 |
+
" !sed -i 's@\"outdir_txt2img_samples\": \"outputs/txt2img-images\"@\"outdir_txt2img_samples\": \"/content/gdrive/MyDrive/WebUI/outputs/txt2img-images\"@' {config_dir}\n",
|
| 626 |
+
" !sed -i 's@\"outdir_img2img_samples\": \"outputs/img2img-images\"@\"outdir_img2img_samples\": \"/content/gdrive/MyDrive/WebUI/outputs/img2img-images\"@' {config_dir}\n",
|
| 627 |
+
" !sed -i 's@\"outdir_extras_samples\": \"outputs/extras-images\"@\"outdir_extras_samples\": \"/content/gdrive/MyDrive/WebUI/outputs/extras-images\"@' {config_dir}\n",
|
| 628 |
+
" !sed -i 's@\"outdir_txt2img_grids\": \"outputs/txt2img-grids\"@\"outdir_txt2img_grids\": \"/content/gdrive/MyDrive/WebUI/outputs/txt2img-grids\"@' {config_dir}\n",
|
| 629 |
+
" !sed -i 's@\"outdir_img2img_grids\": \"outputs/img2img-grids\"@\"outdir_img2img_grids\": \"/content/gdrive/MyDrive/WebUI/outputs/img2img-grids\"@' {config_dir}\n",
|
| 630 |
+
" !sed -i 's@\"outdir_save\": \"log/images\"@\"outdir_save\": \"/content/gdrive/MyDrive/WebUI/outputs/log/images\"@' {config_dir}\n",
|
| 631 |
+
"else:\n",
|
| 632 |
+
" if '/gdrive/' in getoutput('cat '+config_dir):\n",
|
| 633 |
+
" !sed -i 's@\"outdir_txt2img_samples\": \"outputs/txt2img-images\"@\"outdir_txt2img_samples\": \"outputs/txt2img-images\"@' {config_dir}\n",
|
| 634 |
+
" !sed -i 's@\"outdir_img2img_samples\": \"outputs/img2img-images\"@\"outdir_img2img_samples\": \"outputs/img2img-images\"@' {config_dir}\n",
|
| 635 |
+
" !sed -i 's@\"outdir_extras_samples\": \"outputs/extras-images\"@\"outdir_extras_samples\": \"outputs/extras-images\"@' {config_dir}\n",
|
| 636 |
+
" !sed -i 's@\"outdir_txt2img_grids\": \"outputs/txt2img-grids\"@\"outdir_txt2img_grids\": \"outputs/txt2img-grids\"@' {config_dir}\n",
|
| 637 |
+
" !sed -i 's@\"outdir_img2img_grids\": \"outputs/img2img-grids\"@\"outdir_img2img_grids\": \"outputs/img2img-grids\"@' {config_dir}\n",
|
| 638 |
+
" !sed -i 's@\"outdir_save\": \"log/images\"@\"outdir_save\": \"log/images\"@' {config_dir}\n",
|
| 639 |
+
"\n",
|
| 640 |
+
"\n",
|
| 641 |
+
"# Install models from model_url, oh boi it's getting bigger\n",
|
| 642 |
+
"extension_repo = []\n",
|
| 643 |
+
"prefixes = [\n",
|
| 644 |
+
" \"config:\",\n",
|
| 645 |
+
" \"ui-config:\",\n",
|
| 646 |
+
" \"styles:\",\n",
|
| 647 |
+
" \"lora:\",\n",
|
| 648 |
+
" \"hypernetwork:\",\n",
|
| 649 |
+
" \"locon:\",\n",
|
| 650 |
+
" \"lycoris:\",\n",
|
| 651 |
+
" \"model:\",\n",
|
| 652 |
+
" \"vae:\",\n",
|
| 653 |
+
" \"control:\",\n",
|
| 654 |
+
" \"clone:\",\n",
|
| 655 |
+
" \"gfpgan:\",\n",
|
| 656 |
+
" \"ersgan:\",\n",
|
| 657 |
+
" \"swinr:\",\n",
|
| 658 |
+
" \"ldsr:\",\n",
|
| 659 |
+
" \"repo:\",\n",
|
| 660 |
+
" \"embeddings:\",\n",
|
| 661 |
+
" \"sam:\"\n",
|
| 662 |
+
"]\n",
|
| 663 |
+
"token = optional_huggingface_token if optional_huggingface_token else \"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\"\n",
|
| 664 |
+
"user_header = f\"\\\"Authorization: Bearer {token}\\\"\"\n",
|
| 665 |
+
"print('📦 Downloading models and stuff...', end='')\n",
|
| 666 |
+
"def handle_manual(url):\n",
|
| 667 |
+
" if url.startswith(\"config:\"):\n",
|
| 668 |
+
" manual_download(url, \"/content/sdw/config.json\")\n",
|
| 669 |
+
" elif url.startswith(\"ui-config:\"):\n",
|
| 670 |
+
" manual_download(url, \"/content/sdw/ui-config.json\")\n",
|
| 671 |
+
" elif url.startswith(\"styles:\"):\n",
|
| 672 |
+
" manual_download(url, \"/content/sdw/styles.csv\")\n",
|
| 673 |
+
" elif url.startswith(\"sam:\"):\n",
|
| 674 |
+
" manual_download(url, sam_dir)\n",
|
| 675 |
+
" elif url.startswith(\"lora:\") or url.startswith(\"locon:\") or url.startswith(\"lycoris:\"):\n",
|
| 676 |
+
" manual_download(url, loras_dir)\n",
|
| 677 |
+
" elif url.startswith(\"hypernetwork:\"):\n",
|
| 678 |
+
" manual_download(url, hypernetworks_dir)\n",
|
| 679 |
+
" elif url.startswith(\"model:\"):\n",
|
| 680 |
+
" manual_download(url, models_dir)\n",
|
| 681 |
+
" elif url.startswith(\"vae:\"):\n",
|
| 682 |
+
" manual_download(url, vaes_dir)\n",
|
| 683 |
+
" elif url.startswith(\"control:\"):\n",
|
| 684 |
+
" manual_download(url, control_dir)\n",
|
| 685 |
+
" elif url.startswith(\"gfpgan:\"):\n",
|
| 686 |
+
" manual_download(url, \"/content/sdw/models/GFPGAN\")\n",
|
| 687 |
+
" elif url.startswith(\"esrgan:\"):\n",
|
| 688 |
+
" manual_download(url, \"/content/sdw/models/ESRGAN\")\n",
|
| 689 |
+
" elif url.startswith(\"swinr:\"):\n",
|
| 690 |
+
" manual_download(url, \"/content/sdw/models/SwinR\")\n",
|
| 691 |
+
" elif url.startswith(\"ldsr:\"):\n",
|
| 692 |
+
" manual_download(url, \"/content/sdw/models/LDSR\")\n",
|
| 693 |
+
" elif url.startswith(\"embeddings:\"):\n",
|
| 694 |
+
" manual_download(url, embeddings_dir)\n",
|
| 695 |
+
" elif url.startswith(\"extension:\"):\n",
|
| 696 |
+
" extension_repo.append(url)\n",
|
| 697 |
+
" elif url.startswith(\"clone:\") or url.startswith(\"repo:\"):\n",
|
| 698 |
+
" !cd /content/.downloaded && git clone $url\n",
|
| 699 |
+
"\n",
|
| 700 |
+
"def manual_download(url, dst):\n",
|
| 701 |
+
" url = url[url.find(':')+1:]\n",
|
| 702 |
+
" if \".json\" in url or \".csv\" in url:\n",
|
| 703 |
+
" !wget \"{url}\" -O {dst} -c\n",
|
| 704 |
+
" elif '.yaml' in url or '.yml' in url or 'discord' in url:\n",
|
| 705 |
+
" !wget \"{url}\" -P {dst} -c\n",
|
| 706 |
+
" elif 'drive.google' in url:\n",
|
| 707 |
+
" if 'folders' in url:\n",
|
| 708 |
+
" !gdown --folder \"{url}\" -O {dst} --fuzzy -c\n",
|
| 709 |
+
" else:\n",
|
| 710 |
+
" !gdown \"{url}\" -O {dst} --fuzzy -c\n",
|
| 711 |
+
" elif 'huggingface' in url:\n",
|
| 712 |
+
" if '/blob/' in url:\n",
|
| 713 |
+
" url = url.replace('/blob/', '/resolve/')\n",
|
| 714 |
+
" parsed_link = '\\n{}\\n\\tout={}'.format(url,unquote(url.split('/')[-1]))\n",
|
| 715 |
+
" !echo -e \"{parsed_link}\" | aria2c --header={user_header} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d \"{dst}\"\n",
|
| 716 |
+
" elif 'http' in url or 'magnet' in url:\n",
|
| 717 |
+
" parsed_link = '\"{}\"'.format(url)\n",
|
| 718 |
+
" !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {dst} -Z {parsed_link}\n",
|
| 719 |
+
"\n",
|
| 720 |
+
"def download(url):\n",
|
| 721 |
+
" try:\n",
|
| 722 |
+
" have_drive_link\n",
|
| 723 |
+
" except:\n",
|
| 724 |
+
" if \"drive.google.com\" in url:\n",
|
| 725 |
+
" # I'm sorry drive ID enjoyer, this will make ID useless :(\n",
|
| 726 |
+
" !pip install -U gdown\n",
|
| 727 |
+
" have_drive_link = True\n",
|
| 728 |
+
" links_and_paths = url.split(',')\n",
|
| 729 |
+
" !mkdir -p {destination_dir} {models_dir} {vaes_dir} {hypernetworks_dir} {embeddings_dir} {loras_dir} {sam_dir}\n",
|
| 730 |
+
" http_links = []\n",
|
| 731 |
+
" huggingface_links = []\n",
|
| 732 |
+
" for link_or_path in links_and_paths:\n",
|
| 733 |
+
" link_or_path = link_or_path.strip()\n",
|
| 734 |
+
" if not link_or_path:\n",
|
| 735 |
+
" continue\n",
|
| 736 |
+
"\n",
|
| 737 |
+
" if any(link_or_path.startswith(prefix.lower()) for prefix in prefixes):\n",
|
| 738 |
+
" handle_manual(link_or_path)\n",
|
| 739 |
+
" continue\n",
|
| 740 |
+
"\n",
|
| 741 |
+
" if 'github.com' in link_or_path and ( '.git' in link_or_path or not '.' in link_or_path.split('/')[-1] ):\n",
|
| 742 |
+
" extension_repo.append(link_or_path)\n",
|
| 743 |
+
" continue\n",
|
| 744 |
+
"\n",
|
| 745 |
+
" if '.yaml' in link_or_path or '.yml' in link_or_path or 'discord' in link_or_path:\n",
|
| 746 |
+
" !wget {link_or_path} -P {destination_dir} -c\n",
|
| 747 |
+
" elif 'drive.google' in link_or_path:\n",
|
| 748 |
+
" if 'folders' in link_or_path:\n",
|
| 749 |
+
" !gdown --folder {link_or_path} -O {destination_dir} --fuzzy -c\n",
|
| 750 |
+
" else:\n",
|
| 751 |
+
" !gdown {link_or_path} -O {destination_dir} --fuzzy -c\n",
|
| 752 |
+
" elif 'huggingface' in link_or_path:\n",
|
| 753 |
+
" if '/blob/' in link_or_path:\n",
|
| 754 |
+
" link_or_path = link_or_path.replace('/blob/', '/resolve/')\n",
|
| 755 |
+
" huggingface_links.append(link_or_path)\n",
|
| 756 |
+
" elif 'http' in link_or_path or 'magnet' in link_or_path:\n",
|
| 757 |
+
" http_links.append(link_or_path)\n",
|
| 758 |
+
" elif '/' in link_or_path:\n",
|
| 759 |
+
" if not os.path.exists('/content/gdrive/MyDrive'):\n",
|
| 760 |
+
" print('Looks like there\\'s a path in your url. You need to mount your drive first.')\n",
|
| 761 |
+
" from google.colab import drive\n",
|
| 762 |
+
" drive.mount('/content/gdrive')\n",
|
| 763 |
+
" !rsync -avr --progress /content/gdrive/MyDrive/{link_or_path} {destination_dir}\n",
|
| 764 |
+
" else:\n",
|
| 765 |
+
" !gdown {link_or_path} -O {destination_dir} --fuzzy -c\n",
|
| 766 |
+
" if http_links:\n",
|
| 767 |
+
" links_string = ' '.join(['\"{}\"'.format(x) for x in http_links])\n",
|
| 768 |
+
" !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {destination_dir} -Z {links_string}\n",
|
| 769 |
+
" del links_string\n",
|
| 770 |
+
" if huggingface_links:\n",
|
| 771 |
+
" # links_string = ' '.join(['\"{}\"'.format(x) for x in huggingface_links])\n",
|
| 772 |
+
" # !aria2c --summary-interval=10 --header={user_header} -c -x 16 -k 1M -s 16 -d {destination_dir} -Z {links_string}\n",
|
| 773 |
+
" # for link in huggingface_links:\n",
|
| 774 |
+
" # !aria2c --summary-interval=10 --header={user_header} -c -x 16 -k 1M -s 16 -d {destination_dir} -o {link.split('/')[-1]} {link}\n",
|
| 775 |
+
" links_string = '\\n'.join(['{}\\n\\tout={}'.format(x,unquote(x.split('/')[-1])) for x in huggingface_links])\n",
|
| 776 |
+
" !echo -e \"{links_string}\" | aria2c --header={user_header} --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d {destination_dir}\n",
|
| 777 |
+
"\n",
|
| 778 |
+
"if verbose_download:\n",
|
| 779 |
+
" download(model_url)\n",
|
| 780 |
+
"else:\n",
|
| 781 |
+
" with capture.capture_output() as cap:\n",
|
| 782 |
+
" download(model_url)\n",
|
| 783 |
+
" del cap\n",
|
| 784 |
+
"\n",
|
| 785 |
+
"print('\\r🏁 Download finished.', flush=True)\n",
|
| 786 |
+
"\n",
|
| 787 |
+
"if len(extension_repo) > 0:\n",
|
| 788 |
+
" print('✨ Installing custom extensions...', end='')\n",
|
| 789 |
+
" with capture.capture_output() as cap:\n",
|
| 790 |
+
" for repo in extension_repo:\n",
|
| 791 |
+
" repo_name = repo.split('/')[-1]\n",
|
| 792 |
+
" !cd {extensions_dir} \\\n",
|
| 793 |
+
" && git clone \"{repo}\" \\\n",
|
| 794 |
+
" && cd {repo_name} \\\n",
|
| 795 |
+
" && git fetch\n",
|
| 796 |
+
" print('\\r🏁 Installed',len(extension_repo),'custom extensions.', flush=True)\n",
|
| 797 |
+
"\n",
|
| 798 |
+
"print('\\n')\n",
|
| 799 |
+
"# Link all files by filtering accoridng to their type\n",
|
| 800 |
+
"with capture.capture_output() as cap:\n",
|
| 801 |
+
" # files = os.listdir(destination_dir)\n",
|
| 802 |
+
" files = [os.path.join(dp,f) for dp, dn, fn in os.walk(destination_dir) for f in fn] # Thanks Aojiru!\n",
|
| 803 |
+
" for file in files:\n",
|
| 804 |
+
" name, file_extension = os.path.splitext(file)\n",
|
| 805 |
+
" if '.aria2' in file:\n",
|
| 806 |
+
" continue\n",
|
| 807 |
+
" file_path = os.path.join(destination_dir, file)\n",
|
| 808 |
+
" file_size = os.path.getsize(file_path)\n",
|
| 809 |
+
" if \"sam_\" in name and file_extension == \".pth\":\n",
|
| 810 |
+
" !ln \"{file_path}\" {sam_dir}\n",
|
| 811 |
+
" elif \"control_\" in name or \"t2iadapter_\" in name or file_extension == \".pth\":\n",
|
| 812 |
+
" !ln \"{file_path}\" {control_dir}\n",
|
| 813 |
+
" elif file_extension in ['.yaml', '.yml'] or file_size > 1_500_000_000:\n",
|
| 814 |
+
" !ln \"{file_path}\" {models_dir}\n",
|
| 815 |
+
" elif \"kl-f8\" in name or \"vae_\" in file or \"vae.\" in file or \"vae-\" in file or file_size > 380_000_000:\n",
|
| 816 |
+
" !ln \"{file_path}\" {vaes_dir}\n",
|
| 817 |
+
" elif getoutput('if rg -q -o \"lora_unet\" \"'+file_path+'\"; then echo 1; else echo 0; fi') == \"1\":\n",
|
| 818 |
+
" !ln \"{file_path}\" {loras_dir}\n",
|
| 819 |
+
" elif (file_extension == '.pt' or file_extension == '.safetensors') and file_size < 10_000_000:\n",
|
| 820 |
+
" !ln \"{file_path}\" {embeddings_dir}\n",
|
| 821 |
+
" else:\n",
|
| 822 |
+
" !ln \"{file_path}\" {hypernetworks_dir}\n",
|
| 823 |
+
" del cap\n",
|
| 824 |
+
"\n",
|
| 825 |
+
"# Automatically loads vae for first run, if it exists.\n",
|
| 826 |
+
"if auto_vae:\n",
|
| 827 |
+
" if '.vae.pt' in os.listdir(vaes_dir) or '/vae' in model_url:\n",
|
| 828 |
+
" commandline_arguments+=' --vae-path $(readlink -f $(find '+vaes_dir+' \\( -name \"*.vae.pt\" -or -name \"*.ckpt\" \\) -print -quit))'\n",
|
| 829 |
+
"\n",
|
| 830 |
+
"# Configure Alternatives Tunnels (Colab native, localtunnel, cloudflared, bore with auth)\n",
|
| 831 |
+
"if alternative_tunnels:\n",
|
| 832 |
+
" commandline_arguments = commandline_arguments.replace(\"--share\",\"\")\n",
|
| 833 |
+
" commandline_arguments += \" --multiple\"\n",
|
| 834 |
+
" print(\"⌚ \\033[95m\\033[1mGenerating alternative tunnels...\", end='')\n",
|
| 835 |
+
" with capture.capture_output() as cap:\n",
|
| 836 |
+
" %cd /content\n",
|
| 837 |
+
" if not os.path.exists('/tools/node/bin/lt'):\n",
|
| 838 |
+
" !npm install -g localtunnel\n",
|
| 839 |
+
" if not os.path.exists('/usr/bin/cloudflared'):\n",
|
| 840 |
+
" !curl -Lo /usr/bin/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cloudflared\n",
|
| 841 |
+
" del cap\n",
|
| 842 |
+
" !true > /content/nohup.out\n",
|
| 843 |
+
" !nohup lt --port 7860 > /content/nohup.out 2>&1 &\n",
|
| 844 |
+
" !nohup cloudflared tunnel --url localhost:7860 > /content/nohup.out 2>&1 &\n",
|
| 845 |
+
" if with_bore:\n",
|
| 846 |
+
" if not os.path.exists('/usr/bin/bore'):\n",
|
| 847 |
+
" !curl -Ls https://github.com/ekzhang/bore/releases/download/v0.4.0/bore-v0.4.0-x86_64-unknown-linux-musl.tar.gz | tar zx -C /usr/bin\n",
|
| 848 |
+
" !nohup bore local 7860 --to bore.pub > /content/nohup.out 2>&1 &\n",
|
| 849 |
+
" if not \"--gradio-auth\" in commandline_arguments:\n",
|
| 850 |
+
" import random\n",
|
| 851 |
+
" import string\n",
|
| 852 |
+
" gradio_password = ''.join(random.choice(string.ascii_lowercase) for i in range(5))\n",
|
| 853 |
+
" commandline_arguments+=\" --gradio-auth {}:{}\".format(\"ncpt\", gradio_password)\n",
|
| 854 |
+
" else:\n",
|
| 855 |
+
" gradio_password = False\n",
|
| 856 |
+
" !sleep 4\n",
|
| 857 |
+
" print(\"\\r💡 \\033[95m\\033[1mUse one of these alternative tunnels after the loading is finished: \", flush=True)\n",
|
| 858 |
+
" from google.colab.output import serve_kernel_port_as_window\n",
|
| 859 |
+
" # serve_kernel_port_as_window(7860, anchor_text=\"https://th15f4k3l1nkofcn0tr34ll0l-7860-colab.googleusercontent.com/\")\n",
|
| 860 |
+
" !cat /content/nohup.out | rg -a -o \"https[^ ]*.*\\.trycloudflare\\.com|https[^ ]*.*\\.loca\\.lt|bore.pub:[^ ]*\" | sed 's@bore.pub@http://bore.pub@'\n",
|
| 861 |
+
" print(\"\\n\")\n",
|
| 862 |
+
" if with_bore:\n",
|
| 863 |
+
" if gradio_password:\n",
|
| 864 |
+
" print(\"\\r🔐 \\033[0m\\033[1mLooks like you're using bore without --gradio-auth huh... \")\n",
|
| 865 |
+
" print(\"For security, I've enforced to use gradio auth, so use this account to login:\")\n",
|
| 866 |
+
" print(\"👉⚠️ Username: ncpt\")\n",
|
| 867 |
+
" print(\"👉⚠️ Password:\", gradio_password,\"\\n\\n\")\n",
|
| 868 |
+
"\n",
|
| 869 |
+
"# If no xformers installed, remove --xformers from arg to avoid using old builtin xformers\n",
|
| 870 |
+
"# if not os.path.exists(\"/usr/local/lib/python3.10/dist-packages/xformers\"):\n",
|
| 871 |
+
"# commandline_arguments = commandline_arguments.replace(\"--xformers\",\"\")\n",
|
| 872 |
+
"\n",
|
| 873 |
+
"# Krita extension support (adding --api automatically) + toggleable.\n",
|
| 874 |
+
"with capture.capture_output() as cap:\n",
|
| 875 |
+
" if krita_paint_ext:\n",
|
| 876 |
+
" # Add api if no api (if lazy y'know)\n",
|
| 877 |
+
" if not \"--api\" in commandline_arguments:\n",
|
| 878 |
+
" commandline_arguments+=\" --api\"\n",
|
| 879 |
+
" %cd /content/sdw\n",
|
| 880 |
+
" if os.path.exists('/content/sdw/extensions/auto-sd-paint-ext'):\n",
|
| 881 |
+
" !cd ./extensions/auto-sd-paint-ext && git fetch && git merge # Deflecting FETCH_HEAD not found bug\n",
|
| 882 |
+
" else:\n",
|
| 883 |
+
" !git clone https://github.com/ashen-sensored/auto-sd-paint-ext extensions/auto-sd-paint-ext\n",
|
| 884 |
+
" else:\n",
|
| 885 |
+
" if os.path.exists('/content/sdw/extensions/auto-sd-paint-ext'):\n",
|
| 886 |
+
" !rm -rf /content/sdw/extensions/auto-sd-paint-ext\n",
|
| 887 |
+
" # Remove junks\n",
|
| 888 |
+
" !find /content/sdw/ -name \".ipynb_checkpoints\" -type d -exec rm -r {} \\;\n",
|
| 889 |
+
"\n",
|
| 890 |
+
"\n",
|
| 891 |
+
"# Print all files in every important directory\n",
|
| 892 |
+
"print(\"\\033[96mCan't see your files in here? Activate verbose_download to debug!\\n\")\n",
|
| 893 |
+
"print(\"\\033[92m\\033[1m╭-📦 Models + Configs\\033[96m\")\n",
|
| 894 |
+
"!find {models_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'\n",
|
| 895 |
+
"print(\"\\n\\033[92m\\033[1m╭-📦 VAEs\\033[96m\")\n",
|
| 896 |
+
"!find {vaes_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'\n",
|
| 897 |
+
"print(\"\\n\\033[92m\\033[1m╭-📦 Custom Embeddings (inbuilt is hidden)\\033[96m\")\n",
|
| 898 |
+
"!find {embeddings_dir}/ -mindepth 1 -maxdepth 1 -name '*.pt' -or -name '*.safetensors' -printf '%f\\n'\n",
|
| 899 |
+
"print(\"\\n\\033[92m\\033[1m╭-📦 LoRAs\\033[96m\")\n",
|
| 900 |
+
"!find {loras_dir}/ -mindepth 1 ! -name '*.keep' -printf '%f\\n'\n",
|
| 901 |
+
"# print(\"\\n\\033[92m\\033[1m╭-📦 LyCORIS\\033[96m\")\n",
|
| 902 |
+
"# !find {lycoris_dir}/ -mindepth 1 ! -name '*.keep' -printf '%f\\n'\n",
|
| 903 |
+
"print(\"\\n\\033[92m\\033[1m╭-📦 Hypernetworks\\033[96m\")\n",
|
| 904 |
+
"!find {hypernetworks_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'\n",
|
| 905 |
+
"print(\"\\n\\033[92m\\033[1m╭-📦 Extensions\\033[96m\")\n",
|
| 906 |
+
"!find {extensions_dir}/ -mindepth 1 -maxdepth 1 ! -name '*.txt' -printf '%f\\n'\n",
|
| 907 |
+
"print(\"\\n\\n\\033[0m\")\n",
|
| 908 |
+
"\n",
|
| 909 |
+
"# HF OUT support!\n",
|
| 910 |
+
"if optional_huggingface_token:\n",
|
| 911 |
+
" commandline_arguments+=\" --hf-token-out \"+optional_huggingface_token\n",
|
| 912 |
+
"\n",
|
| 913 |
+
"# Start the weebui\n",
|
| 914 |
+
"%cd /content/sdw\n",
|
| 915 |
+
"\n",
|
| 916 |
+
"if null_model:\n",
|
| 917 |
+
" print(\"\\033[91m ⚠️ Null model will be loaded, if you don't understand please uncheck the model \\033[0m\")\n",
|
| 918 |
+
" !wget https://huggingface.co/ckpt/null/resolve/main/nullModelzeros.ckpt -P {models_dir} -c\n",
|
| 919 |
+
" commandline_arguments+=\" --ckpt \"+models_dir+\"/nullModelzeros.ckpt \"\n",
|
| 920 |
+
"\n",
|
| 921 |
+
"if fast_start:\n",
|
| 922 |
+
" # commandline_arguments += \" --skip-install\"\n",
|
| 923 |
+
" print(\"\\033[91m ⚠️ Fast start is active, please disable it if you have any problem! \\033[0m\")\n",
|
| 924 |
+
" !python webui.py $commandline_arguments\n",
|
| 925 |
+
"else:\n",
|
| 926 |
+
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" REQS_FILE=\"requirements_versions.txt\" python launch.py\n",
|
| 927 |
+
"time_since_start = timedelta(seconds=time.time()-start_colab)\n",
|
| 928 |
+
"print(\"\\n\\n\\033[96m⌚ You've been running this colab for\",\"%02d:%02d:%02d\" % (time_since_start.seconds / 3600, (time_since_start.seconds / 60) % 60, time_since_start.seconds % 60))\n",
|
| 929 |
+
"print(\"\\n\\n\")"
|
| 930 |
+
]
|
| 931 |
+
},
|
| 932 |
+
{
|
| 933 |
+
"cell_type": "markdown",
|
| 934 |
+
"source": [
|
| 935 |
+
"---\n",
|
| 936 |
+
"# **Useful Utilities (Optional)**\n",
|
| 937 |
+
"\n",
|
| 938 |
+
"*Stuff that might be useful*"
|
| 939 |
+
],
|
| 940 |
+
"metadata": {
|
| 941 |
+
"id": "iLsO_riJrAEl"
|
| 942 |
+
}
|
| 943 |
+
},
|
| 944 |
+
{
|
| 945 |
+
"cell_type": "code",
|
| 946 |
+
"source": [
|
| 947 |
+
"#@markdown ## Colab Mobile Keep Alive\n",
|
| 948 |
+
"#@markdown Run this cell to keep the tab alive in mobile (before running the start cell)\n",
|
| 949 |
+
"\n",
|
| 950 |
+
"%%html\n",
|
| 951 |
+
"<b>Press play on the music player to keep the tab alive before running the start cell (Uses only 13MB of data)</b><br/>\n",
|
| 952 |
+
"<audio src=\"https://raw.githubusercontent.com/KoboldAI/KoboldAI-Client/main/colab/silence.m4a\" controls>"
|
| 953 |
+
],
|
| 954 |
+
"metadata": {
|
| 955 |
+
"id": "ZIL7itnNaw5V",
|
| 956 |
+
"cellView": "form"
|
| 957 |
+
},
|
| 958 |
+
"execution_count": null,
|
| 959 |
+
"outputs": []
|
| 960 |
+
},
|
| 961 |
+
{
|
| 962 |
+
"cell_type": "code",
|
| 963 |
+
"source": [
|
| 964 |
+
"#@markdown ## Mass download outputs\n",
|
| 965 |
+
"#@markdown Zip all image outputs and downloads them\n",
|
| 966 |
+
"from google.colab import files\n",
|
| 967 |
+
"import os\n",
|
| 968 |
+
"%cd /content\n",
|
| 969 |
+
"if output_to_drive:\n",
|
| 970 |
+
" print(\"Your images already in google drive btw, this cell is basically useless but what ever\")\n",
|
| 971 |
+
"\n",
|
| 972 |
+
"if os.path.exists(\"/content/outputs.zip\"):\n",
|
| 973 |
+
" !rm -f /content/outputs.zip\n",
|
| 974 |
+
"!cd /content/sdw/outputs && zip -r /content/outputs.zip .\n",
|
| 975 |
+
"files.download('/content/outputs.zip')"
|
| 976 |
+
],
|
| 977 |
+
"metadata": {
|
| 978 |
+
"cellView": "form",
|
| 979 |
+
"id": "vcca4v99sBd6"
|
| 980 |
+
},
|
| 981 |
+
"execution_count": null,
|
| 982 |
+
"outputs": []
|
| 983 |
+
},
|
| 984 |
+
{
|
| 985 |
+
"cell_type": "markdown",
|
| 986 |
+
"source": [
|
| 987 |
+
"## XTerm Terminal\n",
|
| 988 |
+
"*Spins up a terminal*"
|
| 989 |
+
],
|
| 990 |
+
"metadata": {
|
| 991 |
+
"id": "QAvV1XNM3TxR"
|
| 992 |
+
}
|
| 993 |
+
},
|
| 994 |
+
{
|
| 995 |
+
"cell_type": "code",
|
| 996 |
+
"source": [
|
| 997 |
+
"#@title Install XTerm\n",
|
| 998 |
+
"!pip install colab-xterm\n",
|
| 999 |
+
"%load_ext colabxterm"
|
| 1000 |
+
],
|
| 1001 |
+
"metadata": {
|
| 1002 |
+
"id": "xaIJuwU1f3k7",
|
| 1003 |
+
"cellView": "form"
|
| 1004 |
+
},
|
| 1005 |
+
"execution_count": null,
|
| 1006 |
+
"outputs": []
|
| 1007 |
+
},
|
| 1008 |
+
{
|
| 1009 |
+
"cell_type": "code",
|
| 1010 |
+
"source": [
|
| 1011 |
+
"#@title Run XTerm (Terminal)\n",
|
| 1012 |
+
"%xterm"
|
| 1013 |
+
],
|
| 1014 |
+
"metadata": {
|
| 1015 |
+
"id": "Umxr9M53f45V",
|
| 1016 |
+
"cellView": "form"
|
| 1017 |
+
},
|
| 1018 |
+
"execution_count": null,
|
| 1019 |
+
"outputs": []
|
| 1020 |
+
},
|
| 1021 |
+
{
|
| 1022 |
+
"cell_type": "markdown",
|
| 1023 |
+
"source": [
|
| 1024 |
+
"## Upload stuff\n",
|
| 1025 |
+
"*Quickly upload stuff like merged models to huggingface*\n",
|
| 1026 |
+
"\n",
|
| 1027 |
+
"Run cell `1,2,3`\n",
|
| 1028 |
+
"\n",
|
| 1029 |
+
"You only need to choose one between `3.1,3.2,and 3.3`\n",
|
| 1030 |
+
"\n",
|
| 1031 |
+
"<small>Forked from LYNN\n"
|
| 1032 |
+
],
|
| 1033 |
+
"metadata": {
|
| 1034 |
+
"id": "EzbWAsEc2bAt"
|
| 1035 |
+
}
|
| 1036 |
+
},
|
| 1037 |
+
{
|
| 1038 |
+
"cell_type": "code",
|
| 1039 |
+
"source": [
|
| 1040 |
+
"#@title 1. Login to Huggingface hub\n",
|
| 1041 |
+
"try:\n",
|
| 1042 |
+
" hub_ok # My packaged dep didn't contains this (but stil have the folder)\n",
|
| 1043 |
+
"except:\n",
|
| 1044 |
+
" print(\"Setting up huggingface_hub...\")\n",
|
| 1045 |
+
" !pip install --force-reinstall -qqqq huggingface_hub\n",
|
| 1046 |
+
" hub_ok = True\n",
|
| 1047 |
+
"from IPython.display import clear_output\n",
|
| 1048 |
+
"from huggingface_hub import login\n",
|
| 1049 |
+
"clear_output()\n",
|
| 1050 |
+
"\n",
|
| 1051 |
+
"#@markdown 1. Of course, you need a Huggingface account first.\n",
|
| 1052 |
+
"#@markdown 2. To create a huggingface token, go to [this link](https://huggingface.co/settings/tokens), then `create new token` or copy available token with the `Write` role.\n",
|
| 1053 |
+
"\n",
|
| 1054 |
+
"write_token = \"\" #@param {type:\"string\"}\n",
|
| 1055 |
+
"login(write_token, add_to_git_credential=True)"
|
| 1056 |
+
],
|
| 1057 |
+
"metadata": {
|
| 1058 |
+
"cellView": "form",
|
| 1059 |
+
"id": "HLPOBeoG2hIm"
|
| 1060 |
+
},
|
| 1061 |
+
"execution_count": null,
|
| 1062 |
+
"outputs": []
|
| 1063 |
+
},
|
| 1064 |
+
{
|
| 1065 |
+
"cell_type": "code",
|
| 1066 |
+
"source": [
|
| 1067 |
+
"#@title 2. Setup Repo\n",
|
| 1068 |
+
"from huggingface_hub.utils import validate_repo_id, HfHubHTTPError\n",
|
| 1069 |
+
"from huggingface_hub import HfApi\n",
|
| 1070 |
+
"\n",
|
| 1071 |
+
"\n",
|
| 1072 |
+
"api = HfApi()\n",
|
| 1073 |
+
"user = api.whoami(write_token)\n",
|
| 1074 |
+
"\n",
|
| 1075 |
+
"#@markdown #### If your model repo didn't exist, it will automatically create your repo.\n",
|
| 1076 |
+
"repo_name = \"my_merged_models\" #@param{type:\"string\"}\n",
|
| 1077 |
+
"make_this_repo_private_if_not_exist = False #@param{type:\"boolean\"}\n",
|
| 1078 |
+
"clone_with_git = True #@param{type:\"boolean\"}\n",
|
| 1079 |
+
"\n",
|
| 1080 |
+
"model_repo = user['name']+\"/\"+repo_name.strip()\n",
|
| 1081 |
+
"\n",
|
| 1082 |
+
"validate_repo_id(model_repo)\n",
|
| 1083 |
+
"\n",
|
| 1084 |
+
"if repo_name != \"\":\n",
|
| 1085 |
+
" try:\n",
|
| 1086 |
+
" api.create_repo(repo_id=model_repo,\n",
|
| 1087 |
+
" private=make_this_repo_private_if_not_exist)\n",
|
| 1088 |
+
" print(\"Model Repo didn't exists, creating repo\")\n",
|
| 1089 |
+
" print(\"Model Repo: \",model_repo,\"created!\\n\")\n",
|
| 1090 |
+
"\n",
|
| 1091 |
+
" except HfHubHTTPError as e:\n",
|
| 1092 |
+
" print(f\"Model Repo: {model_repo} exists, skipping create repo\\n\")\n",
|
| 1093 |
+
"\n",
|
| 1094 |
+
"if clone_with_git:\n",
|
| 1095 |
+
" !git lfs install --skip-smudge\n",
|
| 1096 |
+
" !export GIT_LFS_SKIP_SMUDGE=1\n",
|
| 1097 |
+
" !git clone https://huggingface.co/{model_repo} /content/{repo_name}"
|
| 1098 |
+
],
|
| 1099 |
+
"metadata": {
|
| 1100 |
+
"cellView": "form",
|
| 1101 |
+
"id": "3ecSNSOY3rKO"
|
| 1102 |
+
},
|
| 1103 |
+
"execution_count": null,
|
| 1104 |
+
"outputs": []
|
| 1105 |
+
},
|
| 1106 |
+
{
|
| 1107 |
+
"cell_type": "code",
|
| 1108 |
+
"execution_count": null,
|
| 1109 |
+
"metadata": {
|
| 1110 |
+
"cellView": "form",
|
| 1111 |
+
"id": "xSLziGY-sa89"
|
| 1112 |
+
},
|
| 1113 |
+
"outputs": [],
|
| 1114 |
+
"source": [
|
| 1115 |
+
"\n",
|
| 1116 |
+
"import os\n",
|
| 1117 |
+
"import sys\n",
|
| 1118 |
+
"import ipywidgets as widgets\n",
|
| 1119 |
+
"from IPython.display import clear_output\n",
|
| 1120 |
+
"from huggingface_hub import HfApi, login\n",
|
| 1121 |
+
"from huggingface_hub.utils import validate_repo_id, HfHubHTTPError\n",
|
| 1122 |
+
"from IPython.utils import capture\n",
|
| 1123 |
+
"\n",
|
| 1124 |
+
"\n",
|
| 1125 |
+
"paths_map = {\n",
|
| 1126 |
+
" \"Models\" : \"/content/sdw/models/Stable-diffusion\",\n",
|
| 1127 |
+
" \"VAEs\" : \"/content/sdw/models/VAE\",\n",
|
| 1128 |
+
" \"LORAs\" : \"/content/sdw/models/Lora\",\n",
|
| 1129 |
+
" \"Embeddings\" : \"/content/sdw/embeddings\",\n",
|
| 1130 |
+
" \"Hypernetworks\" : \"/content/sdw/models/hypernetworks\",\n",
|
| 1131 |
+
"}\n",
|
| 1132 |
+
"\n",
|
| 1133 |
+
"#@title 3.1 Upload via huggingface_hub (Fun way)\n",
|
| 1134 |
+
"#@markdown ## **How to use this?**<br>\n",
|
| 1135 |
+
"#@markdown 1. Run this cell after you ran the login cell\n",
|
| 1136 |
+
"#@markdown 2. Select model you want to upload (use `ctrl/shift` for multiple selection)\n",
|
| 1137 |
+
"#@markdown 3. Click on upload button\n",
|
| 1138 |
+
"folder = \"Models\" #@param [\"Models\", \"VAEs\", \"LORAs\", \"Embeddings\", \"Hypernetworks\"]\n",
|
| 1139 |
+
"commit_message = \"Upload with 🚀🤗 NoCrypt's nocrypt_colab_remastered\" #@param{type:\"string\"}\n",
|
| 1140 |
+
"\n",
|
| 1141 |
+
"models_path = paths_map[folder]\n",
|
| 1142 |
+
"upload_path = '/content/upload_models'\n",
|
| 1143 |
+
"\n",
|
| 1144 |
+
"api = HfApi()\n",
|
| 1145 |
+
"username_repo = user['name']+\"/\"+repo_name.strip()\n",
|
| 1146 |
+
"validate_repo_id(username_repo)\n",
|
| 1147 |
+
"\n",
|
| 1148 |
+
"def get_file_list(path):\n",
|
| 1149 |
+
" res = []\n",
|
| 1150 |
+
" for (dir_path, dir_names, file_names) in os.walk(path):\n",
|
| 1151 |
+
" res.extend(file_names)\n",
|
| 1152 |
+
" return res\n",
|
| 1153 |
+
"\n",
|
| 1154 |
+
"selected = widgets.SelectMultiple(\n",
|
| 1155 |
+
" options=get_file_list(models_path),\n",
|
| 1156 |
+
" rows=10,\n",
|
| 1157 |
+
" disabled=False,\n",
|
| 1158 |
+
")\n",
|
| 1159 |
+
"\n",
|
| 1160 |
+
"button = widgets.Button(\n",
|
| 1161 |
+
" description='Upload',\n",
|
| 1162 |
+
" disabled=False,\n",
|
| 1163 |
+
" button_style='success',\n",
|
| 1164 |
+
" tooltip='Upload to huggingface',\n",
|
| 1165 |
+
")\n",
|
| 1166 |
+
"dropdown = widgets.Dropdown(\n",
|
| 1167 |
+
" options=paths_map.keys(),\n",
|
| 1168 |
+
" value=folder,\n",
|
| 1169 |
+
" description='Folder',\n",
|
| 1170 |
+
")\n",
|
| 1171 |
+
"\n",
|
| 1172 |
+
"out = widgets.Output()\n",
|
| 1173 |
+
"\n",
|
| 1174 |
+
"def on_folder_change(change):\n",
|
| 1175 |
+
" if change['type'] == 'change' and change['name'] == 'value':\n",
|
| 1176 |
+
" models_path = paths_map[change[\"new\"]]\n",
|
| 1177 |
+
" selected.options = get_file_list(models_path)\n",
|
| 1178 |
+
"\n",
|
| 1179 |
+
"def upload_it(b):\n",
|
| 1180 |
+
" with out:\n",
|
| 1181 |
+
" if selected.value is not None:\n",
|
| 1182 |
+
" clear_output()\n",
|
| 1183 |
+
" !mkdir -p {upload_path}\n",
|
| 1184 |
+
"\n",
|
| 1185 |
+
"\n",
|
| 1186 |
+
" #hard link each file\n",
|
| 1187 |
+
" for selected_model in selected.value:\n",
|
| 1188 |
+
" if not os.path.exists(os.path.join(upload_path,selected_model)):\n",
|
| 1189 |
+
" os.link(os.path.join(paths_map[dropdown.value],selected_model),os.path.join(upload_path,selected_model)) #hardlinking to save colab's space\n",
|
| 1190 |
+
"\n",
|
| 1191 |
+
" #delete .ipynb_checkpoint\n",
|
| 1192 |
+
" if os.path.exists(os.path.join(upload_path,\".ipynb_checkpoints\")):\n",
|
| 1193 |
+
" !rm {upload_path}/.ipynb_checkpoints\n",
|
| 1194 |
+
" print(\"Selected:\", \", \".join(selected.value))\n",
|
| 1195 |
+
" print(\"Uploading to https://huggingface.co/\"+username_repo)\n",
|
| 1196 |
+
" print(\"Please wait... Might look stuck, but it's not 👍\")\n",
|
| 1197 |
+
"\n",
|
| 1198 |
+
" # Comment this for file based upload\n",
|
| 1199 |
+
" api.upload_folder(\n",
|
| 1200 |
+
" folder_path=upload_path,\n",
|
| 1201 |
+
" repo_id=username_repo,\n",
|
| 1202 |
+
" commit_message=commit_message\n",
|
| 1203 |
+
" )\n",
|
| 1204 |
+
"\n",
|
| 1205 |
+
" # Uncomment for file based upload\n",
|
| 1206 |
+
" # for filename in os.listdir(upload_path):\n",
|
| 1207 |
+
" # f = os.path.join(upload_path, filename)\n",
|
| 1208 |
+
" # # checking if it is a file\n",
|
| 1209 |
+
" # if os.path.isfile(f):\n",
|
| 1210 |
+
" # api.upload_file(\n",
|
| 1211 |
+
" # path_or_fileobj=f,\n",
|
| 1212 |
+
" # path_in_repo=filename,\n",
|
| 1213 |
+
" # repo_id=username_repo,\n",
|
| 1214 |
+
" # commit_message=commit_message\n",
|
| 1215 |
+
" # )\n",
|
| 1216 |
+
"\n",
|
| 1217 |
+
" print(\"Done!\")\n",
|
| 1218 |
+
" #delete hardlink\n",
|
| 1219 |
+
" !rm -rf {upload_path}/*\n",
|
| 1220 |
+
" else:\n",
|
| 1221 |
+
" print(\"Nothing is selected\")\n",
|
| 1222 |
+
"\n",
|
| 1223 |
+
"dropdown.observe(on_folder_change)\n",
|
| 1224 |
+
"button.on_click(upload_it)\n",
|
| 1225 |
+
"print(\"Upload target: https://huggingface.co/\"+username_repo)\n",
|
| 1226 |
+
"print(\"👇 Select models you want to upload (use ctrl/shift for multiple selection) \")\n",
|
| 1227 |
+
"display(dropdown,selected,button,out)"
|
| 1228 |
+
]
|
| 1229 |
+
},
|
| 1230 |
+
{
|
| 1231 |
+
"cell_type": "code",
|
| 1232 |
+
"source": [
|
| 1233 |
+
"#@title 3.2 Upload via huggingface_hub (Manual way)\n",
|
| 1234 |
+
"\n",
|
| 1235 |
+
"#@markdown All paths for easier access:<br>\n",
|
| 1236 |
+
"#@markdown /content/sdw/models/Stable-diffusion<br>\n",
|
| 1237 |
+
"#@markdown /content/sdw/models/VAE<br>\n",
|
| 1238 |
+
"#@markdown /content/sdw/models/Lora<br>\n",
|
| 1239 |
+
"#@markdown /content/sdw/embeddings<br>\n",
|
| 1240 |
+
"#@markdown /content/sdw/models/hypernetwork<br>\n",
|
| 1241 |
+
"from huggingface_hub import HfApi\n",
|
| 1242 |
+
"from pathlib import Path\n",
|
| 1243 |
+
"\n",
|
| 1244 |
+
"api = HfApi()\n",
|
| 1245 |
+
"file_path = \"/content/models/Anything-V3-vae-swapped.safetensors\" #@param {type :\"string\"}\n",
|
| 1246 |
+
"commit_message = \"Upload with 🚀🤗 NoCrypt's nocrypt_colab_remastered\" #@param {type :\"string\"}\n",
|
| 1247 |
+
"\n",
|
| 1248 |
+
"if file_path != \"\":\n",
|
| 1249 |
+
" path_obj = Path(file_path)\n",
|
| 1250 |
+
" trained_model = path_obj.parts[-1]\n",
|
| 1251 |
+
"\n",
|
| 1252 |
+
" print(f\"Uploading {trained_model} to https://huggingface.co/\"+model_repo)\n",
|
| 1253 |
+
" print(f\"Please wait...\")\n",
|
| 1254 |
+
"\n",
|
| 1255 |
+
" api.upload_file(\n",
|
| 1256 |
+
" path_or_fileobj=file_path,\n",
|
| 1257 |
+
" path_in_repo=trained_model,\n",
|
| 1258 |
+
" repo_id=model_repo,\n",
|
| 1259 |
+
" commit_message=commit_message,\n",
|
| 1260 |
+
" )\n",
|
| 1261 |
+
"\n",
|
| 1262 |
+
" print(f\"Upload success, located at https://huggingface.co/\"+model_repo+\"/blob/main/\"+trained_model+\"\\n\")"
|
| 1263 |
+
],
|
| 1264 |
+
"metadata": {
|
| 1265 |
+
"cellView": "form",
|
| 1266 |
+
"id": "7Juh7N1c3ooM"
|
| 1267 |
+
},
|
| 1268 |
+
"execution_count": null,
|
| 1269 |
+
"outputs": []
|
| 1270 |
+
},
|
| 1271 |
+
{
|
| 1272 |
+
"cell_type": "code",
|
| 1273 |
+
"source": [
|
| 1274 |
+
"#@title 3.3 Upload via GIT (more stable)\n",
|
| 1275 |
+
"%cd /content/\n",
|
| 1276 |
+
"file_path = \"/content/models/Anything-V3-vae-swapped.safetensors\" #@param {type :\"string\"}\n",
|
| 1277 |
+
"!ln {file_path} /content/{repo_name}/\n",
|
| 1278 |
+
"#@markdown Set **git commit identity**\n",
|
| 1279 |
+
"email = \"your-email\" #@param {'type': 'string'}\n",
|
| 1280 |
+
"name = \"your-username\" #@param {'type': 'string'}\n",
|
| 1281 |
+
"#@markdown Set **commit message**\n",
|
| 1282 |
+
"commit_m = \"Upload with 🚀🤗 NoCrypt's nocrypt_colab_remastered\" #@param {'type': 'string'}\n",
|
| 1283 |
+
"\n",
|
| 1284 |
+
"%cd /content/{repo_name}\n",
|
| 1285 |
+
"\n",
|
| 1286 |
+
"!git lfs install --skip-smudge\n",
|
| 1287 |
+
"!export GIT_LFS_SKIP_SMUDGE=1\n",
|
| 1288 |
+
"!git pull -X theirs\n",
|
| 1289 |
+
"\n",
|
| 1290 |
+
"!git lfs install\n",
|
| 1291 |
+
"!huggingface-cli lfs-enable-largefiles .\n",
|
| 1292 |
+
"!git config --global user.email \"{email}\"\n",
|
| 1293 |
+
"!git config --global user.name \"{name}\"\n",
|
| 1294 |
+
"!git add .\n",
|
| 1295 |
+
"!git commit -m \"{commit_m}\"\n",
|
| 1296 |
+
"!git push"
|
| 1297 |
+
],
|
| 1298 |
+
"metadata": {
|
| 1299 |
+
"cellView": "form",
|
| 1300 |
+
"id": "C4sGvmEf1gIv"
|
| 1301 |
+
},
|
| 1302 |
+
"execution_count": null,
|
| 1303 |
+
"outputs": []
|
| 1304 |
+
}
|
| 1305 |
+
]
|
| 1306 |
+
}
|