[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
<p align="center">
<img src="minari-text.png" width="500px"/>
</p>
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](https://minari.farama.org/main/). 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](https://pypi.org/project/minari/):
```bash
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:
```bash
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
cd Minari
pip install -e ".[all]"
```
## Command Line API
To check available remote datasets:
```bash
minari list remote
```
To download a dataset:
```bash
minari download D4RL/door/human-v2
```
To check available local datasets:
```bash
minari list local
```
To show the details of a dataset:
```bash
minari show D4RL/door/human-v2
```
For the list of commands:
```bash
minari --help
```
## Basic Usage
### Reading a Dataset
```python
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
```python
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](https://minari.farama.org/main/content/basic_usage/). For a complete tutorial on how to create new datasets using Minari, see our [Pointmaze D4RL Dataset](https://minari.farama.org/main/tutorials/dataset_creation/point_maze_dataset/) tutorial, which re-creates the Maze2D datasets from [D4RL](https://github.com/Farama-Foundation/D4RL).
## Training Libraries Integrating Minari
- [TorchRL](https://github.com/pytorch/rl)
- [d3rlpy](https://github.com/takuseno/d3rlpy)
- [AgileRL](https://github.com/AgileRL/AgileRL)
## 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"._
Raw data
{
"_id": null,
"home_page": null,
"name": "minari",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "Reinforcement Learning, Offline RL, RL, AI, Gymnasium, Farama",
"author": null,
"author_email": "Farama Foundation <contact@farama.org>",
"download_url": "https://files.pythonhosted.org/packages/c8/66/3b5b6ce18c0dc7bf4a312ba04e111f317cdfe392c19e45321bb2ad950619/minari-0.5.2.tar.gz",
"platform": null,
"description": "[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n\n<p align=\"center\">\n <img src=\"minari-text.png\" width=\"500px\"/>\n</p>\n\nMinari 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.\n\nThe documentation website is at [minari.farama.org](https://minari.farama.org/main/). 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.\n\n\n## Installation\nTo install Minari from [PyPI](https://pypi.org/project/minari/):\n```bash\npip install minari\n```\n\nThis 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:\n```bash\npip install \"minari[all]\"\n```\n\nIf you'd like to start testing or contribute to Minari please install this project from source with:\n\n```\ngit clone https://github.com/Farama-Foundation/Minari.git\ncd Minari\npip install -e \".[all]\"\n```\n\n## Command Line API\n\nTo check available remote datasets:\n\n```bash\nminari list remote\n```\n\nTo download a dataset:\n\n```bash\nminari download D4RL/door/human-v2\n```\n\nTo check available local datasets:\n\n```bash\nminari list local\n```\nTo show the details of a dataset:\n\n```bash\nminari show D4RL/door/human-v2\n```\n\nFor the list of commands:\n```bash\nminari --help\n```\n\n## Basic Usage\n\n### Reading a Dataset\n\n```python\nimport minari\n\ndataset = minari.load_dataset(\"D4RL/door/human-v2\")\n\nfor episode_data in dataset.iterate_episodes():\n observations = episode_data.observations\n actions = episode_data.actions\n rewards = episode_data.rewards\n terminations = episode_data.terminations\n truncations = episode_data.truncations\n infos = episode_data.infos\n ...\n```\n\n### Writing a Dataset\n\n```python\nimport minari\nimport gymnasium as gym\nfrom minari import DataCollector\n\n\nenv = gym.make('FrozenLake-v1')\nenv = DataCollector(env)\n\nfor _ in range(100):\n env.reset()\n done = False\n while not done:\n action = env.action_space.sample() # <- use your policy here\n obs, rew, terminated, truncated, info = env.step(action)\n done = terminated or truncated\n\ndataset = env.create_dataset(\"frozenlake/test-v0\")\n```\n\nFor other examples, see [Basic Usage](https://minari.farama.org/main/content/basic_usage/). For a complete tutorial on how to create new datasets using Minari, see our [Pointmaze D4RL Dataset](https://minari.farama.org/main/tutorials/dataset_creation/point_maze_dataset/) tutorial, which re-creates the Maze2D datasets from [D4RL](https://github.com/Farama-Foundation/D4RL).\n\n## Training Libraries Integrating Minari\n\n - [TorchRL](https://github.com/pytorch/rl)\n - [d3rlpy](https://github.com/takuseno/d3rlpy)\n - [AgileRL](https://github.com/AgileRL/AgileRL)\n\n\n## Citation\nIf you use Minari, please consider citing it:\n\n```\n@software{minari,\n\tauthor = {Younis, Omar G. and Perez-Vicente, Rodrigo and Balis, John U. and Dudley, Will and Davey, Alex and Terry, Jordan K},\n\tdoi = {10.5281/zenodo.13767625},\n\tmonth = sep,\n\tpublisher = {Zenodo},\n\ttitle = {Minari},\n\turl = {https://doi.org/10.5281/zenodo.13767625},\n\tversion = {0.5.0},\n\tyear = 2024,\n\tbdsk-url-1 = {https://doi.org/10.5281/zenodo.13767625}\n}\n```\n\n\n\n___\n\n_Minari is a shortening of Minarai, the Japanese word for \"learning by observation\"._\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A standard format for offline reinforcement learning datasets, with popular reference datasets and related utilities.",
"version": "0.5.2",
"project_urls": {
"Bug Report": "https://github.com/Farama-Foundation/Minari/issues",
"Documentation": "https://minari.farama.org/",
"Homepage": "https://farama.org",
"Repository": "https://github.com/Farama-Foundation/Minari"
},
"split_keywords": [
"reinforcement learning",
" offline rl",
" rl",
" ai",
" gymnasium",
" farama"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4acb62e355c0d55a9db51739def3a63f337cd037e2eb5f973d7440d4760ac819",
"md5": "3266d83216bc4597e12feaef976b7e01",
"sha256": "2b02d92b220311b8ee2dde04eadfdfc6be815a6f103eaa0adcc44c48e7ca22cb"
},
"downloads": -1,
"filename": "minari-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3266d83216bc4597e12feaef976b7e01",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 55083,
"upload_time": "2024-12-09T15:42:48",
"upload_time_iso_8601": "2024-12-09T15:42:48.715372Z",
"url": "https://files.pythonhosted.org/packages/4a/cb/62e355c0d55a9db51739def3a63f337cd037e2eb5f973d7440d4760ac819/minari-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c8663b5b6ce18c0dc7bf4a312ba04e111f317cdfe392c19e45321bb2ad950619",
"md5": "6520997acc6f3d34aad2c1af4471c710",
"sha256": "c2b4cab1674e41667ba265bf7349d434f2aa048489f9779ba1fc842b99a9e9c5"
},
"downloads": -1,
"filename": "minari-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "6520997acc6f3d34aad2c1af4471c710",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 50040,
"upload_time": "2024-12-09T15:42:49",
"upload_time_iso_8601": "2024-12-09T15:42:49.992802Z",
"url": "https://files.pythonhosted.org/packages/c8/66/3b5b6ce18c0dc7bf4a312ba04e111f317cdfe392c19e45321bb2ad950619/minari-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 15:42:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Farama-Foundation",
"github_project": "Minari",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "minari"
}