Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Make torchrl runnable without functorch and with gym==0.13 #386

Merged
merged 182 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
be9f1bc
init
vmoens Aug 31, 2022
7dff9dd
init
vmoens Aug 31, 2022
ae69d16
init
vmoens Aug 31, 2022
26f6004
Merge branch 'inhouse_functional_modules' into robohive_compat
vmoens Aug 31, 2022
50f0992
temp
vmoens Aug 31, 2022
c387555
amend
vmoens Aug 31, 2022
a4bc2d5
Merge branch 'inhouse_functional_modules' into robohive_compat
vmoens Aug 31, 2022
c3661cc
tests
vmoens Aug 31, 2022
aa5c33c
tests
vmoens Aug 31, 2022
81ae8d7
amend
vmoens Aug 31, 2022
3fbfd80
amend
vmoens Aug 31, 2022
d95483d
amend
vmoens Aug 31, 2022
2fe0ab9
amend
vmoens Aug 31, 2022
5630dd4
make_functional_with_buffers in tests
vmoens Aug 31, 2022
2ec0326
make_functional_with_buffers in tests
vmoens Aug 31, 2022
6e192c7
make_functional_with_buffers in tests
vmoens Aug 31, 2022
9593a26
params = TensorDict in cost
vmoens Aug 31, 2022
03ea509
buffers_iter
vmoens Aug 31, 2022
1733090
device bugfix
vmoens Aug 31, 2022
d20d5d2
tdmodule params
vmoens Aug 31, 2022
f847907
tdmodule params
vmoens Aug 31, 2022
fd8992f
tdmodule params
vmoens Aug 31, 2022
031e9d9
tdmodule params
vmoens Aug 31, 2022
68ea1ec
tdmodule params
vmoens Aug 31, 2022
04a40ab
tdmodule params
vmoens Aug 31, 2022
ca24338
cost tests
vmoens Sep 1, 2022
e7d343d
sudo yum
vmoens Sep 1, 2022
a9d6508
unrar
vmoens Sep 1, 2022
59e3958
unrar
vmoens Sep 1, 2022
ed021f1
unrar
vmoens Sep 1, 2022
9dc597b
unrar
vmoens Sep 1, 2022
747736a
amend
vmoens Sep 1, 2022
6ee530f
amend -y
vmoens Sep 1, 2022
406a899
amen
vmoens Sep 1, 2022
6c0393c
lint
vmoens Sep 1, 2022
3a74add
mujoco
vmoens Sep 1, 2022
57c0e25
test functional modules
vmoens Sep 1, 2022
4af86b6
test functional modules
vmoens Sep 1, 2022
cd09f91
test functional modules
vmoens Sep 1, 2022
83a9ebf
test functional modules
vmoens Sep 1, 2022
53a07d6
test functional modules
vmoens Sep 1, 2022
5520aa8
test functional modules
vmoens Sep 1, 2022
247899e
test functional modules
vmoens Sep 1, 2022
02bd368
test functional modules
vmoens Sep 1, 2022
289f406
test functional modules
vmoens Sep 1, 2022
087022a
test functional modules
vmoens Sep 1, 2022
3dc213d
test functional modules
vmoens Sep 1, 2022
b611e2d
test functional modules
vmoens Sep 1, 2022
5d85b9a
test functional modules
vmoens Sep 1, 2022
edf1b74
test functional modules
vmoens Sep 1, 2022
5ce2422
test functional modules
vmoens Sep 1, 2022
1177772
test functional modules
vmoens Sep 1, 2022
2550e92
test functional modules
vmoens Sep 1, 2022
668d39e
test functional modules
vmoens Sep 1, 2022
51ce842
test functional modules
vmoens Sep 1, 2022
17112e9
test functional modules
vmoens Sep 1, 2022
ec67e63
test functional modules
vmoens Sep 1, 2022
b3acc8b
test functional modules
vmoens Sep 1, 2022
584b5db
test functional modules
vmoens Sep 1, 2022
93636dc
test functional modules
vmoens Sep 1, 2022
aed285e
test functional modules
vmoens Sep 1, 2022
af526d4
test functional modules
vmoens Sep 1, 2022
a9aaf04
test functional modules
vmoens Sep 1, 2022
a327a04
test functional modules
vmoens Sep 1, 2022
010adea
test functional modules
vmoens Sep 1, 2022
b8674e7
test functional modules
vmoens Sep 1, 2022
9152714
targets
vmoens Sep 1, 2022
0cf5bc3
targets
vmoens Sep 1, 2022
1b8393c
targets
vmoens Sep 1, 2022
1dd1ca6
targets
vmoens Sep 1, 2022
7fca248
lint
vmoens Sep 1, 2022
3c5ad47
smoke tests
vmoens Sep 1, 2022
d3ce0a6
aha got you
vmoens Sep 1, 2022
377f614
not so fast
vmoens Sep 1, 2022
8b0a93a
wait a min
vmoens Sep 1, 2022
573b309
the cook and the crook
vmoens Sep 1, 2022
5b6cd66
if only i was a mermaid
vmoens Sep 1, 2022
89d13e4
when the music used to make me cry
vmoens Sep 1, 2022
cc5e409
Amen amen amen
vmoens Sep 1, 2022
7328281
did I say I'm sorry
vmoens Sep 1, 2022
7dfe65b
there's nothing holding me back
vmoens Sep 1, 2022
8dc3c1a
Merge branch 'main' into robohive_compat
vmoens Sep 1, 2022
7d2c4b0
amend
vmoens Sep 2, 2022
768b934
Merge branch 'main' into robohive_compat
vmoens Sep 2, 2022
75542dc
Merge branch 'main' into robohive_compat
vmoens Oct 17, 2022
ffbd5ac
lint
vmoens Oct 17, 2022
28337f5
Merge branch 'main' into robohive_compat
vmoens Oct 21, 2022
137c0f8
tensorboard
vmoens Oct 21, 2022
e9984fe
tb version
vmoens Oct 21, 2022
aa522b9
regression
vmoens Oct 21, 2022
40c7cf0
lint
vmoens Oct 21, 2022
d56428e
egl
vmoens Oct 21, 2022
4fc8529
amend
vmoens Oct 21, 2022
12bc62b
custom smoke test
vmoens Oct 23, 2022
6b82353
amend
vmoens Oct 24, 2022
95284c8
amend
vmoens Oct 24, 2022
d1789bb
amend
vmoens Oct 24, 2022
b254424
amend
vmoens Oct 24, 2022
fe01aa9
bf
vmoens Oct 24, 2022
ca10f63
bf
vmoens Oct 24, 2022
7c3c6d0
bf
vmoens Oct 24, 2022
02447f0
amend
vmoens Oct 24, 2022
eabb8be
amend
vmoens Oct 24, 2022
5caed90
amend
vmoens Oct 24, 2022
677a37b
amend
vmoens Oct 24, 2022
fb8810a
amend
vmoens Oct 24, 2022
ad81a25
amend
vmoens Oct 24, 2022
c050cab
amend
vmoens Oct 25, 2022
2152938
amend
vmoens Oct 25, 2022
2bbf178
amend
vmoens Oct 25, 2022
364df87
Merge branch 'main' into robohive_compat
vmoens Oct 25, 2022
185eaee
double prec for lstm test
vmoens Oct 25, 2022
ef266c8
double prec for lstm test
vmoens Oct 25, 2022
261bd58
fix batch for transformers
vmoens Oct 25, 2022
4bae7ac
fix batch for transformers
vmoens Oct 25, 2022
ef61973
fix batch for transformers
vmoens Oct 25, 2022
f77dbea
fix batch for transformers
vmoens Oct 25, 2022
6abd1ce
lint
vmoens Oct 25, 2022
906ef75
amend
vmoens Oct 25, 2022
9a8eb6b
amend
vmoens Oct 25, 2022
0c74e1e
amend
vmoens Oct 25, 2022
a280899
lint
vmoens Oct 25, 2022
2c7dc2e
retry
vmoens Oct 25, 2022
896e1cb
retry
vmoens Oct 25, 2022
6b39641
amend
vmoens Oct 25, 2022
eced306
amend
vmoens Oct 25, 2022
df23261
amend
vmoens Oct 26, 2022
8aa3bd4
amend
vmoens Oct 26, 2022
dc42297
amend
vmoens Oct 26, 2022
e53f270
amend
vmoens Oct 26, 2022
07725ae
nvidia/opengl
vmoens Oct 26, 2022
6fc833f
nvidia/opengl
vmoens Oct 26, 2022
ff1fe0e
nvidia/opengl
vmoens Oct 26, 2022
0bf80a2
-y
vmoens Oct 26, 2022
5968279
stuff
vmoens Oct 26, 2022
4a620e4
unzip
vmoens Oct 26, 2022
a3038e1
amend
vmoens Oct 26, 2022
f120870
amend
vmoens Oct 26, 2022
8fb536c
amend
vmoens Oct 26, 2022
eb26917
amend
vmoens Oct 26, 2022
a63d1d2
amend
vmoens Oct 26, 2022
d700009
amend
vmoens Oct 26, 2022
1daf15f
amend
vmoens Oct 26, 2022
9703b0f
local installation of mujoco-py
vmoens Oct 26, 2022
3b28231
local installation of mujoco-py
vmoens Oct 26, 2022
566bfc0
local installation of mujoco-py
vmoens Oct 26, 2022
a1e72c6
atari rom
vmoens Oct 26, 2022
7f3a12a
atari rom
vmoens Oct 26, 2022
e909654
yum
vmoens Oct 27, 2022
1ec7693
style
vmoens Oct 27, 2022
409a66a
amend
vmoens Oct 27, 2022
74b6786
Merge branch 'main' into robohive_compat
vmoens Oct 27, 2022
6767a1e
amend
vmoens Oct 27, 2022
055af39
amend
vmoens Oct 27, 2022
62a5616
amend
vmoens Oct 27, 2022
21ad9fa
amend
vmoens Oct 27, 2022
5d1bb75
amend
vmoens Oct 27, 2022
c621045
amend
vmoens Oct 27, 2022
b12cb01
amend
vmoens Oct 27, 2022
e8dd108
amend
vmoens Oct 27, 2022
a1522f6
amend
vmoens Oct 27, 2022
c1d94b6
amend
vmoens Oct 27, 2022
afc8371
amend
vmoens Oct 27, 2022
57ae574
amend
vmoens Oct 27, 2022
20ca95c
amend
vmoens Oct 27, 2022
0b4bbf6
amend
vmoens Oct 27, 2022
cc18f43
yum
vmoens Oct 27, 2022
c7897a1
lint
vmoens Oct 27, 2022
3de9a1f
amend
vmoens Oct 28, 2022
0ac3f09
amend
vmoens Oct 28, 2022
b6c625f
amend
vmoens Oct 28, 2022
59c4eef
amend
vmoens Oct 28, 2022
df092fc
import error
vmoens Oct 28, 2022
ff573b9
amend
vmoens Oct 28, 2022
85d02cf
amend
vmoens Oct 28, 2022
011d06f
bf
vmoens Oct 28, 2022
c8ecb7b
bf
vmoens Oct 28, 2022
091f746
aha
vmoens Oct 28, 2022
df25fa6
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
vmoens Oct 28, 2022
e87e5f6
empty
vmoens Oct 28, 2022
4703fde
back to cpu
vmoens Oct 28, 2022
caf7dfb
amend
vmoens Oct 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ jobs:
- run:
name: Install torchrl
# command: bash .circleci/unittest/linux_stable/scripts/install.sh
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux/scripts/install.sh
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_stable/scripts/install.sh
- run:
name: Run tests
command: bash .circleci/unittest/linux_stable/scripts/run_test.sh
Expand All @@ -516,6 +516,53 @@ jobs:
- store_test_results:
path: test-results

