-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds infos to EpisodeData
, tests for infos, and adds standards for infos to documentation
#132
Conversation
Infos PR is ready for review :^). |
9f28012
to
556b726
Compare
…cture, and test of using StepDataCallback to fix it
98af413
to
cf35cd7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Omar! It looks great, I just have some minor comments.
Also: At the moment test_truncation_without_reset
only checks that the observation
of the previous timestep is carried over, not the infos
. It might be useful to check that infos
is carried over as well?
Thank you @alexdavey for reviewing it! |
LGTM. Thank you! |
Description
Additional Information Formatting
(Taken from new documentation section)
When creating a dataset with
DataCollectorV0
, the additional information from each timestep to be stored in theinfos
group of the hdf5 file must be provided to Minari as a dict, which can only contain strings as keys and other dictionaries ornp.ndarray
as values. An info dict must be provided for every observation(including the one from the initial reset), and the shape of eachnp.ndarray
must stay the same across timesteps, and the keys must remain the same in alldicts
across timesteps.Here is an example of what a valid info might look like:
Given that it is not guaranteed that all Gymnasium environments provide infos at every timestep, we provide the
StepDataCallback
which can modify the infos from a non-compliant environment so they have the same structure at every timestep. An example of this pattern is available in our testtest_data_collector_step_data_callback_info_correction
in test_step_data_callback.py.For
np.ndarray
typed arrays including in an info, we support the list of data data types supported by h5py. We provide tests to guarantee support for the following numpy data types:np.int8
,np.int16
,np.int32
,np.int64
,np.uint8
,np.uint16
,np.uint32
,np.iunt64
,np.float16
,np.float32
,np.float64
.Additional Comments
This PR also adds tests for
DataCollectorV0
record_info=True
behavior, and ensures that dtypes are preserved when saving to and loading from disk.Related Issues
Fixes #125, #131
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)pytest -v
and no errors are present.pytest -v
has generated that are related to my code to the best of my knowledge.