From 2055a2622e0a4bd60a3217f58932c6089bdefd90 Mon Sep 17 00:00:00 2001 From: Tony Salomone Date: Wed, 21 Feb 2024 22:29:27 -0500 Subject: [PATCH] Fix init.sh to load requirements properly if not run in the api directory --- init.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init.sh b/init.sh index b8094c9..ecfe4ca 100755 --- a/init.sh +++ b/init.sh @@ -2,6 +2,9 @@ # -e: Exit immediately on error. -u: treat unset variables as an error and exit immediately. set -eu +# Need the directory of this script to reference other files +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + OS=$(uname -s) ARCH=$(uname -m) @@ -82,13 +85,13 @@ if [ "$HAS_GPU" = true ] ; then echo "Installing requirements:" # Install the python requirements - pip install -r requirements.txt + pip install -r $SCRIPT_DIR/requirements.txt else echo "No NVIDIA GPU detected drivers detected. Install NVIDIA drivers to enable GPU support." echo "https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#pre-installation-actions" echo "Installing Tranformer Lab requirements without GPU support" - pip install -r requirements-no-gpu.txt + pip install -r $SCRIPT_DIR/requirements-no-gpu.txt fi # Deactivate the environment when done