unittest_linux_olddeps_gpu:
<<: *binary_common
machine:
image: ubuntu-2004-cuda-11.4:202110-01
resource_class: gpu.nvidia.medium
environment:
image_name: "pytorch/manylinux-cuda113"
TAR_OPTIONS: --no-same-owner
PYTHON_VERSION: << parameters.python_version >>
CU_VERSION: << parameters.cu_version >>

steps:
- checkout
- designate_upload_channel
- run:
name: Generate cache key
# This will refresh cache on Sundays, nightly build should generate new cache.
command: echo "$(date +"%Y-%U")" > .circleci-weekly
- restore_cache:
keys:
- env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux_olddeps/scripts_gym_0_13/environment.yml" }}-{{ checksum ".circleci-weekly" }}
- run:
name: Setup
command: docker run -e PYTHON_VERSION -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/setup_env.sh
- save_cache:
key: env-v2-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux_olddeps/scripts_gym_0_13/environment.yml" }}-{{ checksum ".circleci-weekly" }}
paths:
- conda
- env
- run:
name: Install torchrl, run tests, upload codecov
command: |
docker run -t --env=CUDA_VISIBLE_DEVICES="" --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/batch_scripts.sh
# docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/batch_scripts.sh
# - run:
# name: Run tests
# command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/run_test.sh
# - run:
# name: Codecov upload
# command: |
# docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" <(curl -s https://codecov.io/bash) -Z -F linux-stable-cpu
# - run:
# name: Post process
# command: docker run -t --gpus all -v $PWD:$PWD -w $PWD -e UPLOAD_CHANNEL -e CU_VERSION "${image_name}" .circleci/unittest/linux_olddeps/scripts_gym_0_13/post_process.sh
- store_test_results:
path: test-results

