-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_comfyui_dependencies.sh
executable file
·146 lines (127 loc) · 3.67 KB
/
install_comfyui_dependencies.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
set -u
HOME=$(pwd)
# Check if HUGGINGFACE_TOKEN is set
: "${HUGGINGFACE_TOKEN:?Variable HUGGINGFACE_TOKEN is not set}"
# Function to display usage information
usage() {
echo "Usage: $0 [-v|--verbose] [-f|--file <filename>] [-h|--help]"
echo "Options:"
echo " -if, --install_flux Install Flux"
echo " -isa, --install_segment_anything Install Segment anything"
echo " -iad, --install_animate_diff Install Animated diff"
echo " -icg, --install_caption_generation Install Caption Generation"
echo " -r, --run Run Comfy on completion"
echo " -h, --help Display this help message"
}
install_flux=false
install_segment_anything=false
install_animate_diff=false
install_caption_generation=false
run_comfy=false
# Check if no arguments were provided
if [ $# -eq 0 ]; then
usage
exit 1
fi
# Parse command line arguments
while [ $# -gt 0 ]; do
case "$1" in
-if|--install_flux)
install_flux=true
;;
-isa|--install_segment_anything)
install_segment_anything=true
;;
-iad|--install_animate_diff)
install_animate_diff=true
;;
-icg|--install_caption_generation)
install_caption_generation=true
;;
-r|--run)
run_comfy=true
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown option: $1"
usage
exit 1
;;
esac
shift
done
# install ComfyUI
cd $HOME || exit
if [ -d "ComfyUI" ]; then
echo "ComfyUI exists"
else
echo "ComfyUI does not exist"
git clone https://github.com/comfyanonymous/ComfyUI
cd ComfyUI || exit
pip install -r requirements.txt
fi
# copy over settings
cd $HOME || exit
if [ -d "ComfyUI/user/default/" ]; then
echo "ComfyUI has been installed. Copying over settings..."
cp comfy.settings.json ComfyUI/user/default/comfy.settings.json
fi
# copy over assets
if [ -d "ComfyUI/input/" ]; then
echo "ComfyUI has been installed. Copying over assets..."
cp -r assets/* ComfyUI/input/
fi
pip install -U onnxruntime-gpu
## workflows as stored here
## /teamspace/studios/this_studio/ComfyUI/user/default/workflows
# install hugging face command line interface
if command -v huggingface-cli >/dev/null 2>&1; then
echo "huggingface-cli exists"
else
echo "huggingface-cli does not exist"
pip install -U "huggingface_hub[cli]"
cd $HOME || exit
fi
# log into hugging face so we can download flux
huggingface-cli login --token $HUGGINGFACE_TOKEN
# install flux
if ($install_flux); then
cd $HOME || exit
. install/install_flux.sh
fi
# install segment anything
if ($install_segment_anything); then
cd $HOME || exit
. install/install_segment_anything.sh
fi
# install caption generation
cd $HOME || exit
if ($install_caption_generation); then
cd $HOME || exit
. install/install_image_captioning.sh
fi
# install animate diff
cd $HOME || exit
if ($install_animate_diff); then
cd $HOME || exit
. install/install_animate_diff.sh
fi
# install BRIA
cd $HOME || exit
if [ -d "ComfyUI/custom_nodes/ComfyUI-BRIA_AI-RMBG" ]; then
echo "ComfyUI-BRIA_AI-RMBG exists"
else
echo "installing ComfyUI-BRIA_AI-RMBG"
cd ComfyUI/custom_nodes/
git clone https://github.com/ZHO-ZHO-ZHO/ComfyUI-BRIA_AI-RMBG.git
cd $HOME || exit
huggingface-cli download briaai/RMBG-1.4 model.pth --local-dir ComfyUI/custom_nodes/ComfyUI-BRIA_AI-RMBG/RMBG-1.4
fi
# launch using new UI
if ($run_comfy); then
python ComfyUI/main.py --port 8080 --front-end-version Comfy-Org/ComfyUI_frontend@latest
fi