Fix #2 to help with testing packages

This commit is contained in:
Ashwin Bharambe 2024-08-08 13:05:47 -07:00
parent 83adaae09b
commit 6441b78aac

View file

@ -8,7 +8,7 @@
LLAMA_MODELS_DIR=${LLAMA_MODELS_DIR:-} LLAMA_MODELS_DIR=${LLAMA_MODELS_DIR:-}
LLAMA_TOOLCHAIN_DIR=${LLAMA_TOOLCHAIN_DIR:-} LLAMA_TOOLCHAIN_DIR=${LLAMA_TOOLCHAIN_DIR:-}
USE_TEST_PYPI=${USE_TEST_PYPI:-} TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
set -euo pipefail set -euo pipefail
@ -57,40 +57,40 @@ ensure_conda_env_python310() {
eval "$(conda shell.bash hook)" eval "$(conda shell.bash hook)"
conda deactivate && conda activate "${env_name}" conda deactivate && conda activate "${env_name}"
PIP_ARGS="" if [ -n "$TEST_PYPI_VERSION" ]; then
if [ "$USE_TEST_PYPI" = "1" ]; then
# these packages are damaged in test-pypi, so install them first # these packages are damaged in test-pypi, so install them first
pip install fastapi libcst pip install fastapi libcst
PIP_ARGS="--extra-index-url https://test.pypi.org/simple/" pip install --extra-index-url https://test.pypi.org/simple/ llama-toolchain==$TEST_PYPI_VERSION $pip_dependencies
fi
# Re-installing llama-toolchain in the new conda environment
if [ -n "$LLAMA_TOOLCHAIN_DIR" ]; then
if [ ! -d "$LLAMA_TOOLCHAIN_DIR" ]; then
echo -e "${RED}Warning: LLAMA_TOOLCHAIN_DIR is set but directory does not exist: $LLAMA_TOOLCHAIN_DIR${NC}" >&2
exit 1
fi
echo "Installing from LLAMA_TOOLCHAIN_DIR: $LLAMA_TOOLCHAIN_DIR"
pip install -e "$LLAMA_TOOLCHAIN_DIR"
else else
pip install $PIP_ARGS llama-toolchain # Re-installing llama-toolchain in the new conda environment
fi if [ -n "$LLAMA_TOOLCHAIN_DIR" ]; then
if [ ! -d "$LLAMA_TOOLCHAIN_DIR" ]; then
echo -e "${RED}Warning: LLAMA_TOOLCHAIN_DIR is set but directory does not exist: $LLAMA_TOOLCHAIN_DIR${NC}" >&2
exit 1
fi
if [ -n "$LLAMA_MODELS_DIR" ]; then echo "Installing from LLAMA_TOOLCHAIN_DIR: $LLAMA_TOOLCHAIN_DIR"
if [ ! -d "$LLAMA_MODELS_DIR" ]; then pip install -e "$LLAMA_TOOLCHAIN_DIR"
echo -e "${RED}Warning: LLAMA_MODELS_DIR is set but directory does not exist: $LLAMA_MODELS_DIR${NC}" >&2 else
exit 1 pip install $PIP_ARGS llama-toolchain
fi fi
echo "Installing from LLAMA_MODELS_DIR: $LLAMA_MODELS_DIR" if [ -n "$LLAMA_MODELS_DIR" ]; then
pip uninstall -y llama-models if [ ! -d "$LLAMA_MODELS_DIR" ]; then
pip install -e "$LLAMA_MODELS_DIR" echo -e "${RED}Warning: LLAMA_MODELS_DIR is set but directory does not exist: $LLAMA_MODELS_DIR${NC}" >&2
fi exit 1
fi
# Install pip dependencies echo "Installing from LLAMA_MODELS_DIR: $LLAMA_MODELS_DIR"
if [ -n "$pip_dependencies" ]; then pip uninstall -y llama-models
echo "Installing pip dependencies: $pip_dependencies" pip install -e "$LLAMA_MODELS_DIR"
pip install $PIP_ARGS $pip_dependencies fi
# Install pip dependencies
if [ -n "$pip_dependencies" ]; then
echo "Installing pip dependencies: $pip_dependencies"
pip install $PIP_ARGS $pip_dependencies
fi
fi fi
} }