|
import os |
|
from sys import executable as pyexecutable |
|
import subprocess |
|
import pathlib |
|
import gc |
|
|
|
def Gitclone(URI:str,ClonePath:str = "") -> int : |
|
if(ClonePath == "") : |
|
while True: |
|
i=subprocess.run([r"git",r"clone",URI]) |
|
if(i.returncode == 0 ): |
|
del i |
|
gc.collect() |
|
return 0 |
|
else : |
|
del i |
|
else: |
|
while True: |
|
i=subprocess.run([r"git",r"clone",URI,ClonePath]) |
|
if(i.returncode == 0 ): |
|
del i |
|
gc.collect() |
|
return 0 |
|
else : |
|
del i |
|
def DownLoad(URI:str,DownloadPath:str,DownLoadFileName:str ) -> int: |
|
while (True): |
|
i=subprocess.run([r"aria2c",r"-c",r"-x" ,r"16", r"-s",r"16", r"-k" ,r"1M" ,r"-m",r"0",r"--enable-mmap=false",r"--console-log-level=error",r"-d",DownloadPath,r"-o",DownLoadFileName,URI]); |
|
if(i.returncode == 0 ): |
|
del i |
|
gc.collect() |
|
return 0 |
|
else : |
|
del i |
|
user_home =pathlib.Path.home().resolve() |
|
os.chdir(str(user_home)) |
|
|
|
print("cloning stable-diffusion-webui repo") |
|
Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git",str(user_home / r"stable-diffusion-webui")) |
|
os.chdir(str(user_home / r"stable-diffusion-webui")) |
|
os.system("git reset --hard 89f9faa63388756314e8a1d96cf86bf5e0663045") |
|
|
|
|
|
|
|
print("installing extensions") |
|
Gitclone(r"https://huggingface.co./embed/negative",str(user_home / r"stable-diffusion-webui" / r"embeddings" / r"negative")) |
|
Gitclone(r"https://huggingface.co./embed/lora",str(user_home / r"stable-diffusion-webui" / r"models" / r"Lora" / r"positive")) |
|
DownLoad(r"https://huggingface.co./embed/upscale/resolve/main/4x-UltraSharp.pth",str(user_home / r"stable-diffusion-webui" / r"models" / r"ESRGAN") ,r"4x-UltraSharp.pth") |
|
while True: |
|
if(subprocess.run([r"wget",r"https://raw.githubusercontent.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py",r"-O",str(user_home / r"stable-diffusion-webui" / r"scripts" / r"run_n_times.py")]).returncode == 0): |
|
break |
|
|
|
|
|
Gitclone(r"https://github.com/camenduru/stable-diffusion-webui-huggingface",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-huggingface")) |
|
|
|
Gitclone(r"https://github.com/etherealxx/batchlinks-webui",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"batchlinks-webui")) |
|
Gitclone(r"https://github.com/kohya-ss/sd-webui-additional-networks",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks")) |
|
Gitclone(r"https://github.com/Akegarasu/sd-webui-model-converter",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-model-converter")) |
|
Gitclone(r"https://github.com/hako-mikan/sd-webui-supermerger",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-supermerger")) |
|
Gitclone(r"https://github.com/BlafKing/sd-civitai-browser-plus",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-civitai-browser-plus" )) |
|
Gitclone(r"https://github.com/bbc-mc/sdweb-merge-block-weighted-gui",str(user_home / r"stable-diffusion-webui" / r"extensions"/ r"sdweb-merge-block-weighted-gui")) |
|
|
|
|
|
|
|
Gitclone(r"https://github.com/jexom/sd-webui-depth-lib",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-depth-lib")) |
|
Gitclone(r"https://github.com/hnmr293/posex",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"posex")) |
|
|
|
|
|
|
|
|
|
Gitclone(r"https://github.com/camenduru/sd-webui-tunnels",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-tunnels")) |
|
|
|
Gitclone(r"https://github.com/catppuccin/stable-diffusion-webui",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-catppuccin")) |
|
|
|
|
|
|
|
|
|
|
|
|
|
os.chdir(user_home / r"stable-diffusion-webui") |
|
|
|
|
|
print("extensions dolwnload done .\ndownloading ControlNet models") |
|
dList =[r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_style_sd14v1.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd14v1.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_seg_sd14v1.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_openpose_sd14v1.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_keypose_sd14v1.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd14v1.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd14v1.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd15v2.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd15v2.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd15v2.pth", |
|
r"https://huggingface.co./ckpt/ControlNet-v1-1/resolve/main/t2iadapter_zoedepth_sd15v1.pth"] |
|
for i in range(0,len(dList)): DownLoad(dList[i],str(user_home / "stable-diffusion-webui" / "extensions" / "sd-webui-controlnet" / "models"),pathlib.Path(dList[i]).name) |
|
del dList |
|
|
|
|
|
|
|
print("ControlNet models download done.\ndownloading model") |
|
|
|
DownLoad(r"https://huggingface.co./Yntec/DucHaitenClassicAnime768/resolve/main/duchaitenclassicanimv10VAE.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"duchaitenclassicanimv10VAE.safetensors") |
|
DownLoad(r"https://huggingface.co./DucHaiten/DucHaitenAIart/resolve/main/DucHaitenAIart-v4.5.3.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"DucHaitenAIart-v4.5.3.safetensors") |
|
DownLoad(r"https://huggingface.co./DucHaiten/DucHaitenDreamWorld/resolve/main/DucHaitenDreamWorld_v3.0.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"DucHaitenDreamWorld_v3.0.safetensors") |
|
DownLoad(r"https://huggingface.co./DucHaiten/DucHaitenJourney/resolve/main/DucHaiten-Journey_v5.6.7.2.3.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"DucHaiten-Journey_v5.6.7.2.3.safetensors") |
|
DownLoad(r"https://huggingface.co./DucHaiten/DucHaiten-StyleLikeMe/resolve/main/DucHaiten-StyleLikeMe_v1.5-fp16-no-ema.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"DucHaiten-StyleLikeMe_v1.5-fp16-no-ema.safetensors") |
|
DownLoad(r"https://huggingface.co./DucHaiten/DucHaitenSuperCute/resolve/main/DucHaitenSuperCute_v2.0.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"DucHaitenSuperCute_v2.0.safetensors") |
|
DownLoad(r"https://huggingface.co./Yntec/DucHaitenAnime768/resolve/main/DucHaitenAnimefp16noema.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"DucHaitenAnimefp16noema.safetensors") |
|
|
|
|
|
|
|
print("Done\nStarting Webui...") |
|
os.chdir(user_home / r"stable-diffusion-webui") |
|
while True: |
|
ret=subprocess.run([r"python3" ,r"launch.py",r"--precision",r"full",r"--no-half",r"--no-half-vae",r"--enable-insecure-extension-access",r"--medvram",r"--skip-torch-cuda-test",r"--enable-console-prompts",r"--ui-settings-file="+str(pathlib.Path(__file__).parent /r"config.json")]) |
|
if(ret.returncode == 0 ): |
|
del ret |
|
gc.collect() |
|
else : |
|
del ret |
|
|
|
del os ,user_home ,pyexecutable ,subprocess |