Skip to content

Commit ce81995

Browse files
authored
[Feature] Offline datasets: D4RL (#928)
1 parent da88aad commit ce81995

31 files changed

+1240
-39
lines changed

Diff for: .circleci/config.yml

+60
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,62 @@ jobs:
474474
- store_test_results:
475475
path: test-results
476476

477+
unittest_linux_d4rl_gpu:
478+
<<: *binary_common
479+
machine:
480+
image: ubuntu-2004-cuda-11.4:202110-01
481+
resource_class: gpu.nvidia.medium
482+
environment:
483+
image_name: "nvidia/cudagl:11.4.0-base"
484+
TAR_OPTIONS: --no-same-owner
485+
PYTHON_VERSION: << parameters.python_version >>
486+
CU_VERSION: << parameters.cu_version >>
487+
488+
steps:
489+
- checkout
490+
- designate_upload_channel
491+
- run:
492+
name: Generate cache key
493+
# This will refresh cache on Sundays, nightly build should generate new cache.
494+
command: echo "$(date +"%Y-%U")" > .circleci-weekly
495+
- restore_cache:
496+
keys:
497+
- env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux_libs/scripts_d4rl/environment.yml" }}-{{ checksum ".circleci-weekly" }}
498+
- run:
499+
name: Setup
500+
command: docker run -e PYTHON_VERSION -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_libs/scripts_d4rl/setup_env.sh
501+
- save_cache:
502+
503+
key: env-v3-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux_libs/scripts_d4rl/environment.yml" }}-{{ checksum ".circleci-weekly" }}
504+
505+
paths:
506+
- conda
507+
- env
508+
- run:
509+
# Here we create an envlist file that contains some env variables that we want the docker container to be aware of.
510+
# Normally, the CIRCLECI variable is set and available on all CI workflows: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.
511+
# They're available in all the other workflows (OSX and Windows).
512+
# But here, we're running the unittest_linux_gpu workflows in a docker container, where those variables aren't accessible.
513+
# So instead we dump the variables we need in env.list and we pass that file when invoking "docker run".
514+
name: export CIRCLECI env var
515+
command: echo "CIRCLECI=true" >> ./env.list
516+
- run:
517+
name: Install torchrl
518+
command: docker run -e PYTHON_VERSION -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_libs/scripts_d4rl/install.sh
519+
- run:
520+
name: Run tests
521+
command: docker run --env-file ./env.list -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_libs/scripts_d4rl/run_test.sh
522+
- run:
523+
name: Codecov upload
524+
command: |
525+
bash <(curl -s https://codecov.io/bash) -Z -F d4rl-gpu
526+
- run:
527+
name: Post Process
528+
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux_libs/scripts_d4rl/post_process.sh
529+
- store_test_results:
530+
path: test-results
531+
532+
477533
unittest_linux_jumanji_gpu:
478534
<<: *binary_common
479535
machine:
@@ -1223,6 +1279,10 @@ workflows:
12231279
cu_version: cu117
12241280
name: unittest_linux_habitat_gpu_py3.8
12251281
python_version: '3.8'
1282+
# - unittest_linux_d4rl_gpu:
1283+
# cu_version: cu117
1284+
# name: unittest_linux_d4rl_gpu_py3.8
1285+
# python_version: '3.8'
12261286
- unittest_linux_jumanji_gpu:
12271287
cu_version: cu117
12281288
name: unittest_linux_jumanji_gpu_py3.8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
channels:
2+
- pytorch
3+
- defaults
4+
dependencies:
5+
- pip
6+
- pip:
7+
- hypothesis
8+
- future
9+
- cloudpickle
10+
- pytest
11+
- pytest-cov
12+
- pytest-mock
13+
- pytest-instafail
14+
- pytest-rerunfailures
15+
- expecttest
16+
- pyyaml
17+
- scipy
18+
- hydra-core
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
3+
unset PYTORCH_VERSION
4+
# For unittest, nightly PyTorch is used as the following section,
5+
# so no need to set PYTORCH_VERSION.
6+
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.
7+
apt-get update && apt-get install -y git wget gcc g++
8+
#apt-get update && apt-get install -y git wget freeglut3 freeglut3-dev
9+
10+
set -e
11+
12+
eval "$(./conda/bin/conda shell.bash hook)"
13+
conda activate ./env
14+
15+
if [ "${CU_VERSION:-}" == cpu ] ; then
16+
version="cpu"
17+
else
18+
if [[ ${#CU_VERSION} -eq 4 ]]; then
19+
CUDA_VERSION="${CU_VERSION:2:1}.${CU_VERSION:3:1}"
20+
elif [[ ${#CU_VERSION} -eq 5 ]]; then
21+
CUDA_VERSION="${CU_VERSION:2:2}.${CU_VERSION:4:1}"
22+
fi
23+
echo "Using CUDA $CUDA_VERSION as determined by CU_VERSION ($CU_VERSION)"
24+
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
25+
fi
26+
27+
28+
# submodules
29+
git submodule sync && git submodule update --init --recursive
30+
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 --extra-index-url https://download.pytorch.org/whl/nightly/cpu --force-reinstall
37+
else
38+
pip3 install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cu116 --force-reinstall
39+
fi
40+
41+
# install tensordict
42+
pip install git+https://github.com/pytorch-labs/tensordict.git
43+
44+
# smoke test
45+
python -c "import functorch;import tensordict"
46+
47+
printf "* Installing torchrl\n"
48+
pip3 install -e .
49+
50+
# smoke test
51+
python -c "import torchrl"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
eval "$(./conda/bin/conda shell.bash hook)"
6+
conda activate ./env

0 commit comments

Comments
 (0)