-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_comfy
executable file
·74 lines (54 loc) · 2.17 KB
/
run_comfy
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
71
72
73
74
#!/bin/bash
set -e
fun_echo() {
toilet -w 90 -f term --gay -F border: $1
}
mkdir -p /storage
chmod -R 777 /storage
chmod -R 777 /workspace
toilet ComfyUI -w 90 -f pagga -F border:
mkdir -p /storage/shared_models/
chmod -R 777 /storage/shared_models
yaml="/storage/shared_models/extra_model_paths.yml"
if [ ! -e $yaml ]; then
fun_echo "Sample extra_model_paths.yml has been placed in the shared_models dir."
cp /extra_model_paths.yml /storage/shared_models/extra_model_paths.yml
fi
yaml="/storage/shared_models/extra_downloads.yml"
if [ ! -e $yaml ]; then
fun_echo "Sample extra_models.yml has been placed in the shared_models dir."
cp /extra_downloads.yml /storage/shared_models/extra_downloads.yml
fi
fun_echo "Downloading extra models and custom_nodes from /extra_downloads.yml first then /storage/shared_models/extra_downloads.yml next..."
yaml="/storage/shared_models/extra_downloads.yml"
chmod -R 777 /storage
# Define base directory from YAML file
fun_echo "Checking Model Downloads..."
yaml="/storage/shared_models/extra_downloads.yml"
# Loop over the files and download them
yq e '.files[] | [.path, .url] | join(" ")' $yaml | while read -r line; do
# Read path and url into separate variables
read -r path url <<< "$line"
# Create full path by combining base directory and file path
full_path="${path}"
# Create directory structure if it does not exist
mkdir -p "$(dirname "$full_path")"
# Download the file
wget -nc -O $full_path $url || true
done
fun_echo "Checking Custom Nodes...."
# Handle custom nodes (if needed)
yq e '.custom_nodes[]' $yaml | while read -r repo; do
# Perform actions with the custom node URLs, such as git cloning
repo_name=$(basename "$repo" .git)
repo_dir="/workspace/ComfyUI/custom_nodes/${repo_name}"
if [ ! -d "$repo_dir" ]; then
# Directory does not exist, so clone the repository
git clone "$repo" "$repo_dir"
else
# Directory exists, so just fetch the latest changes without checkout
git -C "$repo_dir" fetch --all
fi
done
fun_echo "Starting ComfyUI..."
cd /workspace/ComfyUI && python main.py --listen 0.0.0.0 --extra-model-paths-config /storage/shared_models/extra_model_paths.yml --disable-xformers