|
import os |
|
from subprocess import getoutput |
|
|
|
gpu_info = getoutput('nvidia-smi') |
|
if("A10G" in gpu_info): |
|
os.system(f"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+4c06c79.d20221205-cp38-cp38-linux_x86_64.whl") |
|
elif("T4" in gpu_info): |
|
|
|
os.system(f"apt-get install git-lfs") |
|
os.system(f"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+1515f77.d20221130-cp38-cp38-linux_x86_64.whl") |
|
|
|
os.system(f"git clone https://github.com/camenduru/stable-diffusion-webui /home/user/app/stable-diffusion-webui") |
|
os.chdir("/home/user/app/stable-diffusion-webui") |
|
|
|
os.system(f"wget -q https://github.com/camenduru/webui/raw/main/env_patch.py -O /home/user/app/env_patch.py") |
|
os.system(f"sed -i -e '/import image_from_url_text/r /home/user/app/env_patch.py' /home/user/app/stable-diffusion-webui/modules/ui.py") |
|
os.system(f"sed -i -e '/(modelmerger_interface, \"Checkpoint Merger\", \"modelmerger\"),/d' /home/user/app/stable-diffusion-webui/modules/ui.py") |
|
os.system(f"sed -i -e '/(train_interface, \"Train\", \"ti\"),/d' /home/user/app/stable-diffusion-webui/modules/ui.py") |
|
os.system(f"sed -i -e '/extensions_interface, \"Extensions\", \"extensions\"/d' /home/user/app/stable-diffusion-webui/modules/ui.py") |
|
os.system(f"sed -i -e '/settings_interface, \"Settings\", \"settings\"/d' /home/user/app/stable-diffusion-webui/modules/ui.py") |
|
os.system(f'''sed -i -e "s/document.getElementsByTagName('gradio-app')\[0\].shadowRoot/!!document.getElementsByTagName('gradio-app')[0].shadowRoot ? document.getElementsByTagName('gradio-app')[0].shadowRoot : document/g" /home/user/app/stable-diffusion-webui/script.js''') |
|
os.system(f"sed -i -e 's/ show_progress=False,/ show_progress=True,/g' /home/user/app/stable-diffusion-webui/modules/ui.py") |
|
os.system(f"sed -i -e 's/shared.demo.launch/shared.demo.queue().launch/g' /home/user/app/stable-diffusion-webui/webui.py") |
|
os.system(f"sed -i -e 's/ outputs=\[/queue=False, &/g' /home/user/app/stable-diffusion-webui/modules/ui.py") |
|
os.system(f"sed -i -e 's/ queue=False, / /g' /home/user/app/stable-diffusion-webui/modules/ui.py") |
|
|
|
if "IS_SHARED_UI" in os.environ: |
|
os.system(f"rm -rfv /home/user/app/stable-diffusion-webui/scripts/") |
|
|
|
os.system(f"wget -q https://github.com/camenduru/webui/raw/main/shared-config.json -O /home/user/app/shared-config.json") |
|
os.system(f"wget -q https://github.com/camenduru/webui/raw/main/shared-ui-config.json -O /home/user/app/shared-ui-config.json") |
|
|
|
os.system(f"wget -q {os.getenv('MODEL_LINK')} -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/{os.getenv('MODEL_NAME')}") |
|
os.system(f"wget -q {os.getenv('VAE_LINK')} -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/{os.getenv('VAE_NAME')}") |
|
os.system(f"wget -q {os.getenv('YAML_LINK')} -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/{os.getenv('YAML_NAME')}") |
|
|
|
os.system(f"python launch.py --force-enable-xformers --disable-console-progressbars --enable-console-prompts --ui-config-file /home/user/app/shared-ui-config.json --ui-settings-file /home/user/app/shared-config.json --cors-allow-origins huggingface.co,hf.space --no-progressbar-hiding") |
|
else: |
|
|
|
os.system(f"wget -q https://gist.github.com/camenduru/9ec5f8141db9902e375967e93250860f/raw/d0bcf01786f20107c329c03f8968584ee67be12a/run_n_times.py -O /home/user/app/stable-diffusion-webui/scripts/run_n_times.py") |
|
|
|
os.system(f"wget https://huggingface.co/Xenos14/Checkpoints/resolve/main/ui-config.json --content-disposition -O /home/user/app/stable-diffusion-webui/ui-config.json") |
|
os.system(f"wget https://huggingface.co/Xenos14/Checkpoints/resolve/main/config.json --content-disposition -O /home/user/app/stable-diffusion-webui/config.json") |
|
|
|
|
|
os.system(f"git clone https://github.com/Mikubill/sd-webui-controlnet.git /home/user/app/stable-diffusion-webui/extensions/controlnet") |
|
os.system(f"git clone https://github.com/etherealxx/batchlinks-webui /home/user/app/stable-diffusion-webui/extensions/batchlinks-webui") |
|
os.system(f"git clone https://github.com/zanllp/sd-webui-infinite-image-browsing /home/user/app/stable-diffusion-webui/extensions/sd-webui-infinite-image-browsing") |
|
os.system(f"git clone https://github.com/Bing-su/adetailer /home/user/app/stable-diffusion-webui/extensions/adetailer") |
|
os.system(f"git clone https://github.com/hako-mikan/sd-webui-supermerger /home/user/app/stable-diffusion-webui/extensions/sd-webui-supermerger") |
|
os.system(f"git clone https://github.com/aka7774/sd_filer /home/user/app/stable-diffusion-webui/extensions/sd_filer") |
|
os.system(f"git clone https://github.com/arenasys/stable-diffusion-webui-model-toolkit /home/user/app/stable-diffusion-webui/extensions/stable-diffusion-webui-model-toolkit") |
|
os.system(f"git clone https://github.com/civitai/sd_civitai_extension /home/user/app/stable-diffusion-webui/extensions/sd_civitai_extension") |
|
os.system(f"git clone https://github.com/adieyal/sd-dynamic-prompts /home/user/app/stable-diffusion-webui/extensions/sd-dynamic-prompts") |
|
os.system(f"git clone https://github.com/camenduru/stable-diffusion-webui-huggingface /home/user/app/stable-diffusion-webui/extensions/stable-diffusion-webui-huggingface") |
|
os.system(f"git clone https://github.com/BlafKing/sd-civitai-browser-plus /home/user/app/stable-diffusion-webui/extensions/sd-civitai-browser-plus") |
|
os.system(f"git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git /home/user/app/stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete") |
|
os.system(f"git clone https://github.com/continue-revolution/sd-webui-animatediff /home/user/app/stable-diffusion-webui/extensions/sd-webui-animatediff") |
|
os.system(f"git clone https://github.com/klimaleksus/stable-diffusion-webui-embedding-merge /home/user/app/stable-diffusion-webui/extensions/stable-diffusion-webui-embedding-merge") |
|
os.system(f"git clone https://github.com/kohya-ss/sd-webui-additional-networks /home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks") |
|
|
|
os.system(f"git clone https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper /home/user/app/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper") |
|
os.system(f"git clone https://github.com/mcmonkeyprojects/sd-dynamic-thresholding.git /home/user/app/stable-diffusion-webui/extensions/sd-dynamic-thresholding") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
os.system(f"wget -q https://huggingface.co/Xenos14/Checkpoints/resolve/main/XenoMATION-V1.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/XenoMATION-V1.safetensors") |
|
|
|
os.system(f"wget https://huggingface.co/Xenos14/Checkpoints/resolve/main/XenoGASM-MK2.safetensors --content-disposition -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/XenoGASM-MK2.safetensors") |
|
os.system(f"wget https://huggingface.co/Xenos14/TestBed/resolve/main/2024-Real/XenoGRAPH.safetensors --content-disposition -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/XenoGRAPH.safetensors") |
|
os.system(f"wget https://huggingface.co/Xenos14/TestBed/resolve/main/2024-Morph/XenoMORPH-v2.safetensors --content-disposition -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/XenoMORPH-v2.safetensors") |
|
os.system(f"wget https://huggingface.co/Xenos14/XenoREALITY/resolve/main/XenTAI_v1.safetensors --content-disposition -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/XenTAI_v1.safetensors") |
|
os.system(f"wget https://huggingface.co/Xenos14/TestBed/resolve/main/2024-Real/XenoREALITY-V3.safetensors --content-disposition -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/XenoREALITY-V3.safetensors") |
|
os.system(f"wget https://huggingface.co/Xenos14/TestBed/resolve/main/2024-Gen9/XenoENGINE-ArtStyle-v5.safetensors --content-disposition -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/XenoENGINE-ArtStyle-v5.safetensors") |
|
|
|
|
|
os.system(f"mkdir /home/user/app/stable-diffusion-webui/extensions/sd-dynamic-prompts/wildcards/") |
|
os.system(f"git clone https://huggingface.co/Xenos14/wildcards /home/user/app/stable-diffusion-webui/extensions/sd-dynamic-prompts/wildcards/Xenos") |
|
os.system(f"rm -r -f /home/user/app/stable-diffusion-webui/extensions/sd-dynamic-prompts/wildcards/Xenos/.git") |
|
os.system(f"git clone https://github.com/vorstcavry/embeddings /home/user/app/stable-diffusion-webui/embeddings/negative") |
|
os.system(f"rm -r -f /home/user/app/stable-diffusion-webui/embeddings/negative/.git") |
|
os.system(f"git clone https://huggingface.co/Xenos14/embeddings /home/user/app/stable-diffusion-webui/embeddings/!Xenos") |
|
os.system(f"rm -r -f /home/user/app/stable-diffusion-webui/embeddings/!Xenos/.git") |
|
|
|
os.system(f"mkdir /home/user/app/stable-diffusion-webui/models/Lora/") |
|
os.system(f"git clone https://huggingface.co/Xenos14/Loras /home/user/app/stable-diffusion-webui/models/Lora/Xenos") |
|
os.system(f"rm -r -f /home/user/app/stable-diffusion-webui/models/Lora/Xenos/.git") |
|
|
|
|
|
os.system(f"wget -q https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt -O /home/user/app/stable-diffusion-webui/models/VAE/vae-ft-mse-840000-ema-pruned.ckpt") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
os.system(f"wget -q https://raw.githubusercontent.com/Stability-AI/stablediffusion/main/configs/stable-diffusion/v2-inference-v.yaml -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/v2-1_768-ema-pruned.yaml") |
|
|
|
os.system(f"python launch.py --ui-config-file --disable-console-progressbars --enable-console-prompts --cors-allow-origins huggingface.co,hf.space --no-progressbar-hiding --api --skip-torch-cuda-test --disable-safe-unpickle --skip-torch-cuda-test --no-half --listen --enable-insecure-extension-access") |
|
|
|
|