File size: 1,519 Bytes
8d1ad8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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