55# This source code is licensed under the BSD-style license found in the
66# LICENSE file in the root directory of this source tree.
77
8+ set -eou pipefail
9+
810# Install required python dependencies for developing
911# Dependencies are defined in .pyproject.toml
10- if [[ -z $PYTHON_EXECUTABLE ]];
12+ PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE:- python}
13+ if [[ -z ${CONDA_DEFAULT_ENV:- } ]] || [[ ${CONDA_DEFAULT_ENV:- } == " base" ]] || [[ ! -x " $( command -v python) " ]];
1114then
12- if [[ -z $CONDA_DEFAULT_ENV ]] || [[ $CONDA_DEFAULT_ENV == " base" ]] || [[ ! -x " $( command -v python) " ]];
13- then
14- PYTHON_EXECUTABLE=python3
15- else
16- PYTHON_EXECUTABLE=python
17- fi
15+ PYTHON_EXECUTABLE=python3
1816fi
1917
2018# Check python version. Expect 3.10.x or 3.11.x
3735# newer version of torch nightly installed later in this script.
3836#
3937
40- $PIP_EXECUTABLE install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/nightly/cu121
38+ (
39+ set -x
40+ $PIP_EXECUTABLE install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/nightly/cu121
41+ )
4142
4243# Since torchchat often uses main-branch features of pytorch, only the nightly
4344# pip versions will have the required features. The NIGHTLY_VERSION value should
@@ -49,7 +50,10 @@ $PIP_EXECUTABLE install -r requirements.txt --extra-index-url https://download.p
4950NIGHTLY_VERSION=dev20240710
5051
5152# Uninstall triton, as nightly will depend on pytorch-triton, which is one and the same
52- $PIP_EXECUTABLE uninstall -y triton
53+ (
54+ set -x
55+ $PIP_EXECUTABLE uninstall -y triton
56+ )
5357
5458# The pip repository that hosts nightly torch packages. cpu by default.
5559# If cuda is available, based on presence of nvidia-smi, install the pytorch nightly
@@ -68,12 +72,21 @@ REQUIREMENTS_TO_INSTALL=(
6872
6973# Install the requirements. `--extra-index-url` tells pip to look for package
7074# versions on the provided URL if they aren't available on the default URL.
71- $PIP_EXECUTABLE install --extra-index-url " ${TORCH_NIGHTLY_URL} " \
75+ (
76+ set -x
77+ $PIP_EXECUTABLE install --extra-index-url " ${TORCH_NIGHTLY_URL} " \
7278 " ${REQUIREMENTS_TO_INSTALL[@]} "
79+ )
7380
7481# For torchao need to install from github since nightly build doesn't have macos build.
7582# TODO: Remove this and install nightly build, once it supports macos
76- $PIP_EXECUTABLE install git+https://github.com/pytorch/ao.git@d36de1b144b73bf753bd082109c2b5d0141abd5b
83+ (
84+ set -x
85+ $PIP_EXECUTABLE install git+https://github.com/pytorch/ao.git@d36de1b144b73bf753bd082109c2b5d0141abd5b
86+ )
7787if [[ -x " $( command -v nvidia-smi) " ]]; then
78- $PYTHON_EXECUTABLE scripts/patch_triton.py
88+ (
89+ set -x
90+ $PYTHON_EXECUTABLE scripts/patch_triton.py
91+ )
7992fi
0 commit comments