Skip to content

Commit

Permalink
update run script
Browse files Browse the repository at this point in the history
  • Loading branch information
ifsheldon committed Nov 23, 2023
1 parent d495c79 commit 6418896
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions run_webui.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/zsh

# Default values
CUDA_VISIBLE_DEVICES=""
CUDA_VISIBLE_DEVICES="0" # Set default GPU to 0
EXPECTED_PYTHON_PATH="/home/jenson/miniforge3/bin/python"
PORT=""
ENABLE_PLUGIN_INSTALL=false # Flag to track plugin installation option

# Function to validate if a string is an integer
is_valid_integer() {
Expand All @@ -26,16 +27,20 @@ while [[ $# -gt 0 ]]; do
exit 1
fi
;;
--enable-plugin-install)
ENABLE_PLUGIN_INSTALL=true
shift
;;
*)
echo "Invalid option: $1"
exit 1
;;
esac
done

# Check if required options are provided
if [ -z "$CUDA_VISIBLE_DEVICES" ] || [ -z "$PORT" ]; then
echo "Error: Required options --gpu and --port are missing."
# Check if required option --port is provided
if [ -z "$PORT" ]; then
echo "Error: Required option --port is missing."
exit 1
fi

Expand All @@ -51,19 +56,24 @@ if [ "$current_python_path" != "$EXPECTED_PYTHON_PATH" ]; then
exit 1
fi

# Check proxy
# Set proxy
export http_proxy="http://host.docker.internal:9910";
export https_proxy="http://host.docker.internal:9910";
export HTTP_PROXY="http://host.docker.internal:9910";
export HTTPS_PROXY="http://host.docker.internal:9910";
export ALL_PROXY="http://host.docker.internal:9910";
echo "Using proxy ${http_proxy}"

# Set TCMalloc
# Set TCMalloc
export TCMALLOC="$(PATH=/usr/sbin:$PATH ldconfig -p | grep -Po "libtcmalloc(_minimal|)\.so\.\d" | head -n 1)"
export LD_LIBRARY_PATH="/home/jenson/miniforge3/lib/python3.10/site-packages/tensorrt_libs:$LD_LIBRARY_PATH"
# Use TCMalloc
echo "Using TCMalloc ${TCMALLOC}"
export LD_PRELOAD="${TCMALLOC}"

python launch.py --listen --enable-insecure-extension-access --xformers --port $PORT
# Launch command with conditional insecure extension access flag
if $ENABLE_PLUGIN_INSTALL; then
python launch.py --listen --enable-insecure-extension-access --xformers --port $PORT
else
python launch.py --listen --xformers --port $PORT
fi

0 comments on commit 6418896

Please sign in to comment.