Skip to content

Commit 4162db6

Browse files
author
Vincent Moens
committed
[CI] Fix old deps
ghstack-source-id: 109de71 Pull Request resolved: #2916
1 parent 48c3e59 commit 4162db6

File tree

7 files changed

+39
-27
lines changed

7 files changed

+39
-27
lines changed

.github/unittest/linux_libs/scripts_envpool/setup_env.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,7 @@ if [[ $OSTYPE != 'darwin'* ]]; then
8181
# rename them
8282
PY_VERSION=$(python --version)
8383
echo "installing ale-py for ${PY_PY_VERSION}"
84-
if [[ $PY_VERSION == *"3.7"* ]]; then
85-
wget https://files.pythonhosted.org/packages/ab/fd/6615982d9460df7f476cad265af1378057eee9daaa8e0026de4cedbaffbd/ale_py-0.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
86-
pip install ale_py-0.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
87-
rm ale_py-0.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
88-
elif [[ $PY_VERSION == *"3.8"* ]]; then
89-
wget https://files.pythonhosted.org/packages/0f/8a/feed20571a697588bc4bfef05d6a487429c84f31406a52f8af295a0346a2/ale_py-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
90-
pip install ale_py-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
91-
rm ale_py-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
92-
elif [[ $PY_VERSION == *"3.9"* ]]; then
84+
if [[ $PY_VERSION == *"3.9"* ]]; then
9385
wget https://files.pythonhosted.org/packages/a0/98/4316c1cedd9934f9a91b6e27a9be126043b4445594b40cfa391c8de2e5e8/ale_py-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
9486
pip install ale_py-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
9587
rm ale_py-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

.github/unittest/linux_olddeps/scripts_gym_0_13/install.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,25 @@ 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==2.0 torchvision==0.15 cpuonly -c pytorch -y
40+
conda install pytorch==2.1 torchvision==0.16 cpuonly -c pytorch -y
4141
else
42-
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 "numpy<2.0" -c pytorch -c nvidia -y
42+
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118
43+
# conda install pytorch==2.1 torchvision==0.16 pytorch-cuda=11.8 "numpy<2.0" -c pytorch -c nvidia -y
4344
fi
4445

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

4849
# install tensordict
4950
if [[ "$RELEASE" == 0 ]]; then
50-
pip3 install git+https://github.com/pytorch/tensordict.git
51+
python3 -m pip install git+https://github.com/pytorch/tensordict.git
5152
else
52-
pip3 install tensordict
53+
python3 -m pip install tensordict
5354
fi
5455

5556
# smoke test
56-
python -c "import tensordict"
57+
python3 -c "import tensordict"
5758

5859
printf "* Installing torchrl\n"
59-
python setup.py develop
60-
python -c "import torchrl"
60+
python3 setup.py develop
61+
python3 -c "import torchrl"

