SovietCat/Stable-Diffusion-2
0
1"""2Stable Diffusion Webui Version 1.7.03https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases/tag/v1.7.04 5"""6 7commit_id=r"cf2772fab0af5573da775e7437e6acdca424f26e" #Version 1.7.08import os9from sys import executable 10import subprocess11import pathlib12import gc13os.system("pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121")14 15def Gitclone(URI:str,ClonePath:pathlib.Path ) -> int :16 if pathlib.Path.exists(ClonePath):17 return 018 for z in range(10):19 i=subprocess.run([r"git",r"clone",str(URI),str(ClonePath)])20 if(i.returncode == 0 ): 21 del i22 return 023 else :24 del i25 raise Exception(str.format("clone \'{0}\' failed",URI))26 27 28def DownLoad(URI:str,DownloadPath:pathlib.Path,DownLoadFileName:str ) -> int:29 if (DownloadPath / DownLoadFileName).is_file(): return 030 for z in range(10):31 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",str(DownloadPath),r"-o",DownLoadFileName,URI]);32 if(i.returncode == 0 ): 33 del i34 gc.collect()35 return 036 else :37 del i38 raise Exception(str.format("download \'{0}\' failed",URI))39 40#user_home =pathlib.Path.home().resolve().joinpath("data")41user_home=pathlib.Path("/data")42os.chdir(str(user_home))43 44#clone stable-diffusion-webui repo45print("cloning stable-diffusion-webui repo")46Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git",user_home / r"stable-diffusion-webui")47os.chdir(str(user_home / r"stable-diffusion-webui"))48os.system("git reset --hard "+commit_id)49#install extensions50print("installing extensions")51Gitclone(r"https://huggingface.co/embed/negative",user_home / r"stable-diffusion-webui" / r"embeddings" / r"negative")52Gitclone(r"https://huggingface.co/embed/lora",user_home / r"stable-diffusion-webui" / r"models" / r"Lora" / r"positive")53DownLoad(r"https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth",user_home / r"stable-diffusion-webui" / r"models" / r"ESRGAN" ,r"4x-UltraSharp.pth")54while (True):55 i=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")])56 if(i.returncode == 0 ): 57 del i58 gc.collect()59 break60 else :61 del i62#Gitclone(r"https://github.com/deforum-art/deforum-for-automatic1111-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"deforum-for-automatic1111-webui" )63Gitclone(r"https://github.com/wcde/custom-hires-fix-for-automatic1111",user_home / r"stable-diffusion-webui" / r"extensions" / r"custom-hires-fix-for-automatic1111" )64Gitclone(r"https://github.com/Coyote-A/ultimate-upscale-for-automatic1111",user_home / r"stable-diffusion-webui" / r"extensions" / r"ultimate-upscale-for-automatic1111" )65Gitclone(r"https://github.com/AlUlkesh/stable-diffusion-webui-images-browser",user_home / r"stable-diffusion-webui" / r"extensions"/ r"stable-diffusion-webui-images-browser")66Gitclone(r"https://github.com/camenduru/stable-diffusion-webui-huggingface",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-huggingface")67# keeping this in case if someone wants to revert to this extension, I guess?68#Gitclone(r"https://github.com/camenduru/sd-civitai-browser",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-civitai-browser")69Gitclone(r"https://github.com/SignalFlagZ/sd-webui-civbrowser",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-civbrowser")70# keeping this in case if someone wants to actually use this extension, I guess?71#Gitclone(r"https://github.com/kohya-ss/sd-webui-additional-networks",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks")72Gitclone(r"https://github.com/Mikubill/sd-webui-controlnet",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-controlnet")73Gitclone(r"https://github.com/mcmonkeyprojects/sd-dynamic-thresholding.git",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-dynamic-thresholding")74# the following four are disabled because of issues breaking the whole thing, and since75# these extensions are beyond my control anyway, these will be all disabled for the time being76# until their respective authors fixes these issues. deal with it, folks.77#Gitclone(r"https://github.com/fkunn1326/openpose-editor",user_home / r"stable-diffusion-webui" / r"extensions" / r"openpose-editor")78#Gitclone(r"https://github.com/wywywywy/sd-webui-depth-lib",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-depth-lib")79#Gitclone(r"https://github.com/hnmr293/posex",user_home / r"stable-diffusion-webui" / r"extensions" / r"posex")80#Gitclone(r"https://github.com/nonnonstop/sd-webui-3d-open-pose-editor",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-3d-open-pose-editor")81#中文本地化的请解除下一行的注释82#Gitclone(r"https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN.git",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-localization-zh_CN")83Gitclone(r"https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git" , user_home / r"stable-diffusion-webui" / r"extensions" / r"a1111-sd-webui-tagcomplete")84#Gitclone(r"https://github.com/camenduru/sd-webui-tunnels",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-tunnels")85Gitclone(r"https://github.com/etherealxx/batchlinks-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"batchlinks-webui")86Gitclone(r"https://github.com/Iyashinouta/sd-model-downloader",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-model-downloader")87#Gitclone(r"https://github.com/catppuccin/stable-diffusion-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-catppuccin")88#Gitclone(r"https://github.com/Bing-su/adetailer",user_home / r"stable-diffusion-webui" / r"extensions" / r"adetailer")89#Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-rembg")90#Gitclone(r"https://github.com/ashen-sensored/stable-diffusion-webui-two-shot",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-two-shot")91#Gitclone(r"https://github.com/camenduru/sd_webui_stealth_pnginfo",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd_webui_stealth_pnginfo")92 93# ==cursed extensions one should not install at all==94# this list is here just so anybody who's messing around with95# the code should not install one of the following, because it96# might cause issues on a space that'll be impossible to recover 97# without reduplicating the space to comment out a problematic98# extension in question.99# failure to read the following above would be quite devastated100# to someone who has no idea what is even causing issues at all.101 102#Gitclone(r"https://github.com/BlafKing/sd-civitai-browser-plus",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-civitai-browser-plus")103 104os.chdir(user_home / r"stable-diffusion-webui")105#download ControlNet models106print("extensions dolwnload done .\ndownloading ControlNet models")107dList =[r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors",108 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors",109 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors",110 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors",111 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors",112 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors",113 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors",114 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors",115 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors",116 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors",117 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors",118 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors",119 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors",120 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors",121 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml",122 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml",123 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml",124 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml",125 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml",126 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml",127 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml",128 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml",129 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml",130 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml",131 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml",132 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml",133 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml",134 r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml",135 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_style_sd14v1.pth",136 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd14v1.pth",137 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_seg_sd14v1.pth",138 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_openpose_sd14v1.pth",139 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_keypose_sd14v1.pth",140 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd14v1.pth",141 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd14v1.pth",142 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd15v2.pth",143 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd15v2.pth",144 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd15v2.pth",145 r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_zoedepth_sd15v1.pth"]146for i in range(0,len(dList)): DownLoad(dList[i],user_home / r"stable-diffusion-webui" / r"extensions" / "sd-webui-controlnet" / r"models",pathlib.Path(dList[i]).name)147del dList148#download model 149#you can change model download address here150print("ControlNet models download done.\ndownloading model")151#Stable Diffusion Checkpoint Model152#anything version4.5153DownLoad(r"https://huggingface.co/ckpt/anything-v4.0/resolve/main/anything-v4.5-pruned.ckpt",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"anything-v4.5-pruned.ckpt")154DownLoad(r"https://huggingface.co/ckpt/anything-v4.0/resolve/main/anything-v4.0.vae.pt",user_home / r"stable-diffusion-webui" / r"models" / r"VAE",r"anything-v4.0.vae.pt")155#anythingV5-Ink156DownLoad(r"https://civitai.com/api/download/models/90854",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"AnythingV5Ink_ink.safetensors")157#MeinaMixV11158DownLoad(r"https://civitai.com/api/download/models/119057",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"meinamix_meinaV11.safetensors")159 160# ==optional checkpoint models (and misc stuff)==161# by default, none of them are installed (mainly because of storage space reasons),162# unless you uncomment one of them just to actually use them.163# some of them generate 3d-like images, and may or may not actually generate164# 2d images than the least you'd most expect.165 166#CounterfeitV3167#DownLoad(r"https://huggingface.co/gsdf/Counterfeit-V3.0/resolve/main/Counterfeit-V3.0_fp16.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"Counterfeit-V3.0_fp16.safetensors")168#AbyssOrangeMix2 sfw169#DownLoad(r"https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix2/AbyssOrangeMix2_sfw.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"AbyssOrangeMix2_sfw.safetensors")170#DownLoad(r"https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt",user_home / r"stable-diffusion-webui" / r"models" / r"VAE",r"orangemix.vae.pt")171#DreamShaper version 8172DownLoad(r"https://civitai.com/api/download/models/128713",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"dreamshaper_8.safetensors")173#XXMix_9realistic (v4.0)174#DownLoad(r"https://civitai.com/api/download/models/102222",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"xxmix9realistic_v40.safetensors")175#MeinaPastel versions 5 and 6176#DownLoad(r"https://civitai.com/api/download/models/108289",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"meinapastel_v6Pastel.safetensors")177#DownLoad(r"https://huggingface.co/Meina/MeinaPastel/resolve/main/MeinaPastelV5%20-%20Baked%20VAE.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"MeinaPastelV5_BakedVAE.safetensors")178#DownLoad(r"https://huggingface.co/Meina/MeinaPastel/resolve/main/MeinaPastelV5%20-%20Without%20VAE.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"MeinaPastelV5_WithoutVAE.safetensors")179#tb_zANIME+mix180#DownLoad(r"https://civitai.com/api/download/models/197115",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"tbZanimeMix_v10.safetensors")181#MMT5182#DownLoad(r"https://civitai.com/api/download/models/160277",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"mmt5_v3.safetensors")183#AingDiffusion184#DownLoad(r"https://civitai.com/api/download/models/314508",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"aingdiffusion_v155.safetensors")185#DownLoad(r"https://civitai.com/api/download/models/249329",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"aingdiffusion_v13.safetensors")186#Sweet-mix version2.2(flat) (with blessed2 VAE included)187#DownLoad(r"https://civitai.com/api/download/models/158294",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"sweetMix_v22Flat.safetensors")188#DownLoad(r"https://civitai.com/api/download/models/121302",user_home / r"stable-diffusion-webui" / r"models" / r"VAE",r"blessed2_v1.pt")189#AnyLoRA190#DownLoad(r"https://civitai.com/api/download/models/95489",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"anyloraCheckpoint_bakedvaeBlessedFp16.safetensors")191#Anime Dreamer Mixed192DownLoad(r"https://civitai.com/api/download/models/221305",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"animeDreamerMixed_v10.safetensors")193#Sevan Mix194#DownLoad(r"https://civitai.com/api/download/models/226816",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"sevanMix_v10.safetensors")195#Laridae and Paridae196DownLoad(r"https://civitai.com/api/download/models/244516",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"laridaeV1_chlidonias.safetensors")197DownLoad(r"https://civitai.com/api/download/models/239663",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"paridaeV1_baeolophus.safetensors")198#CalicoMix FlatAni199#DownLoad(r"https://civitai.com/api/download/models/297382",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"calicomixFlatani_v10.safetensors")200#Yntec's checkpoint models that has the word dream on it (yeah, not a good title for this, but whatever)201#DownLoad(r"https://huggingface.co/Yntec/Dreamsphere/resolve/main/dreamsphere.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"dreamsphere.safetensors")202#DownLoad(r"https://huggingface.co/Yntec/dreamlike-photoreal-remix/resolve/main/dreamlike-photoreal-remix.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"dreamlike-photoreal-remix.safetensors")203#DownLoad(r"https://huggingface.co/Yntec/DreamLikeRemix/resolve/main/dreamLikeRemix.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"dreamLikeRemix.safetensors")204#DownLoad(r"https://huggingface.co/Yntec/Dreamlike/resolve/main/Dreamlike.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"Dreamlike.safetensors")205#DownLoad(r"https://huggingface.co/Yntec/Photosphere/resolve/main/photosphere.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"photosphere.safetensors")206 207#MasterVae208#DownLoad(r"https://civitai.com/api/download/models/141727",user_home / r"stable-diffusion-webui" / r"models" / r"VAE",r"mastervae_v1Pt.pt")209 210# ==Stable Diffusion XL-based checkpoint models==211# by default, these are commented out, since they don't work212# at all if one were to use them on a CPU-powered space... this213# is why all of them in this section are not uncommented out214# because of hardware related issues. Works if they are215# run on a GPU, but not if it's CPU-powered.216 217#Counterfeit-xl218#DownLoad(r"https://huggingface.co/ckpt/counterfeit-xl/resolve/main/counterfeitxl_v10.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"counterfeitxl_v10.safetensors")219#Animagine-xl220#DownLoad(r"https://huggingface.co/ckpt/animagine-xl/resolve/main/animagineXL_v10.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"animagineXL_v10.safetensors")221#Animagine XL V3222#DownLoad(r"https://civitai.com/api/download/models/293564",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"animagineXLV3_v30.safetensors")223#DreamShaper XL224#DownLoad(r"https://civitai.com/api/download/models/126688",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"dreamshaperXL_alpha2Xl10.safetensors")225#XXMix_9realisticSDXL226#DownLoad(r"https://civitai.com/api/download/models/163192",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"xxmix9realisticsdxl_v10.safetensors")227#AAM XL (Anime Mix)228#DownLoad(r"https://civitai.com/api/download/models/303526",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"aamXLAnimeMix_v10.safetensors")229 230#Lora Model231#Better Light232#DownLoad(r"https://civitai.com/api/download/models/39885",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"Better_light.safetensors")233#DownLoad(r"https://civitai.com/api/download/models/39885",user_home / r"stable-diffusion-webui" / r"models" / r"Lora",r"Better_light.safetensors")234#Detail Tweaker LoRA235#DownLoad(r"https://civitai.com/api/download/models/62833",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"add_detail.safetensors")236#DownLoad(r"https://civitai.com/api/download/models/62833",user_home / r"stable-diffusion-webui" / r"models" / r"Lora",r"add_detail.safetensors")237#Add More Details - Detail Enhancer / Tweaker238#DownLoad(r"https://civitai.com/api/download/models/87153",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"more_details.safetensors")239#DownLoad(r"https://civitai.com/api/download/models/87153",user_home / r"stable-diffusion-webui" / r"models" / r"Lora",r"more_details.safetensors")240#Backlighting241#DownLoad(r"https://civitai.com/api/download/models/39164",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"backlighting.safetensors")242#DownLoad(r"https://civitai.com/api/download/models/39164",user_home / r"stable-diffusion-webui" / r"models" / r"Lora",r"backlighting.safetensors")243 244# ==optional lora models (and misc stuff)==245# by default, none of them are installed (mainly because of storage space reasons),246# unless you uncomment one of them just to actually use them.247 248# ==weird fact==249# Turns out that A1111 seem to be case sensitive about the first letter being an uppercase,250# which may explain the reason why it's not showing up in the Lora tab.251# I'm wondering why the additional networks extension had to be installed because of252# some issue the original author had to deal with, something they never bothered253# to fix, for whatever reason.254 255#LAS256#DownLoad(r"https://civitai.com/api/download/models/21065",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"LAS.safetensors")257#DownLoad(r"https://civitai.com/api/download/models/21065",user_home / r"stable-diffusion-webui" / r"models" / r"Lora",r"LAS.safetensors")258 259#GFPGAN Model260#detection Resnet50261#DownLoad(r"https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"detection_Resnet50_Final.pth")262#parsing_parsenet263#DownLoad(r"https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"parsing_parsenet.pth")264#GFPGANv1.4265#DownLoad(r"https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"GFPGANv1.4.pth")266#strt Stable Diffusion Webui267print("Done\nStarting Webui...")268os.chdir(user_home / r"stable-diffusion-webui")269gc.collect()270 271# ==CPU Option==272# this is the default startup setting if you're not planning to273# run your duplicated space on a GPU.274# if you are planning to run your duplicated space on275# CPU upgrade, this default startup setting is pretty much276# enough as it gets, since it's more or less the same as the277# the other option, albeit a faster processor and more system RAM...278# yeah, that's supported, so it's fine I guess.279"""280while True:281 ret=subprocess.run([executable ,user_home / r"stable-diffusion-webui" / 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")])282 if(ret.returncode == 0 ): 283 del ret284 gc.collect()285 else :286 del ret287del os ,user_home ,pyexecutable ,subprocess288"""289# ==GPU Option (UNTESTED)==290# if you are planning to run your duplicated space on a GPU, you must291# first comment out the default startup setting above this message292# to do so, and then after that, uncomment this below that is commented293# out by default in order to make the most out of it, if this is294# going to run on a GPU.295#296# do not use this option if the space is running on297# CPU upgrade, instead, use the default option above if you are298# planning to run your duplicated space on CPU upgrade.299#300# do not leave the former uncommented if you are going to301# uncomment the other startup option in case if you're running302# it on a GPU. You must pick one option, but not both at the303# same time, because it might cause issues and/or runtime304# errors in that case.305#306# if there's any issues and/or errors for this option below,307# be sure to report any issues about this option or maybe 308# at least give feedback on this anyway, because it's not309# really tested that much at the moment.310 311print(os.listdir(str(user_home)+"/stable-diffusion-webui"))312while True:313 ret=subprocess.run([executable ,user_home / r"stable-diffusion-webui" / r"launch.py",r"--xformers",r"--api",r"--enable-insecure-extension-access",r"--skip-torch-cuda-test",r"--enable-console-prompts",r"--ui-settings-file="+str(pathlib.Path(__file__).parent /r"config.json")])314 if(ret.returncode == 0 ): 315 del ret316 gc.collect()317 else :318 del ret319del os ,user_home ,pyexecutable ,subprocess