Spaces:
Runtime error
Runtime error
Upload copy_of_notebookb3773fe608.py
#1
by
neilgiovanni
- opened
- copy_of_notebookb3773fe608.py +126 -0
copy_of_notebookb3773fe608.py
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""Copy of notebookb3773fe608.ipynb
|
3 |
+
|
4 |
+
Automatically generated by Colaboratory.
|
5 |
+
|
6 |
+
Original file is located at
|
7 |
+
https://colab.research.google.com/#fileId=https%3A//huggingface.co/spaces/neilgiovanni/sdui/blob/main/Copy%20of%20notebookb3773fe608.ipynb
|
8 |
+
|
9 |
+
# [AUTOMATIC1111's Stable Diffusion WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) for Kaggle
|
10 |
+
|
11 |
+
### Feel free to copy and add any extension, model, etc. to your taste.
|
12 |
+
### *Those who copied, check for updates [**here**](https://www.kaggle.com/code/roguewild/automatic1111-s-stable-diffusion-webui)*
|
13 |
+
#### You can use the Batch Link Downloader extension inside WebUI to download stuff.
|
14 |
+
The **disadvantage** of the Batch Link Downloader is that **you'll have to download the same stuff over and over again with every new Kaggle Session**. *It is convenient to test various models from places like Civitai*, **but** if you want a specific model, extension, vae or upscaler to always be loaded in automatically, you will need to add it as code ( *!git clone* for extensions from GitHub, *!aria2c* for stuff from HuggingFace and Civitai ).
|
15 |
+
|
16 |
+
### Have fun!
|
17 |
+
|
18 |
+
*Don't forget to enable Accelerator and Internet in the Notebook options.*
|
19 |
+
|
20 |
+
***Don't use it for adult content or your account may get blocked.***
|
21 |
+
|
22 |
+
>Runs on Python: 3.10.10, Torch: 2.0.0+cu118
|
23 |
+
|
24 |
+
Special thanks to [camenduru](https://github.com/camenduru) β¨
|
25 |
+
"""
|
26 |
+
|
27 |
+
# Commented out IPython magic to ensure Python compatibility.
|
28 |
+
# - Dependencies - #
|
29 |
+
# %env TF_CPP_MIN_LOG_LEVEL=1
|
30 |
+
!apt -y update -qq
|
31 |
+
!apt -y install -qq aria2
|
32 |
+
!wget http://launchpadlibrarian.net/367274644/libgoogle-perftools-dev_2.5-2.2ubuntu3_amd64.deb
|
33 |
+
!wget https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/google-perftools_2.5-2.2ubuntu3_all.deb
|
34 |
+
!wget https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/libtcmalloc-minimal4_2.5-2.2ubuntu3_amd64.deb
|
35 |
+
!wget https://launchpad.net/ubuntu/+source/google-perftools/2.5-2.2ubuntu3/+build/14795286/+files/libgoogle-perftools4_2.5-2.2ubuntu3_amd64.deb
|
36 |
+
!apt -y install -qq libunwind8-dev
|
37 |
+
!dpkg -i *.deb
|
38 |
+
# %env LD_PRELOAD=libtcmalloc.so
|
39 |
+
!rm *.deb
|
40 |
+
!pip install --upgrade pip setuptools
|
41 |
+
!python -m pip cache purge
|
42 |
+
|
43 |
+
# !pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
|
44 |
+
# !pip install -q huggingface-hub -U
|
45 |
+
|
46 |
+
!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
|
47 |
+
|
48 |
+
# --- MODELS, LORAS, VAE --- #
|
49 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/86437 -d /content/stable-diffusion-webui/models/Stable-diffusion -o absolutereality_v1.safetensors
|
50 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -d /content/stable-diffusion-webui/models/VAE -o vae-ft-mse-840000-ema-pruned.safetensors
|
51 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/hakurei/waifu-diffusion-v1-4/resolve/main/vae/kl-f8-anime2.ckpt -d /content/stable-diffusion-webui/models/VAE -o kl-f8-anime2.ckpt
|
52 |
+
|
53 |
+
# --- UPSCALERS --- #
|
54 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Zabin/Resizers/resolve/main/4x-UltraSharp.pth -d /content/stable-diffusion-webui/models/ESRGAN -o 4x-UltraSharp.pth
|
55 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Zabin/Resizers/resolve/main/4x_foolhardy_Remacri.pth -d /content/stable-diffusion-webui/models/ESRGAN -o 4x_foolhardy_Remacri.pth
|
56 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/gemasai/4x_NMKD-Superscale-SP_178000_G/resolve/main/4x_NMKD-Superscale-SP_178000_G.pth -d /content/stable-diffusion-webui/models/ESRGAN -o 4x_NMKD-Superscale-SP_178000_G.pth
|
57 |
+
|
58 |
+
# --- EMBEDDINGS --- #
|
59 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/negative/resolve/main/EasyNegative.pt -d /content/stable-diffusion-webui/embeddings/Negative -o EasyNegative.pt
|
60 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/gsdf/Counterfeit-V3.0/resolve/main/embedding/EasyNegativeV2.safetensors -d /content/stable-diffusion-webui/embeddings/Negative -o EasyNegativeV2.safetensors
|
61 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/negative/resolve/main/bad-hands-5.pt -d /content/stable-diffusion-webui/embeddings/Negative -o bad-hands-5.pt
|
62 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/negative/resolve/main/bad_prompt_version2.pt -d /content/stable-diffusion-webui/embeddings/Negative -o bad_prompt_version2.pt
|
63 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/negative/resolve/main/ng_deepnegative_v1_75t.pt -d /content/stable-diffusion-webui/embeddings/Negative -o ng_deepnegative_v1_75t.pt
|
64 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ffxvs/negative-prompts-pack/resolve/main/bad-artist.pt -d /content/stable-diffusion-webui/embeddings/Negative -o bad-artist.pt
|
65 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ffxvs/negative-prompts-pack/resolve/main/badhandv4.pt -d /content/stable-diffusion-webui/embeddings/Negative -o badhandv4.pt
|
66 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ffxvs/negative-prompts-pack/resolve/main/verybadimagenegative_v1.3.pt -d /content/stable-diffusion-webui/embeddings/Negative -o verybadimagenegative_v1.3.pt
|
67 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/60938 -d /content/stable-diffusion-webui/embeddings/Negative -o negative_hand-neg.pt
|
68 |
+
|
69 |
+
# --- EXTENSIONS --- #
|
70 |
+
!git clone https://github.com/zanllp/sd-webui-infinite-image-browsing /content/stable-diffusion-webui/extensions/sd-webui-infinite-image-browsing
|
71 |
+
!git clone https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris /content/stable-diffusion-webui/extensions/a1111-sd-webui-lycoris
|
72 |
+
!git clone https://github.com/etherealxx/batchlinks-webui /content/stable-diffusion-webui/extensions/batchlinks-webui
|
73 |
+
!git clone https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111 /content/stable-diffusion-webui/extensions/multidiffusion-upscaler-for-automatic1111
|
74 |
+
!git clone https://github.com/mcmonkeyprojects/sd-dynamic-thresholding /content/stable-diffusion-webui/extensions/sd-dynamic-thresholding
|
75 |
+
!git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete /content/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete
|
76 |
+
!git clone https://github.com/aka7774/sd_filer /content/stable-diffusion-webui/extensions/sd_filer
|
77 |
+
!git clone https://github.com/hako-mikan/sd-webui-supermerger /content/stable-diffusion-webui/extensions/sd-webui-supermerger
|
78 |
+
!git clone https://github.com/Bing-su/adetailer /content/stable-diffusion-webui/extensions/adetailer
|
79 |
+
!git clone https://github.com/deforum-art/deforum-for-automatic1111-webui /content/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui
|
80 |
+
!git clone https://github.com/thomasasfk/sd-webui-aspect-ratio-helper /content/stable-diffusion-webui/extensions/sd-webui-aspect-ratio-helper
|
81 |
+
|
82 |
+
# ControlNet, if you need it β ( β Sellect commented lines below and press "Ctrl + /" to uncomment all at once β )
|
83 |
+
|
84 |
+
# !git clone https://github.com/Mikubill/sd-webui-controlnet /content/stable-diffusion-webui/extensions/sd-webui-controlnet
|
85 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11e_sd15_ip2p_fp16.safetensors
|
86 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11e_sd15_shuffle_fp16.safetensors
|
87 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_canny_fp16.safetensors
|
88 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_depth_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_depth_fp16.safetensors
|
89 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_inpaint_fp16.safetensors
|
90 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_lineart_fp16.safetensors
|
91 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_mlsd_fp16.safetensors
|
92 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_normalbae_fp16.safetensors
|
93 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_openpose_fp16.safetensors
|
94 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_scribble_fp16.safetensors
|
95 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_seg_fp16.safetensors
|
96 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15_softedge_fp16.safetensors
|
97 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11p_sd15s2_lineart_anime_fp16.safetensors
|
98 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11u_sd15_tile_fp16.safetensors -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o control_v11u_sd15_tile_fp16.safetensors
|
99 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_style_sd14v1.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_style_sd14v1.pth
|
100 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd14v1.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_sketch_sd14v1.pth
|
101 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_seg_sd14v1.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_seg_sd14v1.pth
|
102 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_openpose_sd14v1.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_openpose_sd14v1.pth
|
103 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_keypose_sd14v1.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_keypose_sd14v1.pth
|
104 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_color_sd14v1.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_color_sd14v1.pth
|
105 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd15v2.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_canny_sd15v2.pth
|
106 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd15v2.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_depth_sd15v2.pth
|
107 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd15v2.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_sketch_sd15v2.pth
|
108 |
+
# !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_zoedepth_sd15v1.pth -d /content/stable-diffusion-webui/extensions/sd-webui-controlnet/models -o t2iadapter_zoedepth_sd15v1.pth
|
109 |
+
|
110 |
+
# %cd /content/stable-diffusion-webui
|
111 |
+
|
112 |
+
# - UI Config - #
|
113 |
+
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/TNitro/ui-config/resolve/main/ui-config.json -d /content/stable-diffusion-webui -o ui-config.json
|
114 |
+
!sed -i -e 's/\["sd_model_checkpoint"\],/\["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"\],/g' /content/stable-diffusion-webui/modules/shared.py
|
115 |
+
!sed -i -e 's/"\[seed\]"/"\[model_name\],\[seed\]"/g' /content/stable-diffusion-webui/modules/images.py
|
116 |
+
!sed -i -e 's/"CLIP_stop_at_last_layers": OptionInfo(1,/"CLIP_stop_at_last_layers": OptionInfo(2,/g' /content/stable-diffusion-webui/modules/shared.py
|
117 |
+
!sed -i -e 's/"txt2img\/Negative prompt\/value": "",/"txt2img\/Negative prompt\/value": "(low quality, worst quality), EasyNegativeV2,",/g' /content/stable-diffusion-webui/ui-config.json
|
118 |
+
!sed -i -e 's/"txt2img\/Sampling method\/value": "Euler a",/"txt2img\/Sampling method\/value": "DPM++ 2M SDE Karras",/g' /content/stable-diffusion-webui/ui-config.json
|
119 |
+
!sed -i -e 's/"txt2img\/Upscaler\/value": "Latent",/"txt2img\/Upscaler\/value": "R-ESRGAN 4x+",/g' /content/stable-diffusion-webui/ui-config.json
|
120 |
+
!sed -i -e 's/"gdown"/"aria2"/g' /content/stable-diffusion-webui/extensions/batchlinks-webui/scripts/batchlinks-downloader.py
|
121 |
+
# - Kitchen Theme - #
|
122 |
+
# !git clone https://github.com/canisminor1990/sd-webui-kitchen-theme /content/stable-diffusion-webui/extensions/sd-webui-kitchen-theme
|
123 |
+
|
124 |
+
# - Command Line Arguments - #
|
125 |
+
!python set IGNORE_CMD_ARGS_ERRORS=anything
|
126 |
+
!python launch.py --share --gradio-queue --opt-sdp-attention --theme dark --enable-insecure-extension-access --no-hashing --opt-split-attention --no-half-vae --xformers --administrator --force-enable-xformers --xformers-flash-attention --disable-nan-check --upcast-sampling --disable-safe-unpickle --reinstall-xformers --reinstall-torch --update-all-extensions --disable-nan-check
|