3535#  newer version of torch nightly installed later in this script.
3636# 
3737
38- # (
39- #   set -x
40- #   $PIP_EXECUTABLE install -r install/requirements.txt --extra-index-url https://download.pytorch.org/whl/nightly/cu121
41- # )
42- 
4338(
4439  set  -x
45-   $PIP_EXECUTABLE  install -r install/requirements.txt --extra-index-url https://download.pytorch.org/whl/nightly/xpu 
40+   $PIP_EXECUTABLE  install -r install/requirements.txt --extra-index-url https://download.pytorch.org/whl/nightly/cu121 
4641)
4742
4843#  Since torchchat often uses main-branch features of pytorch, only the nightly
5247#  NOTE: If a newly-fetched version of the executorch repo changes the value of
5348#  PYTORCH_NIGHTLY_VERSION, you should re-run this script to install the necessary
5449#  package versions.
55- PYTORCH_NIGHTLY_VERSION=dev20241001
50+ if  [[ -x  " $( command -v xpu-smi) "   ]]; 
51+ then 
52+   PYTORCH_NIGHTLY_VERSION=dev20241001
53+ else 
54+   PYTORCH_NIGHTLY_VERSION=dev20241002
55+ fi 
5656
5757#  Nightly version for torchvision
5858VISION_NIGHTLY_VERSION=dev20241002
@@ -69,22 +69,34 @@ TUNE_NIGHTLY_VERSION=dev20241010
6969#  The pip repository that hosts nightly torch packages. cpu by default.
7070#  If cuda is available, based on presence of nvidia-smi, install the pytorch nightly
7171#  with cuda for faster execution on cuda GPUs.
72- # if [[ -x "$(command -v nvidia-smi)" ]];
73- # then
74- #   TORCH_NIGHTLY_URL="https://download.pytorch.org/whl/nightly/cu121"
75- # elif [[ -x "$(command -v rocminfo)" ]];
76- # then
77- #   TORCH_NIGHTLY_URL="https://download.pytorch.org/whl/nightly/rocm6.2"
78- # else
79- #   TORCH_NIGHTLY_URL="https://download.pytorch.org/whl/nightly/cpu"
80- # fi
81- TORCH_NIGHTLY_URL=" https://download.pytorch.org/whl/nightly/xpu" 
72+ if  [[ -x  " $( command -v nvidia-smi) "   ]]; 
73+ then 
74+   TORCH_NIGHTLY_URL=" https://download.pytorch.org/whl/nightly/cu121" 
75+ elif  [[ -x  " $( command -v rocminfo) "   ]]; 
76+ then 
77+   TORCH_NIGHTLY_URL=" https://download.pytorch.org/whl/nightly/rocm6.2" 
78+ elif  [[ -x  " $( command -v xpu-smi) "   ]]; 
79+ then 
80+   TORCH_NIGHTLY_URL=" https://download.pytorch.org/whl/nightly/xpu" 
81+ else 
82+   TORCH_NIGHTLY_URL=" https://download.pytorch.org/whl/nightly/cpu" 
83+ fi 
84+ 
8285#  pip packages needed by exir.
83- REQUIREMENTS_TO_INSTALL=(
84-   torch==" 2.6.0.${PYTORCH_NIGHTLY_VERSION} " 
85-   torchvision==" 0.20.0.${VISION_NIGHTLY_VERSION} " 
86-   # torchtune=="0.3.0.${TUNE_NIGHTLY_VERSION}"
87- )
86+ if  [[ -x  " $( command -v xpu-smi) "   ]]; 
87+ then 
88+   REQUIREMENTS_TO_INSTALL=(
89+     torch==" 2.6.0.${PYTORCH_NIGHTLY_VERSION} " 
90+     torchvision==" 0.20.0.${VISION_NIGHTLY_VERSION} " 
91+     torchtune==" 0.3.1" 
92+   )
93+ else 
94+   REQUIREMENTS_TO_INSTALL=(
95+     torch==" 2.6.0.${PYTORCH_NIGHTLY_VERSION} " 
96+     torchvision==" 0.20.0.${VISION_NIGHTLY_VERSION} " 
97+     torchtune==" 0.4.0.${TUNE_NIGHTLY_VERSION} " 
98+   )
99+ fi 
88100
89101#  Install the requirements. --extra-index-url tells pip to look for package
90102#  versions on the provided URL if they aren't available on the default URL.
@@ -94,12 +106,6 @@ REQUIREMENTS_TO_INSTALL=(
94106    " ${REQUIREMENTS_TO_INSTALL[@]} " 
95107)
96108
97- (
98-   set  -x
99-   $PIP_EXECUTABLE  install --extra-index-url " ${TORCH_NIGHTLY_URL} "   \
100-     torchtune==" 0.3.1" 
101- )
102- 
103109(
104110  set  -x
105111  $PIP_EXECUTABLE  install torchao==" 0.5.0" 
0 commit comments