Skip to main content

A standard format for offline reinforcement learning datasets, with popular reference datasets and related utilities.

Project description

build pre-commit Code style: black release

Minari is a Python library for conducting research in offline reinforcement learning, akin to an offline version of Gymnasium or an offline RL version of HuggingFace's datasets library.

The documentation website is at minari.farama.org. We also have a public discord server (which we use for Q&A and to coordinate development work) that you can join here: https://discord.gg/bnJ6kubTg6.

Installation

To install Minari from PyPI:

pip install minari

This will install the minimum required dependencies. Additional dependencies will be prompted for installation based on your use case. To install all dependencies at once, use:

pip install "minari[all]"

If you'd like to start testing or contribute to Minari please install this project from source with:

git clone https://github.com/Farama-Foundation/Minari.git --single-branch
cd Minari
pip install -e ".[all]"

Command Line API

To check available remote datasets:

minari list remote

To download a dataset:

minari download D4RL/door/human-v2

To check available local datasets:

minari list local

To show the details of a dataset:

minari show D4RL/door/human-v2

For the list of commands:

minari --help

Basic Usage

Reading a Dataset

import minari

dataset = minari.load_dataset("D4RL/door/human-v2")

for episode_data in dataset.iterate_episodes():
    observations = episode_data.observations
    actions = episode_data.actions
    rewards = episode_data.rewards
    terminations = episode_data.terminations
    truncations = episode_data.truncations
    infos = episode_data.infos
    ...

Writing a Dataset

import minari
import gymnasium as gym
from minari import DataCollector


env = gym.make('FrozenLake-v1')
env = DataCollector(env)

for _ in range(100):
    env.reset()
    done = False
    while not done:
        action = env.action_space.sample()  # <- use your policy here
        obs, rew, terminated, truncated, info = env.step(action)
        done = terminated or truncated

dataset = env.create_dataset("frozenlake/test-v0")

For other examples, see Basic Usage. For a complete tutorial on how to create new datasets using Minari, see our Pointmaze D4RL Dataset tutorial, which re-creates the Maze2D datasets from D4RL.

Training Libraries Integrating Minari

Citation

If you use Minari, please consider citing it:

@software{minari,
	author = {Younis, Omar G. and Perez-Vicente, Rodrigo and Balis, John U. and Dudley, Will and Davey, Alex and Terry, Jordan K},
	doi = {10.5281/zenodo.13767625},
	month = sep,
	publisher = {Zenodo},
	title = {Minari},
	url = {https://doi.org/10.5281/zenodo.13767625},
	version = {0.5.0},
	year = 2024,
	bdsk-url-1 = {https://doi.org/10.5281/zenodo.13767625}
}

Minari is a shortening of Minarai, the Japanese word for "learning by observation".

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

minari-0.5.3.tar.gz (51.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minari-0.5.3-py3-none-any.whl (56.1 kB view details)

Uploaded Python 3

File details

Details for the file minari-0.5.3.tar.gz.

File metadata

  • Download URL: minari-0.5.3.tar.gz
  • Upload date:
  • Size: 51.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for minari-0.5.3.tar.gz
Algorithm Hash digest
SHA256 8b749b06390ce6d5814b6d23dd24a5a44fa142f65f807bf6a249572d5380cc4b
MD5 775179023a737d90e584c04c1056cca6
BLAKE2b-256 a56e6a81162f3e639c2b553fa6dbd6048a18438f740710f725b7e51263527759

See more details on using hashes here.

File details

Details for the file minari-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: minari-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 56.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for minari-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fc9587ddc3e7b1877185ace33f530b355cd1ec7e072f8df833654cb48d2435c4
MD5 c321189acf92e3306dc90a5c36443fba
BLAKE2b-256 66a759f64ca35a089bad904c60a138bbf4f392de0b29d79e7751a8f1fbe0b4f2

See more details on using hashes here.

Supported by

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