unittest_macos_cpu:
<<: *binary_common
macos:
Expand Down Expand Up @@ -787,3 +834,8 @@ workflows:
cu_version: cu113
name: unittest_linux_stable_gpu_py3.10
python_version: '3.10'

- unittest_linux_olddeps_gpu:
cu_version: cu113
name: unittest_linux_olddeps_gpu_py3.9
python_version: '3.9'
8 changes: 7 additions & 1 deletion .circleci/unittest/linux/scripts/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

# this code is supposed to run on CPU
# rendering with the combination of packages we have here in headless mode
# is hard to nail.
# IMPORTANT: As a consequence, we can't guarantee TorchRL compatibility with
# rendering with this version of gym / mujoco-py.

set -e

eval "$(./conda/bin/conda shell.bash hook)"
Expand All @@ -19,6 +25,6 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lib_dir
export MKL_THREADING_LAYER=GNU

coverage run -m pytest test/smoke_test.py -v --durations 20
coverage run -m pytest test/smoke_test_deps.py -v --durations 20
coverage run -m pytest test/smoke_test_deps.py -v --durations 20 -k 'test_gym or test_dm_control_pixels or test_dm_control or test_tb'
coverage run -m pytest --instafail -v --durations 20
coverage xml
10 changes: 10 additions & 0 deletions .circleci/unittest/linux_olddeps/scripts_gym_0_13/batch_scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# Runs a batch of scripts in a row to allow docker run to keep installed libraries
# and env variables across runs.

