forked from wolverinn/stable-diffusion-multi-user
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
70 lines (69 loc) · 2.82 KB
/
setup.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /usr/bin/env bash
# env
# requires a GPU Linux machine
# needs to be in the same directory as manage.py
# cd to the current directory before executing
# sudo bash setup.sh
if [ $1 == "env" ]; then
# install system packages
apt-get update
apt-get install python3-pip
apt-get install python3-venv
apt-get install apache2
apt-get install libapache2-mod-wsgi-py3
apt-get install libgl1-mesa-glx
apt-get install libglib2.0-0
elif [ $1 == "venv" ]; then
# setup python virtual env and install pip dependancies
python3 -m venv venv
source ./venv/bin/activate
pip3 install django
pip3 install django-cors-headers
pip3 install -r requirements.txt --extra-index-url https://mirrors.aliyun.com/pypi/simple
# python3 ./repositories/CLIP/setup.py install
# python3 ./repositories/open_clip/setup.py install
# pip3 install torch==1.13.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
# pip3 install torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
deactivate
export IGNORE_CMD_ARGS_ERRORS="true"
python3 manage.py makemigrations
python3 manage.py migrate
elif [ $1 == "sd_model" ]; then
# download models
wget -P ./models/Stable-diffusion https://huggingface.co/Hardy01/chill_watcher/resolve/main/models/Stable-diffusion/chilloutmix_NiPrunedFp32Fix.safetensors
wget -P ./models/VAE https://huggingface.co/Hardy01/chill_watcher/resolve/main/models/VAE/vae-ft-mse-840000-ema-pruned.ckpt
wget -P ./models/Lora https://huggingface.co/Hardy01/chill_watcher/resolve/main/models/Lora/koreanDollLikeness_v10.safetensors
wget -P ./models/Lora https://huggingface.co/Hardy01/chill_watcher/resolve/main/models/Lora/taiwanDollLikeness_v10.safetensors
elif [ $1 == "apache" ]; then
# configure apache
cd ..
mv stable-diffusion-multi-user /var/www
cd /var/www/stable-diffusion-multi-user
python3 gen_http_conf.py
cd .. # pwd = /var/www
chgrp -R www-data stable-diffusion-multi-user
chmod -R 644 stable-diffusion-multi-user
find stable-diffusion-multi-user -type d | xargs chmod 755
chmod g+w stable-diffusion-multi-user
chmod g+w -R stable-diffusion-multi-user/venv
chmod g+w db.sqlite3
cd /var # pwd = /var
# 下面两行是因为sd需要在/var/www下创建.cache文件夹进行写入
chgrp www-data www/
chmod g+w www/
service apache2 restart
elif [ $1 == "lb" ]; then
apt-get update
apt-get install python3-pip
apt-get install apache2
apt-get install libapache2-mod-wsgi-py3
python3 -m venv venv
source ./venv/bin/activate
pip3 install django
pip3 install django-cors-headers
pip3 install replicate==0.8.1
python3 gen_http_conf.py
service apache2 restart
else
echo "option required\n options: [env | venv | apache | sd_model | lb]"
fi