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.16/xformers-0.0.16+814314d.d20230118-cp38-cp38-linux_x86_64.whl") elif("T4" in gpu_info): os.system(f"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") # os.system(f"git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git /home/user/app/stable-diffusion-webui") # os.chdir("/home/user/app/stable-diffusion-webui") # Mount our drive from google.colab import drive drive.mount('/content/drive') # Create a folder for storing files os.system(f"mkdir sd-webui-files") os.chdir("sd-webui-files") # # Clone SD WebUI from AUTOMATIC1111's repo # os.system(f"git clone --depth=1 https://github.com/AUTOMATIC1111/stable-diffusion-webui.git sd-webui-files/stable-diffusion-webui") # # Download checkpoint models to /stable-diffusion-webui/models/Stable-diffusion # !wget -nc -P /content/drive/MyDrive/sd-webui-files/stable-diffusion-webui/models/Stable-diffusion https://huggingface.co/andite/anything-v4.0/resolve/main/anything-v4.5-pruned.safetensors # # Fix change branch issues # %cd /content/drive/MyDrive/sd-webui-files/stable-diffusion-webui/ # !git reset --hard # !git pull # !sed -i -e 's/checkout {commithash}/checkout --force {commithash}/g' launch.py # Launch WebUI