DIR="$(cd "$(dirname "$0")" && pwd)"

$DIR/install.sh
$DIR/run_test.sh
$DIR/post_process.sh
26 changes: 26 additions & 0 deletions .circleci/unittest/linux_olddeps/scripts_gym_0_13/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
channels:
- pytorch
- defaults
dependencies:
- pip
- protobuf
- pip:
- hypothesis
- future
- cloudpickle
- gym==0.13
- pygame
- gym[atari]
- moviepy
- tqdm
- pytest
- pytest-cov
- pytest-mock
- pytest-instafail
- expecttest
- pyyaml
- scipy
- hydra-core
- dm_control -e git+https://github.com/deepmind/dm_control.git@c053360edea6170acfd9c8f65446703307d9d352#egg={dm_control}
- patchelf
- pyopengl==3.1.4
45 changes: 45 additions & 0 deletions .circleci/unittest/linux_olddeps/scripts_gym_0_13/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

unset PYTORCH_VERSION
# For unittest, nightly PyTorch is used as the following section,
# so no need to set PYTORCH_VERSION.
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.

set -e

eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env

#apt-get update -y && apt-get install git wget gcc g++ -y

if [ "${CU_VERSION:-}" == cpu ] ; then
cudatoolkit="cpuonly"
version="cpu"
else
if [[ ${#CU_VERSION} -eq 4 ]]; then
CUDA_VERSION="${CU_VERSION:2:1}.${CU_VERSION:3:1}"
elif [[ ${#CU_VERSION} -eq 5 ]]; then
CUDA_VERSION="${CU_VERSION:2:2}.${CU_VERSION:4:1}"
fi
echo "Using CUDA $CUDA_VERSION as determined by CU_VERSION ($CU_VERSION)"
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
cudatoolkit="cudatoolkit=${version}"
fi

case "$(uname -s)" in
Darwin*) os=MacOSX;;
*) os=Linux
esac

# submodules
git submodule sync && git submodule update --init --recursive

printf "Installing PyTorch with %s\n" "${CU_VERSION}"
if [ "${CU_VERSION:-}" == cpu ] ; then
conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cpuonly -c pytorch -y
else
conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=11.3 -c pytorch -c conda-forge -y
fi

printf "* Installing torchrl\n"
python setup.py develop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e

eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
Loading