Skip to content

Commit

Permalink
[Feature] Roboset datasets (pytorch#1743)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Dec 13, 2023
1 parent 14a99f8 commit 0906206
Show file tree
Hide file tree
Showing 17 changed files with 1,020 additions and 42 deletions.
21 changes: 1 addition & 20 deletions .github/unittest/linux_libs/scripts_d4rl/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,6 @@ conda deactivate && conda activate ./env
# this workflow only tests the libs
python -c "import gym, d4rl"

python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 200 --capture no -k TestD4RL --error-for-skips
python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 200 --capture no -k TestD4RL --error-for-skips --runslow
coverage combine
coverage xml -i

## check what happens if we update gym
#pip install gym -U
#python -c """
#from torchrl.data.datasets import D4RLExperienceReplay
#data = D4RLExperienceReplay('halfcheetah-medium-v2', batch_size=10, from_env=False, direct_download=True)
#for batch in data:
# print(batch)
# break
#
#data = D4RLExperienceReplay('halfcheetah-medium-v2', batch_size=10, from_env=False, direct_download=False)
#for batch in data:
# print(batch)
# break
#
#import d4rl
#import gym
#gym.make('halfcheetah-medium-v2')
#"""
2 changes: 1 addition & 1 deletion .github/unittest/linux_libs/scripts_minari/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ conda deactivate && conda activate ./env
# this workflow only tests the libs
python -c "import minari"

python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 200 --capture no -k TestMinari --error-for-skips
python .github/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 200 --capture no -k TestMinari --error-for-skips --runslow
coverage combine
coverage xml -i
22 changes: 22 additions & 0 deletions .github/unittest/linux_libs/scripts_roboset/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
channels:
- pytorch
- defaults
dependencies:
- pip
- pip:
- hypothesis
- future
- cloudpickle
- pytest
- pytest-cov
- pytest-mock
- pytest-instafail
- pytest-rerunfailures
- pytest-error-for-skips
- expecttest
- pyyaml
- scipy
- hydra-core
- huggingface_hub
- tqdm
- h5py
51 changes: 51 additions & 0 deletions .github/unittest/linux_libs/scripts_roboset/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/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.
apt-get update && apt-get install -y git wget gcc g++
#apt-get update && apt-get install -y git wget freeglut3 freeglut3-dev

set -e

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

if [ "${CU_VERSION:-}" == cpu ] ; then
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]))")"
fi


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

printf "Installing PyTorch with %s\n" "${CU_VERSION}"
if [ "${CU_VERSION:-}" == cpu ] ; then
# conda install -y pytorch torchvision cpuonly -c pytorch-nightly
# use pip to install pytorch as conda can frequently pick older release
# conda install -y pytorch cpuonly -c pytorch-nightly
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu --force-reinstall
else
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121 --force-reinstall
fi

# install tensordict
pip install git+https://github.com/pytorch/tensordict.git

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

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

# smoke test
python -c "import torchrl"
6 changes: 6 additions & 0 deletions .github/unittest/linux_libs/scripts_roboset/post_process.sh
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

0 comments on commit 0906206

Please sign in to comment.