-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathstart3.sh
51 lines (41 loc) · 1.47 KB
/
start3.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
#!/bin/bash
if [ ! -d "Fooocus" ]; then
git clone https://github.com/lllyasviel/Fooocus.git
fi
cd Fooocus
git pull
if [ ! -L ~/.conda/envs/fooocus ]; then
ln -s /tmp/fooocus ~/.conda/envs/
fi
eval "$(conda shell.bash hook)"
if [ ! -d /tmp/fooocus ]; then
mkdir /tmp/fooocus
conda env create -f environment.yaml
conda activate fooocus
pip install -r requirements_versions.txt
pip install torch torchvision --force-reinstall --index-url https://download.pytorch.org/whl/cu117
conda install glib -y
rm -rf ~/.cache/pip
fi
# Setup the path for model checkpoints
current_folder=$(pwd)
model_folder=${current_folder}/models/checkpoints-real-folder
if [ ! -e config.txt ]; then
json_data="{ \"path_checkpoints\": \"$model_folder\" }"
echo "$json_data" > config.txt
echo "JSON file created: config.txt"
else
echo "Updating config.txt to use checkpoints-real-folder"
jq --arg new_value "$model_folder" '.path_checkpoints = $new_value' config.txt > config_tmp.txt && mv config_tmp.txt config.txt
fi
# If the checkpoints folder exists, move it to the new checkpoints-real-folder
if [ ! -L models/checkpoints ]; then
mv models/checkpoints models/checkpoints-real-folder
ln -s models/checkpoints-real-folder models/checkpoints
fi
# Activate the fooocus environment
conda activate fooocus
cd ..
lt --port 7865 & wget -q -O - https://loca.lt/mytunnelpassword
# Run Python script in the background
python Fooocus/entry_with_update.py --always-high-vram &