.github/workflows/test-linux.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ jobs:
9494
tests-olddeps:
9595
strategy:
9696
matrix:
97-
python_version: ["3.8"]
97+
python_version: ["3.9"]
9898
cuda_arch_version: ["11.6"]
9999
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
100100
with:
101101
repository: pytorch/rl
102102
runner: "linux.g5.4xlarge.nvidia.gpu"
103-
docker-image: "nvidia/cudagl:11.4.0-base"
103+
docker-image: "nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04"
104104
timeout: 120
105105
script: |
106106
set -euo pipefail
107-
export PYTHON_VERSION="3.8"
108-
export CU_VERSION="cu116"
107+
export PYTHON_VERSION="3.9"
108+
export CU_VERSION="cu118"
109109
export TAR_OPTIONS="--no-same-owner"
110110
if [[ "${{ github.ref }}" =~ release/* ]]; then
111111
export RELEASE=1

test/test_loggers.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import pytest
1616
import torch
17+
from packaging import version
1718
from tensordict import MemoryMappedTensor
1819

1920
from torchrl.envs import check_env_specs, GymEnv, ParallelEnv
@@ -26,6 +27,12 @@
2627
if _has_tv:
2728
import torchvision
2829

30+
TORCHVISION_VERSION = version.parse(
31+
version.parse(torchvision.__version__).base_version
32+
)
33+
else:
34+
TORCHVISION_VERSION = version.parse("0.0.1").base_version
35+
2936
if _has_tb:
3037
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
3138

@@ -164,6 +171,9 @@ def test_log_scalar(self, steps, tmpdir):
164171
@pytest.mark.parametrize(
165172
"video_format", ["pt", "memmap"] + ["mp4"] if _has_tv else []
166173
)
174+
@pytest.mark.skipif(
175+
TORCHVISION_VERSION < version.parse("0.20.0"), reason="av compatibility bug"
176+
)
167177
def test_log_video(self, steps, video_format, tmpdir):
168178
torch.manual_seed(0)
169179
exp_name = "ramala"

test/test_rb.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,9 @@ def test_storage_inplace_writing_ndim(self, storage_type):
11191119
assert (rb[:, 10:20] == 0).all()
11201120
assert len(rb) == 100
11211121

1122+
@pytest.mark.skipif(
1123+
TORCH_VERSION < version.parse("2.5.0"), reason="requires Torch >= 2.5.0"
1124+
)
11221125
@pytest.mark.parametrize("max_size", [1000, None])
11231126
@pytest.mark.parametrize("stack_dim", [-1, 0])
11241127
def test_lazy_stack_storage(self, max_size, stack_dim):

test/test_storage_map.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import argparse
88
import functools
99
import importlib.util
10+
import os
1011

1112
import pytest
1213

@@ -23,6 +24,11 @@
2324
)
2425
from torchrl.envs import GymEnv
2526

27+
if os.getenv("PYTORCH_TEST_FBCODE"):
28+
from pytorch.rl.test._utils_internal import PENDULUM_VERSIONED
29+
else:
30+
from _utils_internal import PENDULUM_VERSIONED
31+
2632
_has_gym = importlib.util.find_spec("gymnasium", None) or importlib.util.find_spec(
2733
"gym", None
2834
)
@@ -603,7 +609,7 @@ def test_forest_intersect_vertices(self):
603609
def test_simple_tree(self):
604610
from torchrl.envs import GymEnv
605611

606-
env = GymEnv("Pendulum-v1")
612+
env = GymEnv(PENDULUM_VERSIONED())
607613
r = env.rollout(10)
608614
state0 = r[0]
609615
forest = MCTSForest()
@@ -630,7 +636,7 @@ def test_forest_parent(self, tree_type, compact):
630636
pytest.skip("requires gym")
631637
from torchrl.envs import GymEnv
632638

633-
env = GymEnv("Pendulum-v1")
639+
env = GymEnv(PENDULUM_VERSIONED())
634640
r = env.rollout(10)
635641
state0 = r[0]
636642
forest = MCTSForest()

test/test_transforms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,15 +766,15 @@ def get_rand_perm(ndim):
766766
@pytest.mark.parametrize("cat_dim", [-1, -2])
767767
def test_with_permute_env(self, cat_dim):
768768
env0 = TransformedEnv(
769-
GymEnv("Pendulum-v1"),
769+
GymEnv(PENDULUM_VERSIONED()),
770770
Compose(
771771
UnsqueezeTransform(-1, in_keys=["observation"]),
772772
CatFrames(N=4, dim=cat_dim, in_keys=["observation"]),
773773
),
774774
)
775775

776776
env1 = TransformedEnv(
777-
GymEnv("Pendulum-v1"),
777+
GymEnv(PENDULUM_VERSIONED()),
778778
Compose(
779779
UnsqueezeTransform(-1, in_keys=["observation"]),
780780
PermuteTransform((-1, -2), in_keys=["observation"]),
@@ -9566,7 +9566,7 @@ def test_vecnorm2_decay1(self, batched):
95669566
@pytest.mark.parametrize("stateful", [True, False])
95679567
def test_stateful_and_stateless_specs(self, stateful):
95689568
torch.manual_seed(0)
9569-
env = GymEnv("Pendulum-v1")
9569+
env = GymEnv(PENDULUM_VERSIONED())
95709570
env.set_seed(0)
95719571
env = env.append_transform(
95729572
VecNorm(
@@ -9588,7 +9588,7 @@ def test_stateful_vs_stateless(self):
95889588
counts = []
95899589
for stateful in [True, False]:
95909590
torch.manual_seed(0)
9591-
env = GymEnv("Pendulum-v1")
9591+
env = GymEnv(PENDULUM_VERSIONED())
95929592
env.set_seed(0)
95939593
env = env.append_transform(
95949594
VecNorm(

0 commit comments

Comments
 (0)