Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 5152988

Browse files
authored
Install torchtune on linux (#1130)
* update install_requirement.sh * bring torchao back to all platform * add essential comment
1 parent 5986ed2 commit 5152988

File tree

1 file changed

+43
-11
lines changed

1 file changed

+43
-11
lines changed

install/install_requirements.sh

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,23 @@ fi
4141
)
4242

4343
# Since torchchat often uses main-branch features of pytorch, only the nightly
44-
# pip versions will have the required features. The NIGHTLY_VERSION value should
44+
# pip versions will have the required features. The PYTORCH_NIGHTLY_VERSION value should
4545
# agree with the third-party/pytorch pinned submodule commit.
4646
#
4747
# NOTE: If a newly-fetched version of the executorch repo changes the value of
48-
# NIGHTLY_VERSION, you should re-run this script to install the necessary
48+
# PYTORCH_NIGHTLY_VERSION, you should re-run this script to install the necessary
4949
# package versions.
50-
NIGHTLY_VERSION=dev20240814
50+
PYTORCH_NIGHTLY_VERSION=dev20240814
51+
52+
# Nightly version for torchvision
53+
VISION_NIGHTLY_VERSION=dev20240814
54+
55+
# Nightly version for torchao
56+
AO_NIGHTLY_VERSION=dev20240905
57+
58+
# Nightly version for torchtune
59+
TUNE_NIGHTLY_VERSION=dev20240910
60+
5161

5262
# Uninstall triton, as nightly will depend on pytorch-triton, which is one and the same
5363
(
@@ -67,23 +77,45 @@ fi
6777

6878
# pip packages needed by exir.
6979
REQUIREMENTS_TO_INSTALL=(
70-
torch=="2.5.0.${NIGHTLY_VERSION}"
80+
torch=="2.5.0.${PYTORCH_NIGHTLY_VERSION}"
81+
torchvision=="0.20.0.${VISION_NIGHTLY_VERSION}"
82+
)
83+
84+
LINUX_REQUIREMENTS_TO_INSTALL=(
85+
torchao=="0.5.0.${AO_NIGHTLY_VERSION}"
86+
torchtune=="0.3.0.${TUNE_NIGHTLY_VERSION}"
7187
)
7288

73-
# Install the requirements. `--extra-index-url` tells pip to look for package
89+
# Install the requirements. --extra-index-url tells pip to look for package
7490
# versions on the provided URL if they aren't available on the default URL.
7591
(
7692
set -x
7793
$PIP_EXECUTABLE install --extra-index-url "${TORCH_NIGHTLY_URL}" \
7894
"${REQUIREMENTS_TO_INSTALL[@]}"
7995
)
8096

81-
# For torchao need to install from github since nightly build doesn't have macos build.
82-
# TODO: Remove this and install nightly build, once it supports macos
83-
(
84-
set -x
85-
$PIP_EXECUTABLE install git+https://github.com/pytorch/ao.git@e11201a62669f582d81cdb33e031a07fb8dfc4f3
86-
)
97+
PLATFORM=$(uname -s)
98+
99+
# Install torchtune and torchao requirements for Linux systems using nightly.
100+
# For non-Linux systems (e.g., macOS), install torchao from GitHub since nightly
101+
# build doesn't have macOS build.
102+
# TODO: Remove this and install nightly build, once it supports macOS
103+
if [ "$PLATFORM" == "Linux" ];
104+
then
105+
(
106+
set -x
107+
$PIP_EXECUTABLE install --pre --extra-index-url "${TORCH_NIGHTLY_URL}" --no-cache-dir \
108+
"${LINUX_REQUIREMENTS_TO_INSTALL[@]}"
109+
)
110+
else
111+
# For torchao need to install from github since nightly build doesn't have macos build.
112+
# TODO: Remove this and install nightly build, once it supports macos
113+
(
114+
set -x
115+
$PIP_EXECUTABLE install git+https://github.com/pytorch/ao.git@e11201a62669f582d81cdb33e031a07fb8dfc4f3
116+
)
117+
fi
118+
87119
if [[ -x "$(command -v nvidia-smi)" ]]; then
88120
(
89121
set -x

0 commit comments

Comments
 (0)