Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Expand to d4rl-pybullet Support d4rl-pybullet and make a few other changes. * Update NEWS.md and ci.yml Co-authored-by: Jun Tian <find_my_way@foxmail.com>
- Loading branch information
Showing
11 changed files
with
128 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/ReinforcementLearningDatasets/src/d4rl_pybullet/register.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export D4RL_PYBULLET_URLS | ||
|
||
const D4RL_PYBULLET_URLS = Dict( | ||
"hopper-bullet-mixed-v0" => "https://www.dropbox.com/s/xv3p0h7dzgxt8xb/hopper-bullet-mixed-v0.hdf5?dl=1", | ||
"walker2d-bullet-random-v0" => "https://www.dropbox.com/s/1gwcfl2nmx6878m/walker2d-bullet-random-v0.hdf5?dl=1", | ||
"hopper-bullet-medium-v0" => "https://www.dropbox.com/s/w22kgzldn6eng7j/hopper-bullet-medium-v0.hdf5?dl=1", | ||
"walker2d-bullet-mixed-v0" => "https://www.dropbox.com/s/i4u2ii0d85iblou/walker2d-bullet-mixed-v0.hdf5?dl=1", | ||
"halfcheetah-bullet-mixed-v0" => "https://www.dropbox.com/s/scj1rqun963aw90/halfcheetah-bullet-mixed-v0.hdf5?dl=1", | ||
"halfcheetah-bullet-random-v0" => "https://www.dropbox.com/s/jnvpb1hp60zt2ak/halfcheetah-bullet-random-v0.hdf5?dl=1", | ||
"walker2d-bullet-medium-v0" => "https://www.dropbox.com/s/v0f2kz48b1hw6or/walker2d-bullet-medium-v0.hdf5?dl=1", | ||
"hopper-bullet-random-v0" => "https://www.dropbox.com/s/bino8ojd7iq4p4d/hopper-bullet-random-v0.hdf5?dl=1", | ||
"ant-bullet-random-v0" => "https://www.dropbox.com/s/2xpmh4wk2m7i8xh/ant-bullet-random-v0.hdf5?dl=1", | ||
"halfcheetah-bullet-medium-v0" => "https://www.dropbox.com/s/v4xgssp1w968a9l/halfcheetah-bullet-medium-v0.hdf5?dl=1", | ||
"ant-bullet-medium-v0" => "https://www.dropbox.com/s/6n79kwd94xthr1t/ant-bullet-medium-v0.hdf5?dl=1", | ||
"ant-bullet-mixed-v0" => "https://www.dropbox.com/s/pmy3dzab35g4whk/ant-bullet-mixed-v0.hdf5?dl=1" | ||
) | ||
|
||
function d4rl_pybullet_init() | ||
repo = "d4rl-pybullet" | ||
for ds in keys(D4RL_PYBULLET_URLS) | ||
register( | ||
DataDep( | ||
repo* "-" * ds, | ||
""" | ||
Credits: https://github.com/takuseno/d4rl-pybullet | ||
The following dataset is fetched from the d4rl-pybullet. | ||
""", | ||
D4RL_PYBULLET_URLS[ds], | ||
) | ||
) | ||
end | ||
nothing | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
function __init__() | ||
RLDatasets.d4rl_init() | ||
RLDatasets.d4rl_pybullet_init() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Base: batch_size_err_str | ||
@testset "d4rl_pybullet" begin | ||
ds = dataset( | ||
"hopper-bullet-mixed-v0"; | ||
repo="d4rl-pybullet", | ||
style = style, | ||
rng = rng, | ||
is_shuffle = true, | ||
batch_size = batch_size | ||
) | ||
|
||
n_s = 15 | ||
n_a = 3 | ||
|
||
N_samples = 59345 | ||
|
||
data_dict = ds.dataset | ||
|
||
@test size(data_dict[:state]) == (n_s, N_samples) | ||
@test size(data_dict[:action]) == (n_a, N_samples) | ||
@test size(data_dict[:reward]) == (1, N_samples) | ||
@test size(data_dict[:terminal]) == (1, N_samples) | ||
|
||
for sample in Iterators.take(ds, 3) | ||
@test typeof(sample) <: NamedTuple{SARTS} | ||
@test size(sample[:state]) == (n_s, batch_size) | ||
@test size(sample[:action]) == (n_a, batch_size) | ||
@test size(sample[:reward]) == (1, batch_size) || size(sample[:reward]) == (batch_size,) | ||
@test size(sample[:terminal]) == (1, batch_size) || size(sample[:terminal]) == (batch_size,) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters