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] Offline datasets: D4RL #928

Merged
merged 86 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a2a3f3e
d4rl
vmoens Feb 20, 2023
986d30f
amend
vmoens Feb 20, 2023
a37d545
amend
vmoens Feb 21, 2023
5bec83b
amend
vmoens Mar 1, 2023
5fb8819
Merge branch 'main' into offline_datasets
vmoens Mar 10, 2023
a72d925
amend
vmoens Mar 10, 2023
d2acef9
amend
vmoens Mar 10, 2023
f9c968c
amend
vmoens Mar 10, 2023
82305a5
amend
vmoens Mar 10, 2023
b123624
amend
vmoens Mar 10, 2023
d879f0a
lint
vmoens Mar 10, 2023
b8ca289
tests
vmoens Mar 10, 2023
9daf739
tests
vmoens Mar 10, 2023
950d70f
tests
vmoens Mar 10, 2023
2b6da29
tests
vmoens Mar 10, 2023
651ed4a
tests
vmoens Mar 10, 2023
655a1c7
tests
vmoens Mar 10, 2023
ae09acc
tests
vmoens Mar 10, 2023
64ff1d0
tests
vmoens Mar 10, 2023
c1d600b
tests
vmoens Mar 10, 2023
d16dd5f
tests
vmoens Mar 10, 2023
aa2b76b
tests
vmoens Mar 10, 2023
56d7f3d
tests
vmoens Mar 10, 2023
957e47f
tests
vmoens Mar 10, 2023
ab22ae3
tests
vmoens Mar 10, 2023
d30a80e
tests
vmoens Mar 10, 2023
4a93eee
tests
vmoens Mar 10, 2023
304058c
tests
vmoens Mar 10, 2023
d60aa21
tests
vmoens Mar 10, 2023
a7679b0
tests
vmoens Mar 10, 2023
c2043b2
tests
vmoens Mar 10, 2023
192df86
tests
vmoens Mar 10, 2023
faeebe9
tests
vmoens Mar 10, 2023
761ef10
tests
vmoens Mar 10, 2023
124a26b
tests
vmoens Mar 10, 2023
c56958a
tests
vmoens Mar 10, 2023
5f98434
tests
vmoens Mar 10, 2023
e9aeaba
select(*keys)
vmoens Mar 10, 2023
18dd357
print norms
vmoens Mar 10, 2023
824a91a
print norms
vmoens Mar 10, 2023
ea8b6fe
print norms
vmoens Mar 10, 2023
d1f2431
print norms
vmoens Mar 10, 2023
c32d605
print norms
vmoens Mar 10, 2023
8000c42
print norms
vmoens Mar 10, 2023
ede2cac
lint
vmoens Mar 10, 2023
818dac4
doc
vmoens Mar 10, 2023
d5361e6
CI
vmoens Mar 10, 2023
236a24e
done - timeout - terminal
vmoens Mar 10, 2023
57c4e3c
bf
vmoens Mar 10, 2023
4f93372
single import
vmoens Mar 10, 2023
2b7fa77
.squeeze()
vmoens Mar 10, 2023
1ade80d
reorganise imports
vmoens Mar 10, 2023
3676e38
amend
vmoens Mar 10, 2023
ca3be4d
lint
vmoens Mar 10, 2023
db9318b
Merge branch 'main' into offline_datasets
vmoens Mar 15, 2023
9dbdc8f
doc
vmoens Mar 15, 2023
895110d
doc
vmoens Mar 15, 2023
1f90c04
Merge branch 'main' into offline_datasets
vmoens Mar 15, 2023
7801efb
amend
vmoens Mar 15, 2023
d0ea455
unzip
vmoens Mar 15, 2023
98a68e8
amend
vmoens Mar 15, 2023
cdc67a2
amend
vmoens Mar 15, 2023
4e7c7d4
amend
vmoens Mar 15, 2023
b9f4770
amend
vmoens Mar 15, 2023
9af4550
amend
vmoens Mar 15, 2023
c3140ea
amend
vmoens Mar 15, 2023
71e84d2
amend
vmoens Mar 16, 2023
8e60a33
amend
vmoens Mar 16, 2023
ef6164b
amend
vmoens Mar 16, 2023
2d03f54
amend
vmoens Mar 16, 2023
856251a
amend
vmoens Mar 16, 2023
ccdab70
fix
vmoens Mar 16, 2023
2af1f6c
amend
vmoens Mar 16, 2023
cb9dfdf
amend
vmoens Mar 16, 2023
363288c
amend
vmoens Mar 16, 2023
98695f8
amend
vmoens Mar 16, 2023
d78bbfa
amend
vmoens Mar 16, 2023
9e3f680
amend
vmoens Mar 16, 2023
fe484b6
Merge remote-tracking branch 'origin/main' into offline_datasets
vmoens Mar 16, 2023
96d17f3
readme
vmoens Mar 16, 2023
83124c0
Merge remote-tracking branch 'origin/main' into offline_datasets
vmoens Mar 16, 2023
0fb957e
less print
vmoens Mar 16, 2023
055beca
amend
vmoens Mar 16, 2023
bcdf4fe
ant-medium-v2
vmoens Mar 16, 2023
d4ff292
ant-medium-v2
vmoens Mar 16, 2023
2e760b3
deactivating tests
vmoens Mar 16, 2023
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
Prev Previous commit
Next Next commit
amend
  • Loading branch information
vmoens committed Mar 16, 2023
commit 71e84d25ae906012667ca2ebc3c3dfe011544eb7
6 changes: 1 addition & 5 deletions .circleci/unittest/linux_libs/scripts_d4rl/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ conda env config vars set LD_PRELOAD=$LD_PRELOAD:$STDC_LOC
conda deactivate && conda activate ./env

# this workflow only tests the libs
python -c "import habitat;import habitat.gym"
python -c """from torchrl.envs.libs.habitat import HabitatEnv
env = HabitatEnv('HabitatRenderPick-v0')
env.reset()
"""
python -c "import gym, d4rl"

python .circleci/unittest/helpers/coverage_run_parallel.py -m pytest test/test_libs.py --instafail -v --durations 20 --capture no -k TestD4RL
coverage combine
Expand Down
17 changes: 17 additions & 0 deletions test/test_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from torchrl.collectors import MultiaSyncDataCollector
from torchrl.collectors.collectors import RandomPolicy
from torchrl.data.datasets.d4rl import _has_d4rl, D4RL_ERR, D4RLExperienceReplay
from torchrl.data.replay_buffers import SamplerWithoutReplacement
from torchrl.envs import EnvCreator, ParallelEnv
from torchrl.envs.libs.brax import _has_brax, BraxEnv
from torchrl.envs.libs.dm_control import _has_dmc, DMControlEnv, DMControlWrapper
Expand Down Expand Up @@ -1163,6 +1164,22 @@ def test_terminate_on_end(self, task):
data_from_env._storage._storage.select(*keys),
)

@pytest.mark.parametrize("split_trajs", [True, False])
def test_d4rl_iteration(self, task, split_trajs):
batch_size = 3
data = D4RLExperienceReplay(
task,
split_trajs=split_trajs,
from_env=False,
terminate_on_end=True,
batch_size=batch_size,
sampler=SamplerWithoutReplacement(drop_last=True),
)
i = 0
for sample in data: # noqa: B007
i += 1
assert len(data) // i == batch_size


if __name__ == "__main__":
args, unknown = argparse.ArgumentParser().parse_known_args()
Expand Down