Skip to main content

Easy-to-use D4RL offline dataset loader

Project description

just-d4rl

Easy-to-use D4RL offline dataset loader, focused solely on downloading and providing D4RL datasets without dependencies on gym or gymnasium.

Key Features

  • Downloads and provides D4RL offline datasets
  • No dependencies on gym or gymnasium
  • Lightweight and focused functionality
  • Easy integration with PyTorch

Installation

Install from PyPI:

pip install just-d4rl

Usage

from just_d4rl import D4RLDataset, d4rl_offline_dataset, D4RLScoreNormalizer

# Download and load a D4RL dataset
d4rl_dataset = d4rl_offline_dataset("hopper-medium-v2")

# Example datasets
d4rl_dataset = d4rl_offline_dataset("walker2d-random-v2")
d4rl_dataset = d4rl_offline_dataset("halfcheetah-medium-expert-v2")
d4rl_dataset = d4rl_offline_dataset("antmaze-umaze-v2")

dataset = d4rl_dataset
dataset['observations'].shape, dataset['actions'].shape, dataset['rewards'].shape, dataset['next_observations'].shape, dataset['terminals'].shape
# ((1000000, 11), (1000000, 3), (1000000,), (1000000, 11), (1000000,))

# Create a PyTorch Dataset
d4rl_dataset = d4rl_offline_dataset("hopper-medium-v2")
dataset = D4RLDataset(d4rl_dataset)

# Get a batch of data
batch = dataset[-16:]
batch["observation"].shape, batch["action"].shape, batch["reward"].shape, batch["next_observation"].shape, batch["terminal"].shape
# (torch.Size([16, 11]), torch.Size([16, 3]), torch.Size([16]), torch.Size([16, 11]), torch.Size([16]))


returns = np.random.rand(16, 1)
get_normalized_score = D4RLScoreNormalizer("hopper-medium-v2")
get_normalized_score(returns)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

just_d4rl-0.2407.5.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

just_d4rl-0.2407.5-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file just_d4rl-0.2407.5.tar.gz.

File metadata

  • Download URL: just_d4rl-0.2407.5.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.2

File hashes

Hashes for just_d4rl-0.2407.5.tar.gz
Algorithm Hash digest
SHA256 2836fa9239abbce0d636f452853fa823623b3708e03cec845b9e7d0e222ce915
MD5 46400ffacfbb43aafc5c679c53a77d0d
BLAKE2b-256 72e8ae4981d2856ad051dd684acf1583efc71ec5041c4e1cd901bcd7a7a59945

See more details on using hashes here.

File details

Details for the file just_d4rl-0.2407.5-py3-none-any.whl.

File metadata

File hashes

Hashes for just_d4rl-0.2407.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bf861ae9475c677cd251264beb27149a08f82171a8164a463b07c1c2a2b382ab
MD5 6c479e2ebbae438879c001faa2989654
BLAKE2b-256 da17fcfe66984ee20e7de9c61507a30f69762c2a71eca70801450add0c7612ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page