File size: 38,841 Bytes
b879375 |
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 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 |
#@title - Instant (Simple) import requests import os import subprocess cek = subprocess.getoutput('nvidia-smi') from google.colab.output import eval_js os.environ['colab_url'] = eval_js("google.colab.kernel.proxyPort(7860, {'cache': false})") if not 'T4' in cek: print("[1;32m-----Your colab session is over. Use other google account or wait 12-24 hours-----") print("-----Sesi colab elu udah habis bro. Saran gw tunggu 12-24 jam atau bikin/pake akun google lain-----") raise KeyboardInterrupt #thanks to https://github.com/camenduru for the fork print('[1;32mInstalling dependencies...') print('[1;32m(This process will only happen once per session)') print('[0m') %cd /content #!if ! [ -f xformers ]; then pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16+814314d.d20230118-cp38-cp38-linux_x86_64.whl; pip install -q --pre triton; touch xformers; fi if not os.path.isfile('dependencies'): !gdown http://launchpadlibrarian.net/367274644/libgoogle-perftools-dev_2.5-2.2ubuntu3_amd64.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/google-perftools_2.5-2.2ubuntu3_all.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/libtcmalloc-minimal4_2.5-2.2ubuntu3_amd64.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/libgoogle-perftools4_2.5-2.2ubuntu3_amd64.deb !apt install -qq libunwind8-dev !dpkg -i *.deb %env LD_PRELOAD=libtcmalloc.so !rm *.deb # print("Grabbing pre-built xformers from camenduru's repo") # url = 'https://api.github.com/repos/camenduru/stable-diffusion-webui-colab/releases/latest' # response = requests.get(url) # print("Status code: " + str(response.status_code)) # if response.status_code == 200: # data = response.json() # templink = [link for link in [asset['browser_download_url'] for asset in data['assets'] if 'cp39' in asset['name']]] # xformerlink = templink[0] # else: # print("Request failed, loading last updated xformers instead") # xformerlink = 'https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.17/xformers-0.0.17+b6be33a.d20230315-cp39-cp39-linux_x86_64.whl' # !pip install -q --pre xformers !pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 torchtext==0.14.1 torchdata==0.5.1 --extra-index-url https://download.pytorch.org/whl/cu116 -U !pip install -q xformers==0.0.16 triton==2.0.0 -U # !pip install -q --pre xformers==0.0.17.dev476 -U # !pip install -q --pre triton !touch dependencies print('[1;32mInstalling webui...') print('[0m') !if ! [ -d stable-diffusion-webui ]; then git clone -b v2.1 https://github.com/camenduru/stable-diffusion-webui; touch forkedwebui; fi %cd stable-diffusion-webui #AnythingV3 Model & Vae print('[1;32mDownloading AnythingV3 model...') print('[0m') %cd /content/stable-diffusion-webui/models/Stable-diffusion/ !if ! [ -f Anything-V3.0.safetensors ]; then gdown https://huggingface.co./Linaqruf/anything-v3.0/resolve/main/anything-v3-fp32-pruned.safetensors -O /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.safetensors; fi !if ! [ -f Anything-V3.0.vae.pt ]; then gdown https://huggingface.co./WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -O /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt; fi #webui setup for nai print('[1;32mSetting UI configs...') print('[0m') %cd /content/stable-diffusion-webui !if [ -f configinstan ]; then rm configinstan; fi !if ! [ -f configinstanlite ]; then gdown https://pastebin.com/raw/fmN0i5Sd -O /content/stable-diffusion-webui/ui-config.json && gdown https://pastebin.com/raw/amVtB1NW -O /content/stable-diffusion-webui/config.json; fi !if ! [ -f configinstanlite ]; then mv /content/stable-diffusion-webui/modules/ui.py /content/stable-diffusion-webui/modules/ui_backup.py && gdown https://pastebin.com/raw/pKFWUfLM -O /content/stable-diffusion-webui/modules/ui.py; fi !touch configinstanlite #notification bell !gdown https://github.com/etherealxx/etherportal-webui-colab/raw/master/notification.mp3 -O /content/stable-diffusion-webui/notification.mp3 #foolhardy remacri ! [ ! -d models/ESRGAN ] && mkdir -p models/ESRGAN; [ ! -f models/ESRGAN/4x_foolhardy_Remacri.pth ] && gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/4x_foolhardy_Remacri.pth -O /content/stable-diffusion-webui/models/ESRGAN/4x_foolhardy_Remacri.pth #extensions print('[1;32mInstalling extensions...') print('[0m') %cd /content/stable-diffusion-webui/extensions !bash -c 'for repo in camenduru/stable-diffusion-webui-images-browser Extraltodeus/depthmap2mask ddPn08/kohya-sd-scripts-webui arenatemp/stable-diffusion-webui-model-toolkit; do if [ ! -d "repo" && true; fi; done' #DominikDoom/a1111-sd-webui-tagcomplete !bash -c 'for repo in sd-civitai-browser kohya-sd-scripts-webui stable-diffusion-webui-model-toolkit batchlinks-webui; do if [ -d " repo && true; fi; done' #%cd /content/stable-diffusion-webui/extensions/UnivAICharGen #!git checkout c56b5146049b91cfcd645c62bd356bd0631c4131 . !git clone -b pre-embedding --single-branch https://github.com/etherealxx/Umi-AI #badprompt & badartist %cd /content/stable-diffusion-webui/embeddings/ !if ! [ -f bad_prompt.pt ]; then gdown https://huggingface.co./datasets/Nerfgun3/bad_prompt/resolve/main/bad_prompt_version2.pt -O /content/stable-diffusion-webui/embeddings/bad_prompt.pt; fi !if ! [ -f bad_artist.pt ]; then gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/bad_artist.pt -O /content/stable-diffusion-webui/embeddings/bad_artist.pt; fi !if ! [ -f bad_hands.pt ]; then gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/bad-hands-5.pt -O /content/stable-diffusion-webui/embeddings/bad_hands.pt; fi #some fix !sed -i -e '''/ prepare_environment()/a\ os.system\(f\"""sed -i -e ''\"s/dict()))/dict())).cuda()/g\"'' /content/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py""")''' /content/stable-diffusion-webui/launch.py !sed -i -e 's/fastapi==0.90.1/fastapi==0.89.1/g' /content/stable-diffusion-webui/requirements_versions.txt print('[1;32mInstallation Success!') print('[1;32mLaunching the webui...') print('[0m') %cd /content/stable-diffusion-webui !python launch.py --ckpt /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.safetensors --vae-path /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt --share --xformers --enable-insecure-extension-access --gradio-queue #@title - Instant (Advanced) import requests import os import subprocess cek = subprocess.getoutput('nvidia-smi') if not 'T4' in cek: print("[1;32m-----Your colab session is over. Use other google account or wait 12-24 hours-----") print("-----Sesi colab elu udah habis bro. Saran gw tunggu 12-24 jam atau bikin/pake akun google lain-----") raise KeyboardInterrupt from google.colab.output import eval_js os.environ['colab_url'] = eval_js("google.colab.kernel.proxyPort(7860, {'cache': false})") #thanks to https://github.com/camenduru for the fork print('[1;32mInstalling dependencies...') print('[1;32m(This process will only happen once per session)') print('[0m') %cd /content #!if ! [ -f xformers ]; then pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16+814314d.d20230118-cp38-cp38-linux_x86_64.whl; pip install -q --pre triton; touch xformers; fi if not os.path.isfile('dependencies'): !gdown http://launchpadlibrarian.net/367274644/libgoogle-perftools-dev_2.5-2.2ubuntu3_amd64.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/google-perftools_2.5-2.2ubuntu3_all.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/libtcmalloc-minimal4_2.5-2.2ubuntu3_amd64.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/libgoogle-perftools4_2.5-2.2ubuntu3_amd64.deb !apt install -qq libunwind8-dev !dpkg -i *.deb %env LD_PRELOAD=libtcmalloc.so !rm *.deb # print("Grabbing pre-built xformers from camenduru's repo") # url = 'https://api.github.com/repos/camenduru/stable-diffusion-webui-colab/releases/latest' # response = requests.get(url) # print("Status code: " + str(response.status_code)) # if response.status_code == 200: # data = response.json() # templink = [link for link in [asset['browser_download_url'] for asset in data['assets'] if 'cp39' in asset['name']]] # xformerlink = templink[0] # else: # print("Request failed, loading last updated xformers instead") # xformerlink = 'https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.17/xformers-0.0.17+b6be33a.d20230315-cp39-cp39-linux_x86_64.whl' # !pip install -q --pre xformers !pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 torchtext==0.14.1 torchdata==0.5.1 --extra-index-url https://download.pytorch.org/whl/cu116 -U !pip install -q xformers==0.0.16 triton==2.0.0 -U # !pip install -q --pre xformers==0.0.17.dev476 -U # !pip install -q --pre triton !touch dependencies print('[1;32mInstalling webui...') print('[0m') !if ! [ -d stable-diffusion-webui ]; then git clone -b v2.1 https://github.com/camenduru/stable-diffusion-webui; touch forkedwebui; fi %cd stable-diffusion-webui #AnythingV3 Model & Vae print('[1;32mDownloading AnythingV3 model...') print('[0m') %cd /content/stable-diffusion-webui/models/Stable-diffusion/ !if ! [ -f Anything-V3.0.safetensors ]; then gdown https://huggingface.co./Linaqruf/anything-v3.0/resolve/main/anything-v3-fp32-pruned.safetensors -O /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.safetensors; fi !if ! [ -f Anything-V3.0.vae.pt ]; then gdown https://huggingface.co./WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -O /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt; fi #webui setup for nai print('[1;32mSetting UI configs...') print('[0m') %cd /content/stable-diffusion-webui !if [ -f configinstanlite ]; then rm configinstanlite && rm /content/stable-diffusion-webui/modules/ui.py && mv /content/stable-diffusion-webui/modules/ui_backup.py /content/stable-diffusion-webui/modules/ui.py; fi !if ! [ -f configinstan ]; then gdown https://pastebin.com/raw/gMTvTUUZ -O /content/stable-diffusion-webui/ui-config.json && gdown https://pastebin.com/raw/VviKmfiQ -O /content/stable-diffusion-webui/config.json; fi !touch configinstan #notification bell !gdown https://github.com/etherealxx/etherportal-webui-colab/raw/master/notification.mp3 -O /content/stable-diffusion-webui/notification.mp3 #foolhardy remacri ! [ ! -d models/ESRGAN ] && mkdir -p models/ESRGAN; [ ! -f models/ESRGAN/4x_foolhardy_Remacri.pth ] && gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/4x_foolhardy_Remacri.pth -O /content/stable-diffusion-webui/models/ESRGAN/4x_foolhardy_Remacri.pth #extensions print('[1;32mInstalling extensions...') print('[0m') %cd /content/stable-diffusion-webui/extensions !bash -c 'for repo in camenduru/stable-diffusion-webui-images-browser camenduru/sd-civitai-browser Extraltodeus/depthmap2mask ddPn08/kohya-sd-scripts-webui arenatemp/stable-diffusion-webui-model-toolkit etherealxx/batchlinks-webui; do if [ ! -d " repo" && true; fi; done' #DominikDoom/a1111-sd-webui-tagcomplete # !git clone -b lora --single-branch https://github.com/etherealxx/sd-civitai-browser !git clone -b pre-embedding --single-branch https://github.com/etherealxx/Umi-AI #%cd /content/stable-diffusion-webui/extensions/UnivAICharGen #!git checkout c56b5146049b91cfcd645c62bd356bd0631c4131 . #badprompt & badartist %cd /content/stable-diffusion-webui/embeddings/ !if ! [ -f bad_prompt.pt ]; then gdown https://huggingface.co./datasets/Nerfgun3/bad_prompt/resolve/main/bad_prompt_version2.pt -O /content/stable-diffusion-webui/embeddings/bad_prompt.pt; fi !if ! [ -f bad_artist.pt ]; then gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/bad_artist.pt -O /content/stable-diffusion-webui/embeddings/bad_artist.pt; fi !if ! [ -f bad_hands.pt ]; then gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/bad-hands-5.pt -O /content/stable-diffusion-webui/embeddings/bad_hands.pt; fi #some fix !sed -i -e '''/ prepare_environment()/a\ os.system\(f\"""sed -i -e ''\"s/dict()))/dict())).cuda()/g\"'' /content/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py""")''' /content/stable-diffusion-webui/launch.py !sed -i -e 's/fastapi==0.90.1/fastapi==0.89.1/g' /content/stable-diffusion-webui/requirements_versions.txt print('[1;32mInstallation Success!') print('[1;32mLaunching the webui...') print('[0m') %cd /content/stable-diffusion-webui !python launch.py --ckpt /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.safetensors --vae-path /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt --share --xformers --enable-insecure-extension-access --gradio-queue #@title (for mobile/android user, run this first before Instant/Manual) %%html Press play on the music player to keep the tab alive (Uses only 13MB of data) Untuk pengguna mobile, tekan play di musik di bawah Fungsinya agar bisa make Colabnya lebih lama (make kuota 13MB) - Manual (Open Dropdown👇) Run the 1. installation cell Choose your desired model, then run the 2. Download Model cell (you can repeat this step to download several model before you launch the webui) Open the dropdown of 3. Run (Choose one👇), then choose one of the two available methods (doesn't matter which one) #@title 1. Installation webui_version = "camenduru's fork (stable)" #@param ["camenduru's fork (stable)", "original automatic1111 repo (latest feature, might be buggy)"] import shutil import os import requests import subprocess cek = subprocess.getoutput('nvidia-smi') if not 'T4' in cek: print("[1;32m-----Your colab session is over. Use other google account or wait 12-24 hours-----") print("-----Sesi colab elu udah habis bro. Saran gw tunggu 12-24 jam atau bikin/pake akun google lain-----") raise KeyboardInterrupt from google.colab.output import eval_js os.environ['colab_url'] = eval_js("google.colab.kernel.proxyPort(7860, {'cache': false})") print('[1;32mInstalling dependencies...') print('[1;32m(This process will only happen once per session)') print('[0m') %cd /content #!if ! [ -f xformers ]; then pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16+814314d.d20230118-cp38-cp38-linux_x86_64.whl; pip install -q --pre triton; touch xformers; fi if not os.path.isfile('dependencies'): !gdown http://launchpadlibrarian.net/367274644/libgoogle-perftools-dev_2.5-2.2ubuntu3_amd64.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/google-perftools_2.5-2.2ubuntu3_all.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/libtcmalloc-minimal4_2.5-2.2ubuntu3_amd64.deb !gdown https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/libgoogle-perftools4_2.5-2.2ubuntu3_amd64.deb !apt install -qq libunwind8-dev !dpkg -i *.deb %env LD_PRELOAD=libtcmalloc.so !rm *.deb # print("Grabbing pre-built xformers from camenduru's repo") # url = 'https://api.github.com/repos/camenduru/stable-diffusion-webui-colab/releases/latest' # response = requests.get(url) # print("Status code: " + str(response.status_code)) # if response.status_code == 200: # data = response.json() # templink = [link for link in [asset['browser_download_url'] for asset in data['assets'] if 'cp39' in asset['name']]] # xformerlink = templink[0] # else: # print("Request failed, loading last updated xformers instead") # xformerlink = 'https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.17/xformers-0.0.17+b6be33a.d20230315-cp39-cp39-linux_x86_64.whl' # !pip install -q --pre xformers !pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 torchtext==0.14.1 torchdata==0.5.1 --extra-index-url https://download.pytorch.org/whl/cu116 -U !pip install -q xformers==0.0.16 triton==2.0.0 -U # !pip install -q --pre xformers==0.0.17.dev476 -U # !pip install -q --pre triton !touch dependencies print('[1;32mInstalling webui...') print('[0m') if webui_version=="camenduru's fork (stable)": !if ! [ -f forkedwebui ]; then echo "cloning from camenduru's fork"; rm -rf stable-diffusion-webui; git clone -b v2.1 https://github.com/camenduru/stable-diffusion-webui; sed -i -e '''/ prepare_environment()/a\ os.system\(f\"""sed -i -e ''\"s/dict()))/dict())).cuda()/g\"'' /content/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py""")''' /content/stable-diffusion-webui/launch.py; sed -i -e 's/fastapi==0.90.1/fastapi==0.89.1/g' /content/stable-diffusion-webui/requirements_versions.txt; touch forkedwebui; fi else: !if [ -f forkedwebui ]; then rm forkedwebui; mv '/content/stable-diffusion-webui/models/Stable-diffusion' '/content/temp'; rm -rf stable-diffusion-webui; fi !if ! [ -d stable-diffusion-webui ]; then echo "cloning from official repo"; git clone https://github.com/automatic1111/stable-diffusion-webui; cp -rf '/content/temp'/* '/content/stable-diffusion-webui/models/Stable-diffusion'; rm -rf '/content/temp'; fi %cd stable-diffusion-webui #webui setup for nai print('[1;32mSetting UI configs...') print('[0m') %cd /content/stable-diffusion-webui !if [ -f configinstanlite ]; then rm configinstanlite && rm /content/stable-diffusion-webui/modules/ui.py && mv /content/stable-diffusion-webui/modules/ui_backup.py /content/stable-diffusion-webui/modules/ui.py; fi !if ! [ -f configinstan ]; then gdown https://pastebin.com/raw/gMTvTUUZ -O /content/stable-diffusion-webui/ui-config.json && gdown https://pastebin.com/raw/VviKmfiQ -O /content/stable-diffusion-webui/config.json; fi !touch configinstan #notification bell !gdown https://github.com/etherealxx/etherportal-webui-colab/raw/master/notification.mp3 -O /content/stable-diffusion-webui/notification.mp3 #foolhardy remacri ! [ ! -d models/ESRGAN ] && mkdir -p models/ESRGAN; [ ! -f models/ESRGAN/4x_foolhardy_Remacri.pth ] && gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/4x_foolhardy_Remacri.pth -O /content/stable-diffusion-webui/models/ESRGAN/4x_foolhardy_Remacri.pth #temporaryfix #extensions print('[1;32mInstalling extensions...') print('[0m') %cd /content/stable-diffusion-webui/extensions !bash -c 'for repo in camenduru/stable-diffusion-webui-images-browser camenduru/sd-civitai-browser Extraltodeus/depthmap2mask kohya-ss/sd-webui-additional-networks etherealxx/batchlinks-webui; do if [ ! -d " repo" && true; fi; done' #DominikDoom/a1111-sd-webui-tagcomplete !git clone -b pre-embedding --single-branch https://github.com/etherealxx/Umi-AI #%cd /content/stable-diffusion-webui/extensions/UnivAICharGen #!if [ -f forkedwebui ]; then git checkout c56b5146049b91cfcd645c62bd356bd0631c4131 .; fi # !git clone -b lora --single-branch https://github.com/etherealxx/sd-civitai-browser #badprompt & badartist %cd /content/stable-diffusion-webui/embeddings/ !if ! [ -f bad_prompt.pt ]; then gdown https://huggingface.co./datasets/Nerfgun3/bad_prompt/resolve/main/bad_prompt_version2.pt -O /content/stable-diffusion-webui/embeddings/bad_prompt.pt; fi !if ! [ -f bad_artist.pt ]; then gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/bad_artist.pt -O /content/stable-diffusion-webui/embeddings/bad_artist.pt; fi !if ! [ -f bad_hands.pt ]; then gdown https://huggingface.co./etherealxx/whoseisthis/resolve/main/bad-hands-5.pt -O /content/stable-diffusion-webui/embeddings/bad_hands.pt; fi print('[1;32mInstallation Success!') print('[0m') #@title 2. Download Model Model_to_download="Anythingv3" #@param [ "Anythingv3", "WaifuDiffusion-Vae", "Eimis", "EvtV3", "ACertain", "ElysiumV3", "Wlop-any", "LeafMix", "Abyss7thLayer", "Healys", "LigneClaire", "KriboMix", "InizioSkinjob", "PantyStocking", "WaifuBodyBlenderMix", "StuffyMix", "AbyssOrangeMix2", "AbyssOrangeMix3", "8528", "AmbrosiaFusion", "AniMeth", "AnythingV4.0", "ArchonInstagram", "CounterveitV2.5", "CounterveitV2.2", "CounterveitV2.2", "HD-17", "HDDreamGape", "MomochaMix", "Mozarella", "PadoruDiffusion", "PastelMix", "Protothing", "Shirayuki", "NutMegMix", "KaniAnime", "EverythingMix", "BlossomExtract", "HentaiElysium", "BerryMix", "Systemy-CSR", "ElyOrangeMix", "AnyTwamMix", "DarkberryMix", "Grapefruit", "Mitsudoue"] #@markdown Confused on what model to choose? Look for examples and comparison [here](https://github.com/etherealxx/etherportal-webui-colab/blob/master/ModelComparison.md). #@markdown If the download speed is slow (Below 10MiB/s), press the stop button then re-run the cell) #@markdown If the model you wanted isn't listed, and you have the direct link, paste it to the form below. (Supported link: Huggingface, MEGA) optional_direct_link='' #@param {type:"string"} import os import urllib.request, subprocess, contextlib #these handle mega.nz from IPython.display import clear_output #this also handle mega.nz from IPython.utils import capture import requests from tqdm import tqdm folder = '/content/stable-diffusion-webui/models/Stable-diffusion/' def checkdownloaded(pathx): if os.path.exists(pathx) or (os.path.exists(os.path.join(folder, 'Anything-V3.0.safetensors')) and Model_to_download=="Anythingv3"): if pathx.endswith("tmp"): os.remove(pathx) else: print(f'[1;32mThat model is already downloaded.') print('[0m') return 2 #civitstuff checkerpath = os.path.join(folder, 'civitmodel.txt') alreadythere = False def checkearlycivit(): alreadythere = False lines = [] if not os.path.exists(checkerpath): !touch {checkerpath} #check for unavailable model first if os.stat(checkerpath).st_size != 0: with open(checkerpath, "r") as file: for line in file: key, value = line.strip().split(" = ") modelfile = os.path.join(folder, value) if os.path.exists(modelfile): lines.append(line) if key == Model_to_download: alreadythere = True else: print(f"Seems like {key} model is not found on the model folder.") print() with open(checkerpath, "w") as file: file.writelines(lines) if alreadythere == True: return 2 def civitgetpath(modelname): with open(checkerpath, "r") as file: for line in file: key, value = line.strip().split(" = ") if key == modelname: return os.path.join(folder, value) def civitwrite(modelname): towrite = f"{Model_to_download} = {modelname}" with open(checkerpath, "a") as file: file.write(towrite + "\n") #civitstuffend def download_hf(link): filename = link.rsplit('/', 1)[-1] if Model_to_download == 'WaifuDiffusion-Vae': filename = 'WD-vae.vae.pt' elif Model_to_download == 'Anythingv3': filename = 'Anything-V3.0.safetensors' hfpath = os.path.join(folder, filename) check = checkdownloaded(hfpath) if check == 2: if Model_to_download=='Anythingv3' and not os.path.exists(os.path.join(folder, 'Anything-V3.0.vae.pt')): !gdown https://huggingface.co./WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -O /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt return print(f'\033[1;32mDownloading {Model_to_download} Model...\033[0m') !gdown {link} -O /content/stable-diffusion-webui/models/Stable-diffusion/{filename} if Model_to_download=='Anythingv3': !gdown https://huggingface.co./WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -O /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt print(f'\033[1;32mModel Downloaded.\033[0m') def download_civit(url): print(f'\033[1;32mDownloading {Model_to_download} Model...\033[0m') head_response = requests.head(url) total = int(head_response.headers.get('Content-Length', 0)) civitcheck = checkearlycivit() if civitcheck == 2: #model exist civitpath = civitgetpath(Model_to_download) downloaded_size = os.path.getsize(civitpath) if total != 0 and downloaded_size != total: os.remove(civitpath) checkearlycivit() print(f'Removed incomplete download: {Model_to_download}') else: print(f'[1;32mThat model is already downloaded.') print('[0m') return downloaded_size = 0 if not civitcheck == 2: pathtemp = os.path.join(folder, Model_to_download + ".bdgh") print(f'The model "{Model_to_download}" will be renamed correctly after downloading') with open(pathtemp, 'wb') as file, tqdm( desc=pathtemp, total=total, unit='iB', unit_scale=True, unit_divisor=1024, initial=downloaded_size, ) as bar: resp = requests.get(url, stream=True) for data in resp.iter_content(chunk_size=1024): size = file.write(data) bar.update(size) # Check if the file has been downloaded successfully downloaded_size = os.path.getsize(pathtemp) if (total != 0 and downloaded_size != total) or (downloaded_size < 1000): # Remove the file if it has not been downloaded successfully os.remove(pathtemp) print() if downloaded_size < 1000: print(f'The model "{Model_to_download}" is probably had the link changed. Contact the owner of this repo.') else: print(f'Removed incomplete download: {Model_to_download}') return actualfilename = resp.headers['Content-Disposition'].split("filename=")[1].strip('"') #%cd {folder} os.rename(pathtemp, os.path.join(folder, actualfilename)) print (f'Model "{Model_to_download}.bdgh" renamed to "{actualfilename}"') civitwrite(actualfilename) print(f'\033[1;32mModel Downloaded.\033[0m') print('[1;32mInstalling webui...') with capture.capture_output() as cap: %cd /content !if ! [ -d stable-diffusion-webui ]; then git clone -b v1.6 https://github.com/camenduru/stable-diffusion-webui; touch forkedwebui; fi print('[0m') !if [ -f {folder}'Put Stable Diffusion checkpoints here.txt' ]; then rm {folder}'Put Stable Diffusion checkpoints here.txt'; fi %cd {folder} #sfw if Model_to_download=='Anythingv3': download_hf('https://huggingface.co./Linaqruf/anything-v3.0/resolve/main/anything-v3-fp32-pruned.safetensors') if Model_to_download=='WaifuDiffusion-Vae': download_hf('https://huggingface.co./hakurei/waifu-diffusion-v1-4/resolve/main/vae/kl-f8-anime2.ckpt') if Model_to_download=='Eimis': download_hf('https://huggingface.co./eimiss/EimisAnimeDiffusion_1.0v/resolve/main/EimisAnimeDiffusion_1-0v.ckpt') if Model_to_download=='EvtV3': download_hf('https://huggingface.co./haor/Evt_V3/resolve/main/Evt_V3_ema.ckpt') if Model_to_download=='ACertain': download_hf('https://huggingface.co./JosephusCheung/ACertainModel/resolve/main/ACertainModel.ckpt') if Model_to_download=='ElysiumV3': download_hf('https://huggingface.co./hesw23168/SD-Elysium-Model/resolve/main/Elysium_Anime_V3.safetensors') if Model_to_download=='Wlop-any': download_hf('https://huggingface.co./SirVeggie/wlop/resolve/main/wlop-any.ckpt') if Model_to_download=='LeafMix': download_hf('https://huggingface.co./etherealxx/anyleaf-temp/resolve/main/Leaf-pruned.safetensors') if Model_to_download=='Abyss7thLayer': download_hf('https://huggingface.co./syaimu/7th_Layer/resolve/main/7th_layer/Abyss_7th_layer.ckpt') if Model_to_download=='Healys': download_civit('https://civitai.com/api/download/models/1498') if Model_to_download=='LigneClaire': download_hf('https://huggingface.co./breakcore2/ligne_claire_anime_diffusion/resolve/main/ligne_claire_anime_diffusion_v1.safetensors') if Model_to_download=='KriboMix': download_civit('https://civitai.com/api/download/models/1289') if Model_to_download=='InizioSkinjob': download_hf('https://huggingface.co./Cinnamomo/inizio/resolve/main/safetensor/inizio_skinjob.safetensors') if Model_to_download=='PantyStocking': download_civit('https://civitai.com/api/download/models/1560') if Model_to_download=='WaifuBodyBlenderMix': download_civit('https://civitai.com/api/download/models/1838') if Model_to_download=='StuffyMix': download_civit('https://civitai.com/api/download/models/3376') if Model_to_download=='AbyssOrangeMix2': download_hf('https://huggingface.co./WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix2/AbyssOrangeMix2_hard.safetensors') if Model_to_download=='AbyssOrangeMix3': download_hf('https://huggingface.co./WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3 .safetensors') if Model_to_download=='8528': download_hf('https://huggingface.co./ckpt/8528-diffusion/resolve/main/8528d-final.ckpt') if Model_to_download=='AmbrosiaFusion': download_hf('https://huggingface.co./NiteStormz/ProtoThing_200/resolve/main/AmbrosiaFusion.ckpt') if Model_to_download=='AniMeth': download_hf('https://huggingface.co./Rasgeath/self_made_sauce/resolve/main/AniMeth.safetensors') if Model_to_download=='AnythingV4.0': download_hf('https://huggingface.co./andite/anything-v4.0/resolve/main/anything-v4.0-pruned.safetensors') if Model_to_download=='ArchonInstagram': download_hf('https://huggingface.co./misobarisic/playground/resolve/main/ArchonInstagram-fp16.ckpt') if Model_to_download=='CounterveitV2.5': download_hf('https://huggingface.co./gsdf/Counterfeit-V2.5/resolve/main/Counterfeit-V2.5_pruned.safetensors') if Model_to_download=='CounterveitV2.2': download_hf('https://huggingface.co./gsdf/Counterfeit-V2.5/resolve/main/Counterfeit-V2.2.safetensors') if Model_to_download=='CounterveitV2.2': download_hf('https://huggingface.co./gsdf/Counterfeit-V2.5/resolve/main/Counterfeit-V2.2.safetensors') if Model_to_download=='HD-17': download_hf('https://huggingface.co./Deltaadams/HentaiDiffusion/resolve/main/HD-17.ckpt') if Model_to_download=='HDDreamGape': download_hf('https://huggingface.co./Horsebird/HDDream-G/resolve/main/HDDream-Gape.safetensors') if Model_to_download=='MomochaMix': download_hf('https://huggingface.co./NoCrypt/momocha-mix/resolve/main/momocha-6E7-0.315-AD-E7-0.15-WS.ckpt') if Model_to_download=='Mozarella': download_hf('https://huggingface.co./Rasgeath/self_made_sauce/resolve/main/Mozzarella-pruned.safetensors') if Model_to_download=='PadoruDiffusion': download_hf('https://huggingface.co./misobarisic/playground/resolve/main/padoruDiffusion_1.ckpt') if Model_to_download=='PastelMix': download_hf('https://huggingface.co./andite/pastel-mix/resolve/main/pastelmix-fp32.safetensors') if Model_to_download=='Protothing': download_hf('https://huggingface.co./NiteStormz/ProtoThing_200/resolve/main/ProtoThing_200.ckpt') if Model_to_download=='Shirayuki': download_hf('https://huggingface.co./hesw23168/SD_Shirayuki_Model/resolve/main/Shirayuki_Anime_V1-fp16.safetensors') if Model_to_download=='NutMegMix': download_hf('https://huggingface.co./acheong08/nutmegmix/resolve/main/nutmegmix.safetensors') if Model_to_download=='KaniAnime': download_hf('https://huggingface.co./Rasgeath/self_made_sauce/resolve/main/Kani-anime-pruned.ckpt') if Model_to_download=='EverythingMix': download_hf('https://huggingface.co./DrBob2142/Everything/resolve/main/Everything%20V1B.safetensors') if Model_to_download=='BlossomExtract': download_hf('https://huggingface.co./NUROISEA/anything-mix/resolve/main/blossom-extract.safetensors') if Model_to_download=='HentaiElysium': download_hf('https://huggingface.co./NUROISEA/anything-mix/resolve/main/hentai-elysium-50.safetensors') #nsfw if Model_to_download=='BerryMix': download_hf('https://huggingface.co./misobarisic/berry-mix/resolve/main/berry_mix.ckpt') if Model_to_download=='Systemy-CSR': download_hf('https://huggingface.co./etherealxx/systemy-csrmodel-cutesexyrobutts/resolve/main/CSRmodel_1-CSRmodel_0-Weighted_sum-merged.ckpt') if Model_to_download=='ElyOrangeMix': download_hf('https://huggingface.co./WarriorMama777/OrangeMixs/resolve/main/Models/ElyOrangeMix/ElyOrangeMix.ckpt') if Model_to_download=='AnyTwamMix': download_civit('https://civitai.com/api/download/models/4527') if Model_to_download=='DarkberryMix': download_civit('https://civitai.com/api/download/models/1992') if Model_to_download=='Grapefruit': download_civit('https://civitai.com/api/download/models/6360') if Model_to_download=='Mitsudoue': download_civit('https://civitai.com/api/download/models/1454') #these code below handle mega.nz def unbuffered(proc, stream='stdout'): stream = getattr(proc, stream) with contextlib.closing(stream): while True: out = [] last = stream.read(1) # Don't loop forever if last == '' and proc.poll() is not None: break while last not in newlines: # Don't loop forever if last == '' and proc.poll() is not None: break out.append(last) last = stream.read(1) out = ''.join(out) yield out def transfare(): import codecs decoder = codecs.getincrementaldecoder("UTF-8")() cmd = ["mega-get", optional_direct_link, folder] proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, ) for line in unbuffered(proc): if not line.startswith("Download"): print(f"\r{line}", end="") else: print(f"\n{line}") def installmega(): HOME = os.path.expanduser("~") if not os.path.exists(f"{HOME}/.ipython/ocr.py"): hCode = "https://raw.githubusercontent.com/biplobsd/" \ "OneClickRun/master/res/ocr.py" urllib.request.urlretrieve(hCode, f"{HOME}/.ipython/ocr.py") from ocr import ( runSh, loadingAn, ) if not os.path.exists("/usr/bin/mega-cmd"): loadingAn() print("Installing MEGA ...") runSh('sudo apt-get -y update') runSh('sudo apt-get -y install libmms0 libc-ares2 libc6 libcrypto++6 libgcc1 libmediainfo0v5 libpcre3 libpcrecpp0v5 libssl1.1 libstdc++6 libzen0v5 zlib1g apt-transport-https') runSh('sudo curl -sL -o /var/cache/apt/archives/MEGAcmd.deb https://mega.nz/linux/MEGAsync/Debian_9.0/amd64/megacmd-Debian_9.0_amd64.deb', output=True) runSh('sudo dpkg -i /var/cache/apt/archives/MEGAcmd.deb', output=True) print("MEGA is installed.") clear_output() #these code above handle mega.nz if optional_direct_link!='': if optional_direct_link.startswith("https://huggingface.co./"): custom_download = os.path.basename(optional_direct_link) custom_path = os.path.join(folder,custom_download) if not os.path.isfile(custom_path): print(f'[1;32mDownloading {custom_download}') print('[0m') !gdown {optional_direct_link} -O {custom_path} else: print(f'[1;32mThat custom model is already downloaded.') print('[0m') elif optional_direct_link.startswith("https://mega.nz/"): print(f'[1;32mDownloading from a Mega link') print('[0m') installmega() newlines = ['\n', '\r\n', '\r'] transfare() files = os.listdir(folder) for file in files: if file.endswith('tmp') or file.endswith('bdgh'): file_path = os.path.join(folder, file) print(f"Removed incomplete download: {file_path}") os.remove(file_path) for root, dirs, files in os.walk(folder): for file in files: if file.endswith('.ckpt') or file.endswith('.safetensors'): checksizepath = os.path.join(root, file) MB = 1000000 # 1 megabyte = 1000000 bytes lorapath = '/content/stable-diffusion-webui/models/Lora' if os.path.getsize(checksizepath) < 200 * MB: if os.path.getsize(checksizepath) < MB: os.remove(checksizepath) print() print(f'The model {checksizepath} is probably had the link changed. Contact the owner of this repo.') else: if not os.path.exists(lorapath): os.makedirs(lorapath) os.rename(checksizepath, os.path.join(lorapath, file)) print() print(f'The model {checksizepath} is probably a Lora, so it is moved to lora folder') print() print('[1;32mList of installed models:') print('[0m') !ls *.{ckpt,safetensors,pt} {folder} 2>/dev/null 3. Run (Choose one👇) #@title Run with Gradio #@markdown ![](https://raw.githubusercontent.com/etherealxx/etherportal-webui-colab/master/images/launchwebui2.jpg) import subprocess cek = subprocess.getoutput('nvidia-smi') if not 'T4' in cek: print("[1;32m-----Your colab session is over. Use other google account or wait 12-24 hours-----") print("-----Sesi colab elu udah habis bro. Saran gw tunggu 12-24 jam atau bikin/pake akun google lain-----") raise KeyboardInterrupt %cd /content/stable-diffusion-webui/ !python launch.py --share --xformers --enable-insecure-extension-access --gradio-queue --no-half-vae #@title Run with Localtunnel #@markdown ![](https://raw.githubusercontent.com/etherealxx/etherportal-webui-colab/master/images/launchwebui3.jpg) import subprocess import time !npm install -g localtunnel cek = subprocess.getoutput('nvidia-smi') if not 'T4' in cek: print("[1;32m-----Your colab session is over. Use other google account or wait 12-24 hours-----") print("-----Sesi colab elu udah habis bro. Saran gw tunggu 12-24 jam atau bikin/pake akun google lain-----") raise KeyboardInterrupt %cd /content/stable-diffusion-webui/ !nohup lt -p 7860 > lt.log 2>&1 & time.sleep(2) with open('/content/stable-diffusion-webui/lt.log', 'r') as testwritefile: print("\033[92m" + "Wait for the model to load and follow this link") print(testwritefile.read()) print("\033[95m") !python launch.py --xformers --enable-insecure-extension-access |