[![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).
## 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/0a/50/58d00cc233e1b4c82c4206c2c54a10c1ac5c48fe0e6b6d59e53dda616987/minari-0.5.1.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## 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.1",
"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": "887a8919763297cfb34ffae36b5edc9f83902af408848b5b0c5a28ca467a82f6",
"md5": "f7c638a292c116b7199cf12c732f0ad5",
"sha256": "6fdcf0e352e3b80fa2c879bd15666ed68ba05a97e7ce69d69e894969c440c344"
},
"downloads": -1,
"filename": "minari-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f7c638a292c116b7199cf12c732f0ad5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 51380,
"upload_time": "2024-10-09T10:34:39",
"upload_time_iso_8601": "2024-10-09T10:34:39.581350Z",
"url": "https://files.pythonhosted.org/packages/88/7a/8919763297cfb34ffae36b5edc9f83902af408848b5b0c5a28ca467a82f6/minari-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0a5058d00cc233e1b4c82c4206c2c54a10c1ac5c48fe0e6b6d59e53dda616987",
"md5": "5c5085e8505625fe641ab8f8354a987f",
"sha256": "aaa6e79c5b03cdbb587a6474ccf250a2e0bfa365bfc009343695df4eb09ea7ab"
},
"downloads": -1,
"filename": "minari-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "5c5085e8505625fe641ab8f8354a987f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 46822,
"upload_time": "2024-10-09T10:34:41",
"upload_time_iso_8601": "2024-10-09T10:34:41.245338Z",
"url": "https://files.pythonhosted.org/packages/0a/50/58d00cc233e1b4c82c4206c2c54a10c1ac5c48fe0e6b6d59e53dda616987/minari-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-09 10:34:41",
"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"
}