diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md
index abb49e00..93dd601a 100644
--- a/.github/ISSUE_TEMPLATE/bug.md
+++ b/.github/ISSUE_TEMPLATE/bug.md
@@ -8,14 +8,14 @@ title: "[Bug Report] Bug title"
A clear and concise description of what the bug is.
**Code example**
-Bug reports without minimal code examples take 5-10x longer to solve.
+Bug reports without minimal code examples take 5-10x longer to solve.
We'll give you a cookie if you add the stack trace too!
Save time, add code.
**System Info**
Describe the characteristic of your environment:
* Describe how Minari was installed (pip, docker, source, ...)
- * Operating system:
+ * Operating system:
* Python version:
**Additional context**
diff --git a/.github/workflows/build-docs-version.yml b/.github/workflows/build-docs-version.yml
index 41b4a845..f40d4d4f 100644
--- a/.github/workflows/build-docs-version.yml
+++ b/.github/workflows/build-docs-version.yml
@@ -30,7 +30,7 @@ jobs:
- name: Build Datasets Docs
run: python docs/_scripts/gen_dataset_md.py
-
+
- name: Build
run: sphinx-build -b dirhtml -v docs _build
@@ -56,4 +56,4 @@ jobs:
folder: _build
clean-exclude: |
*.*.*/
- main
\ No newline at end of file
+ main
diff --git a/.github/workflows/manual-build-docs-version copy.yml b/.github/workflows/manual-build-docs-version copy.yml
index 4cda292d..fe04597f 100644
--- a/.github/workflows/manual-build-docs-version copy.yml
+++ b/.github/workflows/manual-build-docs-version copy.yml
@@ -63,4 +63,4 @@ jobs:
folder: _build
clean-exclude: |
*.*.*/
- main
\ No newline at end of file
+ main
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 0bc10e40..ff4c4a59 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,17 +1,35 @@
---
repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.5.0
+ hooks:
+ - id: check-symlinks
+ - id: destroyed-symlinks
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-yaml
+ - id: check-toml
+ - id: check-ast
+ - id: check-added-large-files
+ - id: check-merge-conflict
+ - id: check-executables-have-shebangs
+ - id: check-shebang-scripts-are-executable
+ - id: detect-private-key
+ - id: debug-statements
+ - id: mixed-line-ending
+ args: [ --fix=lf ]
- repo: https://github.com/python/black
- rev: 22.8.0
+ rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
- rev: v2.2.1
+ rev: v2.2.6
hooks:
- id: codespell
args:
- --skip=*.css,*.js,*.map,*.scss,*svg
- repo: https://github.com/PyCQA/flake8
- rev: 5.0.4
+ rev: 6.1.0
hooks:
- id: flake8
args:
@@ -29,18 +47,18 @@ repos:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade
- rev: v2.38.0
+ rev: v3.15.0
hooks:
- id: pyupgrade
# TODO: remove `--keep-runtime-typing` option
args: ["--py37-plus", "--keep-runtime-typing"]
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.3.0
+ rev: v4.5.0
hooks:
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/pycqa/pydocstyle
- rev: 6.1.1
+ rev: 6.3.0
hooks:
- id: pydocstyle
args:
@@ -62,4 +80,8 @@ repos:
types: [python]
additional_dependencies: ["pyright@1.1.305"]
args:
- - --project=pyproject.toml
\ No newline at end of file
+ - --project=pyproject.toml
+ - repo: https://github.com/python-jsonschema/check-jsonschema
+ rev: 0.27.1
+ hooks:
+ - id: check-github-workflows
diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst
index f91dd916..06942265 100644
--- a/CODE_OF_CONDUCT.rst
+++ b/CODE_OF_CONDUCT.rst
@@ -65,4 +65,3 @@ Attribution
-----------
This Code of Conduct is adapted from `Python's Code of Conduct `_, which is under a `Creative Commons License
`_.
-
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 78a490c5..9314f2f6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -49,7 +49,7 @@ Tutorials are a crucial way to help people learn how to use Minari and we greatl
- You should make a `.md` file for each tutorial within the above directory.
- Each `.md` file should have an "Environment Setup" section and a "Code" section. The title should be of the format `: `.
- The Environment Setup section should reference the `requirements.txt` file you created using `literalinclude`.
-- The Code section should reference the `.py` file you created using `literalinclude`.
+- The Code section should reference the `.py` file you created using `literalinclude`.
- `/docs/index.md` should be modified to include every new tutorial.
### Testing your tutorial
diff --git a/LICENSE b/LICENSE
index f8a7b14c..66fbb070 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
This repository is licensed as follows:
-All assets in this repository are the copyright of the Farama Foundation, except
+All assets in this repository are the copyright of the Farama Foundation, except
where prohibited. Contributors to the repository transfer copyright of their work
to the Farama Foundation.
@@ -7,7 +7,7 @@ Some code in this repository has been taken from other open source projects
and was originally released under the MIT or Apache 2.0 licenses, with
copyright held by another party. We've attributed these authors and they
retain their copyright to the extent required by law. Everything else
-is owned by the Farama Foundation. The Secret Code font was also released under
+is owned by the Farama Foundation. The Secret Code font was also released under
the MIT license by Matthew Welch (http://www.squaregear.net/fonts/).
The MIT and Apache 2.0 licenses are included below.
diff --git a/README.md b/README.md
index 33344cc4..2e586a0a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![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)
+[![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)
@@ -18,7 +18,7 @@ To install Minari from [PyPI](https://pypi.org/project/minari/):
pip install minari
```
-Note that currently Minari is under a beta release. If you'd like to start testing or contribute to Minari please install this project from source with:
+Note that currently Minari is under a beta release. 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
@@ -30,7 +30,7 @@ pip install -e .
For an introduction to Minari, see [Basic Usage](https://minari.farama.org/main/content/basic_usage/). 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).
-## API
+## API
To check available remote datasets:
diff --git a/bin/Dockerfile b/bin/Dockerfile
index 83557d2c..c8816e8a 100644
--- a/bin/Dockerfile
+++ b/bin/Dockerfile
@@ -28,4 +28,4 @@ WORKDIR /usr/local/minari/
RUN pip install .[testing] --no-cache-dir
-ENTRYPOINT ["/usr/local/minari/bin/docker_entrypoint"]
\ No newline at end of file
+ENTRYPOINT ["/usr/local/minari/bin/docker_entrypoint"]
diff --git a/docs/.gitignore b/docs/.gitignore
index d626a323..06911093 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -17,4 +17,3 @@ datasets/pen/*.md
datasets/pointmaze/*.md
datasets/relocate/*.md
datasets/kitchen/*.md
-
diff --git a/docs/404.md b/docs/404.md
index 6c69ef60..d5baf9a5 100644
--- a/docs/404.md
+++ b/docs/404.md
@@ -1,3 +1,3 @@
# 404 - Page Not Found
-## The requested page could not be found.
\ No newline at end of file
+## The requested page could not be found.
diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css
index 19b9634d..954b0cf4 100644
--- a/docs/_static/css/custom.css
+++ b/docs/_static/css/custom.css
@@ -20,4 +20,4 @@ a.internal-link::after {
to make the mark be on the same line as the link
*/
content: "\00A0↪";
-}
\ No newline at end of file
+}
diff --git a/docs/_static/css/directory_tree.css b/docs/_static/css/directory_tree.css
index 2b57a73e..3fa331ca 100644
--- a/docs/_static/css/directory_tree.css
+++ b/docs/_static/css/directory_tree.css
@@ -1,4 +1,4 @@
-
+
/* The list style
-------------------------------------------------------------- */
diff --git a/docs/_static/img/Minari.svg b/docs/_static/img/Minari.svg
index c62c516f..bd8c844d 100644
--- a/docs/_static/img/Minari.svg
+++ b/docs/_static/img/Minari.svg
@@ -55,7 +55,7 @@
sodipodi:insensitive="true">
-
+
-
+
-
\ No newline at end of file
+
diff --git a/docs/_static/img/doc_icon.svg b/docs/_static/img/doc_icon.svg
index 817b0b0c..450aba76 100644
--- a/docs/_static/img/doc_icon.svg
+++ b/docs/_static/img/doc_icon.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/docs/_static/img/environment_icon.svg b/docs/_static/img/environment_icon.svg
index d9e4da41..c80db800 100644
--- a/docs/_static/img/environment_icon.svg
+++ b/docs/_static/img/environment_icon.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/docs/_static/img/file-svgrepo-com.svg b/docs/_static/img/file-svgrepo-com.svg
index a210eba3..fe2eaeea 100644
--- a/docs/_static/img/file-svgrepo-com.svg
+++ b/docs/_static/img/file-svgrepo-com.svg
@@ -1,2 +1,2 @@
-
\ No newline at end of file
+
diff --git a/docs/_static/img/folder-open-svgrepo-com.svg b/docs/_static/img/folder-open-svgrepo-com.svg
index 47c8d90a..49977487 100644
--- a/docs/_static/img/folder-open-svgrepo-com.svg
+++ b/docs/_static/img/folder-open-svgrepo-com.svg
@@ -1,2 +1,2 @@
-
\ No newline at end of file
+
diff --git a/docs/_static/img/folder-svgrepo-com.svg b/docs/_static/img/folder-svgrepo-com.svg
index 15b172d0..f8b7e9ff 100644
--- a/docs/_static/img/folder-svgrepo-com.svg
+++ b/docs/_static/img/folder-svgrepo-com.svg
@@ -1,2 +1,2 @@
-
\ No newline at end of file
+
diff --git a/docs/_static/img/github_icon.svg b/docs/_static/img/github_icon.svg
index b6f78a53..2b6e248d 100644
--- a/docs/_static/img/github_icon.svg
+++ b/docs/_static/img/github_icon.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/docs/_static/img/menu_icon.svg b/docs/_static/img/menu_icon.svg
index 8ba49328..93aa2547 100644
--- a/docs/_static/img/menu_icon.svg
+++ b/docs/_static/img/menu_icon.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/docs/_static/js/custom.js b/docs/_static/js/custom.js
index 5ad2af9b..45243eb7 100644
--- a/docs/_static/js/custom.js
+++ b/docs/_static/js/custom.js
@@ -102,4 +102,4 @@ function loadVisibleTermynals() {
}
window.addEventListener("scroll", loadVisibleTermynals);
createTermynals();
-loadVisibleTermynals();
\ No newline at end of file
+loadVisibleTermynals();
diff --git a/docs/api/data_collector_callbacks/episode_metadata_callback.md b/docs/api/data_collector_callbacks/episode_metadata_callback.md
index b5e3557b..3a2bda56 100644
--- a/docs/api/data_collector_callbacks/episode_metadata_callback.md
+++ b/docs/api/data_collector_callbacks/episode_metadata_callback.md
@@ -10,4 +10,4 @@
```{eval-rst}
.. autofunction:: minari.EpisodeMetadataCallback.__call__
-```
\ No newline at end of file
+```
diff --git a/docs/api/minari_functions.md b/docs/api/minari_functions.md
index 53a31815..02772cce 100644
--- a/docs/api/minari_functions.md
+++ b/docs/api/minari_functions.md
@@ -55,4 +55,4 @@ minari_dataset/episode_data
```{eval-rst}
.. autofunction:: minari.get_normalized_score
-```
\ No newline at end of file
+```
diff --git a/docs/content/basic_usage.md b/docs/content/basic_usage.md
index e8595acd..44712a6f 100644
--- a/docs/content/basic_usage.md
+++ b/docs/content/basic_usage.md
@@ -9,7 +9,7 @@ Minari is a standard dataset hosting interface for Offline Reinforcement Learnin
## Installation
-To install the most recent version of the Minari library run this command:
+To install the most recent version of the Minari library run this command:
```bash
pip install minari
@@ -30,7 +30,7 @@ We support Python 3.8, 3.9, 3.10 and 3.11 on Linux and macOS.
### Collecting Data
```{eval-rst}
-Minari can abstract the data collection process. This is achieved by using the :class:`minari.DataCollectorV0` wrapper which stores the environments stepping data in internal memory buffers before saving the dataset into disk. The :class:`minari.DataCollectorV0` wrapper can also perform caching by scheduling the amount of episodes or steps that are stored in-memory before saving the data in a temporary `Minari dataset file `_ . This wrapper also computes relevant metadata of the dataset while collecting the data.
+Minari can abstract the data collection process. This is achieved by using the :class:`minari.DataCollectorV0` wrapper which stores the environments stepping data in internal memory buffers before saving the dataset into disk. The :class:`minari.DataCollectorV0` wrapper can also perform caching by scheduling the amount of episodes or steps that are stored in-memory before saving the data in a temporary `Minari dataset file `_ . This wrapper also computes relevant metadata of the dataset while collecting the data.
The wrapper is very simple to initialize:
```
@@ -73,11 +73,11 @@ for _ in range(total_episodes):
# random action policy
action = env.action_space.sample()
obs, rew, terminated, truncated, info = env.step(action)
-
+
if terminated or truncated:
break
-dataset = minari.create_dataset_from_collector_env(dataset_id="CartPole-v1-test-v0",
+dataset = minari.create_dataset_from_collector_env(dataset_id="CartPole-v1-test-v0",
collector_env=env,
algorithm_name="Random-Policy",
code_permalink="https://github.com/Farama-Foundation/Minari",
@@ -137,7 +137,7 @@ for episode_id in range(total_episodes):
# random action policy
action = env.action_space.sample()
obs, rew, terminated, truncated, info = env.step(action)
-
+
if terminated or truncated:
break
@@ -145,7 +145,7 @@ for episode_id in range(total_episodes):
# Update local Minari dataset every 10 episodes.
# This works as a checkpoint to not lose the already collected data
if dataset is None:
- dataset = minari.create_dataset_from_collector_env(dataset_id=dataset_name,
+ dataset = minari.create_dataset_from_collector_env(dataset_id=dataset_name,
collector_env=env,
algorithm_name="Random-Policy",
code_permalink="https://github.com/Farama-Foundation/Minari",
@@ -216,7 +216,7 @@ for i in range(5):
```
```{eval-rst}
-This code will show the following.
+This code will show the following.
```
```bash
@@ -245,7 +245,7 @@ for episode in episodes_generator:
```
```{eval-rst}
-This code will show the following.
+This code will show the following.
```
```bash
@@ -340,7 +340,7 @@ for _ in range(100):
.. note::
There are some datasets that provide a different environment for evaluation purposes than the one used for collecting the data. This environment can be recovered by setting to `True` the `eval_env` argument:
-
+
.. code-block::
import minari
@@ -361,10 +361,10 @@ Lastly, in the case of having two or more Minari datasets created with the same
>>> import minari
>>> human_dataset = minari.load_dataset('door-human-v0')
>>> expert_dataset = minari.load_dataset('door-expert-v0')
->>> combine_dataset = minari.combine_datasets(datasets_to_combine=[human_dataset, expert_dataset],
+>>> combine_dataset = minari.combine_datasets(datasets_to_combine=[human_dataset, expert_dataset],
new_dataset_id="door-all-v0")
>>> combine_dataset.name
'door-all-v0'
>>> minari.list_local_datasets()
dict_keys(['door-all-v0', 'door-human-v0', 'door-expert-v0'])
-```
\ No newline at end of file
+```
diff --git a/docs/content/dataset_standards.md b/docs/content/dataset_standards.md
index b702ff70..3c205599 100644
--- a/docs/content/dataset_standards.md
+++ b/docs/content/dataset_standards.md
@@ -177,7 +177,7 @@ The stepping data inside the episode group is divided into some required `datase
-In the case where, the observation space is a relatively complex `Dict` space with the following definition:
+In the case where, the observation space is a relatively complex `Dict` space with the following definition:
```
spaces.Dict(
{
@@ -191,7 +191,7 @@ spaces.Dict(
}
)
```
-and the action space is a `Box` space, the resulting Minari dataset `HDF5` file will end up looking as follows:
+and the action space is a `Box` space, the resulting Minari dataset `HDF5` file will end up looking as follows:
@@ -256,7 +256,7 @@ and the action space is a `Box` space, the resulting Minari dataset `HDF5` file
-
+
actions
terminations
truncations
@@ -287,7 +287,7 @@ and the action space is a `Box` space, the resulting Minari dataset `HDF5` file
-Similarly, consider the case where we have a `Box` space as an observation space and a relatively complex `Tuple` space as an action space with the following definition:
+Similarly, consider the case where we have a `Box` space as an observation space and a relatively complex `Tuple` space as an action space with the following definition:
```
spaces.Tuple(
(
@@ -301,7 +301,7 @@ spaces.Tuple(
)
)
```
-In this case, the resulting Minari dataset `HDF5` file will end up looking as follows:
+In this case, the resulting Minari dataset `HDF5` file will end up looking as follows:
@@ -406,7 +406,7 @@ The required `datasets` found in the episode groups correspond to the data invol
- `observations`: `shape=(num_steps + 1, observation_space_component_shape)`. Observations nest in the same way as actions if the top level space is a `Tuple` or `Dict` space. The value of `num_steps + 1` is the same for datasets at any level under `observations`. These datasets have an additional element because the initial observation of the environment when calling `obs, info = env.reset()` is also saved. `observation_space_component_shape` will vary between datasets, depending on the shapes of the simple spaces specified in the observation space.
- `rewards`: `shape=(num_steps, 1)`, stores the returned reward in each step.
- `terminations`: `shape=(num_steps, 1)`, the `dtype` is `np.bool` and the last element value will be `True` if the episode finished due to a `terminated` step return.
-- `truncations`: `shape=(num_steps, 1)`, the `dtype` is `np.bool` and the last element value will be `True` if the episode finished due to a `truncated` step return.
+- `truncations`: `shape=(num_steps, 1)`, the `dtype` is `np.bool` and the last element value will be `True` if the episode finished due to a `truncated` step return.
The `dtype` of the numpy array datasets can be of any type compatible with [`h5py`](https://docs.h5py.org/en/latest/faq.html#what-datatypes-are-supported).
@@ -526,7 +526,7 @@ The Minari storage format supports the following observation and action spaces:
| [Text](https://github.com/Farama-Foundation/Gymnasium/blob/main/gymnasium/spaces/text.py) |The elements of this space are bounded strings from a charset. Note: at the moment, we don't guarantee support for all surrogate pairs. | |
#### Space Serialization
-Spaces are serialized to a JSON format when saving to disk. This serialization supports all space types supported by Minari, and aims to be both human, and machine readable. The serialized action and observation spaces for the episodes in the dataset are saved as strings in the global HDF5 group metadata in `main_data.hdf5` for a particular dataset as `action_space` and `observation_space` respectively. All episodes in `main_data.hdf5` must have observations and actions that comply with these action and observation spaces.
+Spaces are serialized to a JSON format when saving to disk. This serialization supports all space types supported by Minari, and aims to be both human, and machine readable. The serialized action and observation spaces for the episodes in the dataset are saved as strings in the global HDF5 group metadata in `main_data.hdf5` for a particular dataset as `action_space` and `observation_space` respectively. All episodes in `main_data.hdf5` must have observations and actions that comply with these action and observation spaces.
## Minari Data Structures
diff --git a/docs/content/minari_cli.md b/docs/content/minari_cli.md
index 3a241264..db5a8cfc 100644
--- a/docs/content/minari_cli.md
+++ b/docs/content/minari_cli.md
@@ -24,7 +24,7 @@ $ minari --help
Usage: minari [OPTIONS] COMMANDS [ARGS]...
-Minari is a tool for collecting and hosting Offline datasets for Reinforcement Learning environments based on the Gymnaisum API.
+Minari is a tool for collecting and hosting Offline datasets for Reinforcement Learning environments based on the Gymnaisum API.
╭─ Options ─────────────────────────────────────────╮
│ --version-v Show installed │
@@ -48,7 +48,7 @@ Minari is a tool for collecting and hosting Offline datasets for Reinforcement L
## List datasets
-The `minari list COMMAND` command shows a table with the existing Minari datasets as well as some of their metadata such as number of episodes and steps in the dataset as well as the author's name and email.
+The `minari list COMMAND` command shows a table with the existing Minari datasets as well as some of their metadata such as number of episodes and steps in the dataset as well as the author's name and email.
This command comes with other two required sub-commands:
- `remote`: the Minari dataset table shows the datasets currently available in the remote Farama server.
@@ -67,21 +67,21 @@ This command comes with other two required sub-commands:
// Show local datasets.
$ minari list local
- Local Minari datasets('.minari/')
-┌───────────────┬───────────┬───────────┬─────────┬───────────┐
+ Local Minari datasets('.minari/')
+┌───────────────┬───────────┬───────────┬─────────┬───────────┐
│ │ Total │ Total │ │ │
│ Name │ Episodes │ Steps │ Author │ Email │
┡───────────────╇───────────╇───────────╇─────────╇───────────┩
│ pen-cloned-v0 │ 3736 │ 500000 │ Rodrigo │ rperezvic…│
│ pen-expert-v0 │ 4958 │ 499206 │ Rodrigo │ rperezvic…│
│ pen-human-v0 │ 25 │ 5000 │ Rodrigo │ rperezvic…│
-└───────────────┴───────────┴───────────┴─────────┴───────────┘
+└───────────────┴───────────┴───────────┴─────────┴───────────┘
// Show remote datasets.
$ minari list remote
- Minari datasets in Farama server
-┌────────────────┬───────────┬────────────┬─────────┬───────────┐
+ Minari datasets in Farama server
+┌────────────────┬───────────┬────────────┬─────────┬───────────┐
│ │ Total │ Total │ │ │
│ Name │ Episodes │ Steps │ Author │ Email │
┡────────────────╇───────────╇────────────╇─────────╇───────────┩
@@ -91,7 +91,7 @@ $ minari list remote
│ pen-cloned-v0 │ 3736 │ 500000 │ Rodrigo │ rperezvic…│
│ pen-expert-v0 │ 4958 │ 499206 │ Rodrigo │ rperezvic…│
│ pen-human-v0 │ 25 │ 5000 │ Rodrigo │ rperezvic…│
-└────────────────┴───────────┴────────────┴─────────┴───────────┘
+└────────────────┴───────────┴────────────┴─────────┴───────────┘
```
@@ -124,7 +124,7 @@ Dataset pen-expert-v0 downloaded to /.minari/datasets/pe
Downloading door-human-v0 from Farama servers...
* Downloading data file 'door-human-v0/data/main_data.hdf5' ...
-
+
---> 100%
Dataset door-human-v0 downloaded to /.minari/datasets/pen-expert-v0
@@ -142,14 +142,14 @@ Local Minari datasets can be deleted by instantiating the following command, `mi
// Delete datasets pen-cloned-v0 and door-human-v0
$ minari delete pen-cloned-v0 door-human-v0
- Delete local Minari datasets
-┌────────────────┬───────────┬────────────┬─────────┬───────────┐
+ Delete local Minari datasets
+┌────────────────┬───────────┬────────────┬─────────┬───────────┐
│ │ Total │ Total │ │ │
│ Name │ Episodes │ Steps │ Author │ Email │
┡────────────────╇───────────╇────────────╇─────────╇───────────┩
│ door-human-v0 │ 25 │ 6729 │ Rodrigo │ rperezvic…│
│ pen-cloned-v0 │ 3736 │ 500000 │ Rodrigo │ rperezvic…│
-└────────────────┴───────────┴────────────┴─────────┴───────────┘
+└────────────────┴───────────┴────────────┴─────────┴───────────┘
# Are you sure you want to delete these local datasets? [y/N]:$ y
@@ -164,7 +164,7 @@ Dataset pen-cloned-v0 deleted!
If you would like to upload your own Minari dataset to the remote server please get in touch with the Farama team at [contact@farama.org](mailto:contact@farama.org). We will share with you a json encryption key file to give you permission to upload data to our GCP bucket. Then you can upload your dataset with the command `minari upload DATASETS --key-path PATH_STRING/KEY_FILE.json`.
```{eval-rst}
-.. note::
+.. note::
The progress bar shown in the example below is not currently implemented in the Minari package.
```
@@ -194,4 +194,4 @@ $ minari combine pen-cloned-v0 pen-expert-v0 pen-human-v0 --dataset-name pen-all
The datasets ['pen-cloned-v0', 'pen-expert-v0', 'pen-human-v0'] were successfully combined into pen-all-v0!
```
-
\ No newline at end of file
+
diff --git a/docs/datasets/antmaze.md b/docs/datasets/antmaze.md
index 8c5c004d..9b182bd9 100644
--- a/docs/datasets/antmaze.md
+++ b/docs/datasets/antmaze.md
@@ -5,7 +5,7 @@ lastpage:
# Ant Maze
-The [Ant Maze](https://robotics.farama.org/envs/maze/ant_maze/) datasets present a navigation domain that replaces the 2D ball from pointmaze with the more complex 8-DoF Ant quadraped robot. This dataset was introduced in [D4RL](https://github.com/Farama-Foundation/D4RL/wiki/Tasks#antmaze)[1] to test the stitching challenge using a
+The [Ant Maze](https://robotics.farama.org/envs/maze/ant_maze/) datasets present a navigation domain that replaces the 2D ball from pointmaze with the more complex 8-DoF Ant quadruped robot. This dataset was introduced in [D4RL](https://github.com/Farama-Foundation/D4RL/wiki/Tasks#antmaze)[1] to test the stitching challenge using a
morphologically complex robot that could mimic real-world robotic navigation tasks. Additionally, for this task the reward is sparse 0-1 which is activated upon reaching the goal.
To collect the data, a goal reaching expert policy is previously trained with the [SAC](https://stable-baselines3.readthedocs.io/en/master/modules/sac.html#stable_baselines3.sac.SAC) algorithm provided in Stable Baselines 3[2]. This goal reaching policy is then used by the Ant agent to follow a set of waypoints generated by a planner ([QIteration](https://towardsdatascience.com/fundamental-iterative-methods-of-reinforcement-learning-df8ff078652a))[3] to the final goal location. Because the controllers memorize the reached waypoints, the data collection policy is non-Markovian.
diff --git a/docs/datasets/pen.md b/docs/datasets/pen.md
index 895fd96e..a00686ca 100644
--- a/docs/datasets/pen.md
+++ b/docs/datasets/pen.md
@@ -21,4 +21,3 @@ pen/cloned.md
[1] Rajeswaran, Aravind, et al. ‘Learning Complex Dexterous Manipulation with Deep Reinforcement Learning and Demonstrations’. CoRR, vol. abs/1709.10087, 2017, http://arxiv.org/abs/1709.10087.
[2] Fu, Justin, et al. ‘D4RL: Datasets for Deep Data-Driven Reinforcement Learning’. CoRR, vol. abs/2004.07219, 2020, https://arxiv.org/abs/2004.07219.
-
diff --git a/docs/index.md b/docs/index.md
index ba5f6520..fec3f1ac 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -76,15 +76,15 @@ $ pip install minari
// Show remote datasets.
$ minari list remote
- Minari datasets in Farama server
-┌────────────────┬───────────┬────────────┬─────────┬───────────┐
+ Minari datasets in Farama server
+┌────────────────┬───────────┬────────────┬─────────┬───────────┐
│ │ Total │ Total │ │ │
│ Name │ Episodes │ Steps │ Author │ Email │
┡────────────────╇───────────╇────────────╇─────────╇───────────┩
│ door-cloned-v0 │ 4356 │ 1000000 │ Farama │@farama.org│
│ door-expert-v0 │ 5000 │ 1000000 │ Farama │@farama.org│
│ door-human-v0 │ 25 │ 6729 │ Farama │@farama.org│
-└────────────────┴───────────┴────────────┴─────────┴───────────┘
+└────────────────┴───────────┴────────────┴─────────┴───────────┘
// Download dataset door-cloned-v0
$ minari download door-cloned-v0
diff --git a/docs/requirements.txt b/docs/requirements.txt
index a7f338d1..b65e1b2e 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -5,5 +5,6 @@ myst-parser
google-cloud-storage==2.5.0
gymnasium-robotics>=1.2.1
minigrid>=2.2.0
+rl_zoo3>=2.0.0
git+https://github.com/sphinx-gallery/sphinx-gallery.git@4006662c8c1984453a247dc6d3df6260e5b00f4b#egg=sphinx_gallery
git+https://github.com/Farama-Foundation/Celshast#egg=furo
diff --git a/docs/tutorials/README.rst b/docs/tutorials/README.rst
index 7bbc0e06..b516e1d0 100644
--- a/docs/tutorials/README.rst
+++ b/docs/tutorials/README.rst
@@ -1,2 +1,2 @@
Tutorials
----------
\ No newline at end of file
+---------
diff --git a/docs/tutorials/dataset_creation/README.rst b/docs/tutorials/dataset_creation/README.rst
index 6ef4be68..0979d322 100644
--- a/docs/tutorials/dataset_creation/README.rst
+++ b/docs/tutorials/dataset_creation/README.rst
@@ -1,2 +1,2 @@
Dataset Creation
-----------------
\ No newline at end of file
+----------------
diff --git a/docs/tutorials/using_datasets/README.rst b/docs/tutorials/using_datasets/README.rst
index f6e51ef4..13d5c9a7 100644
--- a/docs/tutorials/using_datasets/README.rst
+++ b/docs/tutorials/using_datasets/README.rst
@@ -1,2 +1,2 @@
Using Datasets
-----------------
\ No newline at end of file
+----------------
diff --git a/docs/tutorials/using_datasets/behavioral_cloning.py b/docs/tutorials/using_datasets/behavioral_cloning.py
index c3d79789..7f9eecf8 100644
--- a/docs/tutorials/using_datasets/behavioral_cloning.py
+++ b/docs/tutorials/using_datasets/behavioral_cloning.py
@@ -7,25 +7,14 @@
# We will start generating the dataset of the expert policy for the `CartPole-v1 `_ environment, which is a classic control problem.
# The objective is to balance the pole on the cart, and we receive a reward of +1 for each successful timestep.
-# %%
-# Policy training
-# ~~~~~~~~~~~~~~~~~~~
-# To train the expert policy, we use `SB3 `_'s `rl-zoo3 `_ library.
-# After installing the library, we train a PPO agent on the environment:
-
-!pip install rl_zoo3
-!python -m rl_zoo3.train --algo ppo --env CartPole-v1``
-
-# %%
-# This will generate a new folder named `log` with the expert policy.
-
# %%
# Imports
# ~~~~~~~~~~~~~~~~~~~
-# Let's import all the required packages and set the random seed for reproducibility:
-
+# For this tutorial you will need the `RL Baselines3 Zoo `_ library, which you can install with `pip install rl_zoo3`.
+# Let's then import all the required packages and set the random seed for reproducibility:
import os
+import sys
import gymnasium as gym
import numpy as np
@@ -33,6 +22,7 @@
import torch.nn as nn
import torch.nn.functional as F
from gymnasium import spaces
+from rl_zoo3.train import train
from stable_baselines3 import PPO
from torch.utils.data import DataLoader
from tqdm.auto import tqdm
@@ -40,8 +30,22 @@
import minari
from minari import DataCollectorV0
+
torch.manual_seed(42)
+# %%
+# Policy training
+# ~~~~~~~~~~~~~~~~~~~
+# Now we can train the expert policy using RL Baselines3 Zoo.
+# We train a PPO agent on the environment:
+
+sys.argv = ["python", "--algo", "ppo", "--env", "CartPole-v1"]
+train()
+
+# %%
+# This will generate a new folder named `log` with the expert policy.
+
+
# %%
# Dataset generation
# ~~~~~~~~~~~~~~~~~~~
diff --git a/minari/data_collector/data_collector.py b/minari/data_collector/data_collector.py
index 3c9aa90a..31374c69 100644
--- a/minari/data_collector/data_collector.py
+++ b/minari/data_collector/data_collector.py
@@ -74,7 +74,7 @@ def __init__(
observation_space=None,
action_space=None,
):
- """Initialize the data colletor attributes and create the temporary directory for caching.
+ """Initialize the data collector attributes and create the temporary directory for caching.
Args:
env (gym.Env): Gymnasium environment
diff --git a/minari/dataset/minari_dataset.py b/minari/dataset/minari_dataset.py
index b4817561..6feb0571 100644
--- a/minari/dataset/minari_dataset.py
+++ b/minari/dataset/minari_dataset.py
@@ -83,7 +83,7 @@ def __init__(
Args:
data (Union[MinariStorage, PathLike]): source of data.
- episode_indices (Optiona[np.ndarray]): slice of episode indices this dataset is pointing to.
+ episode_indices (Optional[np.ndarray]): slice of episode indices this dataset is pointing to.
"""
if isinstance(data, MinariStorage):
self._data = data
diff --git a/minari/dataset/minari_storage.py b/minari/dataset/minari_storage.py
index bc9dc4d4..a7a82be8 100644
--- a/minari/dataset/minari_storage.py
+++ b/minari/dataset/minari_storage.py
@@ -227,7 +227,7 @@ def get_episodes(self, episode_indices: Iterable[int]) -> List[dict]:
return out
def update_episodes(self, episodes: Iterable[dict]):
- """Update epsiodes in the storage from a list of episode buffer.
+ """Update episodes in the storage from a list of episode buffer.
Args:
episodes (Iterable[dict]): list of episodes buffer.
@@ -254,7 +254,7 @@ def update_episodes(self, episodes: Iterable[dict]):
_add_episode_to_group(eps_buff, episode_group)
current_steps = file.attrs["total_steps"]
- assert type(current_steps) == np.int64
+ assert isinstance(current_steps, np.int64)
total_steps = current_steps + additional_steps
total_episodes = len(file.keys())
@@ -267,13 +267,13 @@ def update_from_storage(self, storage: MinariStorage):
Args:
storage (MinariStorage): the other MinariStorage from which the data will be taken
"""
- if type(storage) != type(self):
+ if not isinstance(storage, MinariStorage):
# TODO: relax this constraint. In theory one can use MinariStorage API to update
raise ValueError(f"{type(self)} cannot update from {type(storage)}")
with h5py.File(self._file_path, "a", track_order=True) as file:
last_episode_id = file.attrs["total_episodes"]
- assert type(last_episode_id) == np.int64
+ assert isinstance(last_episode_id, np.int64)
storage_total_episodes = storage.total_episodes
for id in range(storage.total_episodes):
@@ -294,7 +294,7 @@ def update_from_storage(self, storage: MinariStorage):
"total_episodes", last_episode_id + storage_total_episodes
)
total_steps = file.attrs["total_steps"]
- assert type(total_steps) == np.int64
+ assert isinstance(total_steps, np.int64)
file.attrs.modify("total_steps", total_steps + storage.total_steps)
storage_metadata = storage.metadata
@@ -320,7 +320,7 @@ def total_episodes(self) -> np.int64:
"""Total episodes in the dataset."""
with h5py.File(self._file_path, "r") as file:
total_episodes = file.attrs["total_episodes"]
- assert type(total_episodes) == np.int64
+ assert isinstance(total_episodes, np.int64)
return total_episodes
@property
@@ -328,7 +328,7 @@ def total_steps(self) -> np.int64:
"""Total steps in the dataset."""
with h5py.File(self._file_path, "r") as file:
total_steps = file.attrs["total_steps"]
- assert type(total_steps) == np.int64
+ assert isinstance(total_steps, np.int64)
return total_steps
@property
diff --git a/minari/serialization.py b/minari/serialization.py
index 83400801..7f7ee1a5 100644
--- a/minari/serialization.py
+++ b/minari/serialization.py
@@ -20,7 +20,7 @@ def _serialize_box(space: spaces.Box, to_string=True) -> Union[Dict, str]:
result["type"] = "Box"
result["dtype"] = str(space.dtype)
result["shape"] = list(space.shape)
- # we have to use python float type to serialze the np.float32 types
+ # we have to use python float type to serialize the np.float32 types
result["low"] = space.low.tolist()
result["high"] = space.high.tolist()
diff --git a/minari/storage/hosting.py b/minari/storage/hosting.py
index ef03e1d0..4926de1b 100644
--- a/minari/storage/hosting.py
+++ b/minari/storage/hosting.py
@@ -195,7 +195,7 @@ def download_dataset(dataset_id: str, force_download: bool = False):
print(f"\nDataset {dataset_id} downloaded to {file_path}")
- # Skip a force download of an incompatible dataset versino
+ # Skip a force download of an incompatible dataset version
if download_dataset in compatible_dataset_versions:
combined_datasets = load_dataset(dataset_id).spec.combined_datasets
diff --git a/minari/utils.py b/minari/utils.py
index b4beedea..ed451831 100644
--- a/minari/utils.py
+++ b/minari/utils.py
@@ -264,7 +264,7 @@ def split_dataset(
Args:
dataset (MinariDataset): the MinariDataset to split
sizes (List[int]): sizes of the resulting datasets
- seed (Optiona[int]): random seed
+ seed (Optional[int]): random seed
Returns:
datasets (List[MinariDataset]): resulting list of datasets