Skip to content

Commit 919c8a7

Browse files
committed
update run file to be used in container
1 parent 26cfacb commit 919c8a7

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

run_comfyui.sh

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
#!/usr/bin/zsh
22

33
# Default values
4-
CUDA_DEVICE=""
5-
EXPECTED_PYTHON_PATH="/home/ai/mambaforge/envs/comfyui/bin/python"
4+
CUDA_DEVICE="0"
5+
EXPECTED_PYTHON_PATH="/home/jenson/miniforge3/bin/python"
6+
PORT=""
7+
8+
# Function to validate if a string is an integer
9+
is_valid_integer() {
10+
[[ "$1" =~ ^[0-9]+$ ]]
11+
}
612

713
# Parse command-line options
814
while [[ $# -gt 0 ]]; do
915
case "$1" in
10-
--gpu)
11-
CUDA_DEVICE="$2"
12-
shift 2
16+
--port)
17+
if is_valid_integer "$2"; then
18+
PORT="$2"
19+
shift 2
20+
else
21+
echo "Error: Invalid port number specified."
22+
exit 1
23+
fi
1324
;;
1425
*)
1526
echo "Invalid option: $1"
@@ -18,14 +29,7 @@ while [[ $# -gt 0 ]]; do
1829
esac
1930
done
2031

21-
# Check if required options are provided
22-
if [ -z "$CUDA_DEVICE" ] ; then
23-
echo "Error: Required options --gpu are missing."
24-
exit 1
25-
fi
26-
27-
28-
source /home/ai/mambaforge/bin/activate comfyui
32+
source /home/jenson/miniforge3/bin/activate
2933

3034
# Check python path
3135
current_python_path=$(which python)
@@ -35,10 +39,10 @@ if [ "$current_python_path" != "$EXPECTED_PYTHON_PATH" ]; then
3539
fi
3640

3741
# Set proxy
38-
export http_proxy="http://localhost:9910" https_proxy="http://localhost:9910" HTTP_PROXY="http://localhost:9910" HTTPS_PROXY="http://localhost:9910"
42+
export http_proxy="http://host.docker.internal:9910" https_proxy="http://host.docker.internal:9910" HTTP_PROXY="http://host.docker.internal:9910" HTTPS_PROXY="http://host.docker.internal:9910"
3943
echo "Using proxy ${http_proxy}"
4044

4145
# Set TensorRT
42-
export LD_LIBRARY_PATH="/home/ai/mambaforge/envs/comfyui/lib/python3.10/site-packages/tensorrt_libs:$LD_LIBRARY_PATH"
46+
export LD_LIBRARY_PATH="/home/jenson/miniforge3/lib/python3.10/site-packages/tensorrt_libs:$LD_LIBRARY_PATH"
4347

44-
python main.py --listen --port 8188 --cuda-device "$CUDA_DEVICE"
48+
python main.py --listen --port $PORT --cuda-device "$CUDA_DEVICE"

0 commit comments

Comments
 (0)