Skip to content

Commit 7adccce

Browse files
Vincent Moensvmoens
authored andcommitted
[CI] Install stable torch and tensordict for release tests (#1978)
1 parent c0bf069 commit 7adccce

File tree

36 files changed

+635
-169
lines changed

36 files changed

+635
-169
lines changed

.github/unittest/linux/scripts/run_all.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ git submodule sync && git submodule update --init --recursive
124124
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
125125
if [[ "$TORCH_VERSION" == "nightly" ]]; then
126126
if [ "${CU_VERSION:-}" == cpu ] ; then
127-
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
127+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu -U
128128
else
129-
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
129+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
130130
fi
131131
elif [[ "$TORCH_VERSION" == "stable" ]]; then
132132
if [ "${CU_VERSION:-}" == cpu ] ; then
133-
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
133+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
134134
else
135-
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$CU_VERSION
135+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/$CU_VERSION
136136
fi
137137
else
138138
printf "Failed to install pytorch"
@@ -150,7 +150,11 @@ else
150150
fi
151151

152152
# install tensordict
153-
pip3 install git+https://github.com/pytorch/tensordict.git
153+
if [[ "$RELEASE" == 0 ]]; then
154+
pip3 install git+https://github.com/pytorch/tensordict.git
155+
else
156+
pip3 install tensordict
157+
fi
154158

155159
printf "* Installing torchrl\n"
156160
python setup.py develop

.github/unittest/linux_distributed/scripts/install.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,21 @@ fi
2626
# submodules
2727
git submodule sync && git submodule update --init --recursive
2828

29-
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
30-
if [ "${CU_VERSION:-}" == cpu ] ; then
31-
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
29+
if [[ "$TORCH_VERSION" == "nightly" ]]; then
30+
if [ "${CU_VERSION:-}" == cpu ] ; then
31+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu -U
32+
else
33+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION -U
34+
fi
35+
elif [[ "$TORCH_VERSION" == "stable" ]]; then
36+
if [ "${CU_VERSION:-}" == cpu ] ; then
37+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu -U
38+
else
39+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/$CU_VERSION -U
40+
fi
3241
else
33-
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
42+
printf "Failed to install pytorch"
43+
exit 1
3444
fi
3545

3646
# smoke test
@@ -40,7 +50,11 @@ python -c "import functorch"
4050
pip install git+https://github.com/pytorch/torchsnapshot
4151

4252
# install tensordict
43-
pip install git+https://github.com/pytorch/tensordict.git
53+
if [[ "$RELEASE" == 0 ]]; then
54+
pip3 install git+https://github.com/pytorch/tensordict.git
55+
else
56+
pip3 install tensordict
57+
fi
4458

4559
printf "* Installing torchrl\n"
4660
python setup.py develop

.github/unittest/linux_examples/scripts/run_all.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,22 @@ version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
148148
git submodule sync && git submodule update --init --recursive
149149

150150
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
151-
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
151+
if [[ "$TORCH_VERSION" == "nightly" ]]; then
152+
if [ "${CU_VERSION:-}" == cpu ] ; then
153+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu -U
154+
else
155+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION
156+
fi
157+
elif [[ "$TORCH_VERSION" == "stable" ]]; then
158+
if [ "${CU_VERSION:-}" == cpu ] ; then
159+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
160+
else
161+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/$CU_VERSION
162+
fi
163+
else
164+
printf "Failed to install pytorch"
165+
exit 1
166+
fi
152167

153168
# smoke test
154169
python -c "import functorch"
@@ -157,7 +172,11 @@ python -c "import functorch"
157172
pip install git+https://github.com/pytorch/torchsnapshot
158173

159174
# install tensordict
160-
pip install git+https://github.com/pytorch/tensordict.git
175+
if [[ "$RELEASE" == 0 ]]; then
176+
pip3 install git+https://github.com/pytorch/tensordict.git
177+
else
178+
pip3 install tensordict
179+
fi
161180

162181
printf "* Installing torchrl\n"
163182
python setup.py develop

.github/unittest/linux_libs/scripts_ataridqn/install.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,30 @@ fi
2828
# submodules
2929
git submodule sync && git submodule update --init --recursive
3030

31-
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
32-
if [ "${CU_VERSION:-}" == cpu ] ; then
33-
# conda install -y pytorch torchvision cpuonly -c pytorch-nightly
34-
# use pip to install pytorch as conda can frequently pick older release
35-
# conda install -y pytorch cpuonly -c pytorch-nightly
36-
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
31+
printf "Installing PyTorch with cu121"
32+
if [[ "$TORCH_VERSION" == "nightly" ]]; then
33+
if [ "${CU_VERSION:-}" == cpu ] ; then
34+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu -U
35+
else
36+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121 -U
37+
fi
38+
elif [[ "$TORCH_VERSION" == "stable" ]]; then
39+
if [ "${CU_VERSION:-}" == cpu ] ; then
40+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
41+
else
42+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu121
43+
fi
3744
else
38-
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121
45+
printf "Failed to install pytorch"
46+
exit 1
3947
fi
4048

4149
# install tensordict
42-
pip install git+https://github.com/pytorch/tensordict.git
50+
if [[ "$RELEASE" == 0 ]]; then
51+
pip3 install git+https://github.com/pytorch/tensordict.git
52+
else
53+
pip3 install tensordict
54+
fi
4355

4456
# smoke test
4557
python -c "import functorch;import tensordict"

.github/unittest/linux_libs/scripts_brax/install.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,22 @@ fi
2525
# submodules
2626
git submodule sync && git submodule update --init --recursive
2727

28-
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
29-
if [ "${CU_VERSION:-}" == cpu ] ; then
30-
# conda install -y pytorch torchvision cpuonly -c pytorch-nightly
31-
# use pip to install pytorch as conda can frequently pick older release
32-
# conda install -y pytorch cpuonly -c pytorch-nightly
33-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu --force-reinstall --progress-bar off
28+
printf "Installing PyTorch with cu121"
29+
if [[ "$TORCH_VERSION" == "nightly" ]]; then
30+
if [ "${CU_VERSION:-}" == cpu ] ; then
31+
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
32+
else
33+
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 -U
34+
fi
35+
elif [[ "$TORCH_VERSION" == "stable" ]]; then
36+
if [ "${CU_VERSION:-}" == cpu ] ; then
37+
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
38+
else
39+
pip3 install torch --index-url https://download.pytorch.org/whl/cu121
40+
fi
3441
else
35-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 --force-reinstall --progress-bar off
42+
printf "Failed to install pytorch"
43+
exit 1
3644
fi
3745

3846
# install tensordict

.github/unittest/linux_libs/scripts_d4rl/install.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,30 @@ fi
2828
# submodules
2929
git submodule sync && git submodule update --init --recursive
3030

31-
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
32-
if [ "${CU_VERSION:-}" == cpu ] ; then
33-
# conda install -y pytorch torchvision cpuonly -c pytorch-nightly
34-
# use pip to install pytorch as conda can frequently pick older release
35-
# conda install -y pytorch cpuonly -c pytorch-nightly
36-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu --force-reinstall
31+
printf "Installing PyTorch with cu121"
32+
if [[ "$TORCH_VERSION" == "nightly" ]]; then
33+
if [ "${CU_VERSION:-}" == cpu ] ; then
34+
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
35+
else
36+
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 -U
37+
fi
38+
elif [[ "$TORCH_VERSION" == "stable" ]]; then
39+
if [ "${CU_VERSION:-}" == cpu ] ; then
40+
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
41+
else
42+
pip3 install torch --index-url https://download.pytorch.org/whl/cu121
43+
fi
3744
else
38-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 --force-reinstall
45+
printf "Failed to install pytorch"
46+
exit 1
3947
fi
4048

4149
# install tensordict
42-
pip install git+https://github.com/pytorch/tensordict.git
50+
if [[ "$RELEASE" == 0 ]]; then
51+
pip3 install git+https://github.com/pytorch/tensordict.git
52+
else
53+
pip3 install tensordict
54+
fi
4355

4456
# smoke test
4557
python -c "import functorch;import tensordict"

.github/unittest/linux_libs/scripts_envpool/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ fi
2626
# submodules
2727
git submodule sync && git submodule update --init --recursive
2828

29-
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
29+
printf "Installing PyTorch with cu121"
3030
if [ "${CU_VERSION:-}" == cpu ] ; then
31-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
31+
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
3232
else
33-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu118
33+
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 -U
3434
fi
3535

3636
# smoke test

.github/unittest/linux_libs/scripts_gen-dgrl/install.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,30 @@ fi
2828
# submodules
2929
git submodule sync && git submodule update --init --recursive
3030

31-
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
32-
if [ "${CU_VERSION:-}" == cpu ] ; then
33-
# conda install -y pytorch torchvision cpuonly -c pytorch-nightly
34-
# use pip to install pytorch as conda can frequently pick older release
35-
# conda install -y pytorch cpuonly -c pytorch-nightly
36-
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
31+
printf "Installing PyTorch with cu121"
32+
if [[ "$TORCH_VERSION" == "nightly" ]]; then
33+
if [ "${CU_VERSION:-}" == cpu ] ; then
34+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu -U
35+
else
36+
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121 -U
37+
fi
38+
elif [[ "$TORCH_VERSION" == "stable" ]]; then
39+
if [ "${CU_VERSION:-}" == cpu ] ; then
40+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
41+
else
42+
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu121
43+
fi
3744
else
38-
pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu121
45+
printf "Failed to install pytorch"
46+
exit 1
3947
fi
4048

4149
# install tensordict
42-
pip install git+https://github.com/pytorch/tensordict.git
50+
if [[ "$RELEASE" == 0 ]]; then
51+
pip3 install git+https://github.com/pytorch/tensordict.git
52+
else
53+
pip3 install tensordict
54+
fi
4355

4456
# smoke test
4557
python -c "import functorch;import tensordict"

.github/unittest/linux_libs/scripts_gym/install.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,32 @@ git submodule sync && git submodule update --init --recursive
3737

3838
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
3939
if [ "${CU_VERSION:-}" == cpu ] ; then
40-
conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 cpuonly -c pytorch
40+
conda install pytorch==1.13.1 torchvision==0.14.1 cpuonly -c pytorch
4141
else
42-
conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.6 -c pytorch -c nvidia -y
42+
conda install pytorch==1.13.1 torchvision==0.14.1 pytorch-cuda=11.6 -c pytorch -c nvidia -y
4343
fi
4444

4545
# Solving circular import: https://stackoverflow.com/questions/75501048/how-to-fix-attributeerror-partially-initialized-module-charset-normalizer-has
46-
pip install -U --force-reinstall charset-normalizer
46+
pip install -U charset-normalizer
4747

4848
# install tensordict
49-
pip install git+https://github.com/pytorch/tensordict.git
49+
if [[ "$RELEASE" == 0 ]]; then
50+
pip3 install git+https://github.com/pytorch/tensordict.git
51+
else
52+
pip3 install tensordict
53+
fi
5054

5155
# smoke test
5256
python -c "import tensordict"
5357

5458
printf "* Installing torchrl\n"
5559
python setup.py develop
5660
python -c "import torchrl"
61+
62+
## Reinstalling pytorch with specific version
63+
#printf "Re-installing PyTorch with %s\n" "${CU_VERSION}"
64+
#if [ "${CU_VERSION:-}" == cpu ] ; then
65+
# conda install pytorch==1.13.1 torchvision==0.14.1 cpuonly -c pytorch
66+
#else
67+
# conda install pytorch==1.13.1 torchvision==0.14.1 pytorch-cuda=11.6 -c pytorch -c nvidia -y
68+
#fi

.github/unittest/linux_libs/scripts_habitat/install.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,19 @@ version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
2020
git submodule sync && git submodule update --init --recursive
2121

2222
printf "Installing PyTorch with %s\n" "${CU_VERSION}"
23-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 --force-reinstall
23+
if [[ "$TORCH_VERSION" == "nightly" ]]; then
24+
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 -U
25+
elif [[ "$TORCH_VERSION" == "stable" ]]; then
26+
pip3 install torch --index-url https://download.pytorch.org/whl/cu121
27+
fi
2428

2529
# install tensordict
26-
pip3 install git+https://github.com/pytorch/tensordict.git
30+
# install tensordict
31+
if [[ "$RELEASE" == 0 ]]; then
32+
pip3 install git+https://github.com/pytorch/tensordict.git
33+
else
34+
pip3 install tensordict
35+
fi
2736

2837
# smoke test
2938
python3 -c "import functorch;import tensordict"

0 commit comments

Comments
 (0)