Skip to main content

Transition Recorder Wrapper for Gym Environments

A simple and ubiquitous transition recorder wrapper for Gym Environments to facilitate offline Reinforcement Learning (RL) dataset manufacturing. Transitions (observations, actions, rewards, dones & infos) and episodes (set of transitions) are buffered with LZ4 compression and each episode is saved as a JSON line (.jsonl). Output files may be further processed to be compatible with offline RL libraries like Ray RLlib (see Usage).

Requirements

  • Python >= 3.6
  • Pypi packages: pip install -r requirements.txt

Usage

Simply import & wrap your Gym environment:

import gym
from gym_recorder import TransitionRecorderWrapper  # import the wrapper

env = gym.make("CartPole-v1")
env = TransitionRecorderWrapper(env)  # wrap your environment
env.reset()

# Use your environment as you would
while True:
    env.render()
    action = env.action_space.sample()
    obs, reward, done, info = env.step(action)
    if done:
        env.reset()

You may also use the save_folder option to customize where the transitions are saved, min_transitions_per_file to customize the output file size, and disable compression with the compress option.

Conversion

The generated .jsonl files may be further processed to be used by offline RL libraries like Ray RLlib. To convert a .jsonl dataset generated by the wrapper to a RLlib offline dataset you may run the following command:

python -m gym_recorder.converters.ray -i data/raw -o data/ray

More options can be found with python -m gym_recorder.converters.ray --help.

Metadata

Release files for gym-recorder 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gym-recorder 0.0.3
File Size Uploaded Provenance Actions
gym-recorder-0.0.3.tar.gz 3.0 kB Without provenance Details for gym-recorder-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gym-recorder 0.0.3
File Interpreter ABI Platform Actions
gym_recorder-0.0.3-py3-none-any.whl Python 3 none any Details for gym_recorder-0.0.3-py3-none-any.whl

Total release size: 6.0 kB

Release files / gym-recorder-0.0.3.tar.gz

Download URL gym-recorder-0.0.3.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2c1a4cc9c5bccfbb35d0e313650604f678416c0680c185af88d9ba352da0820e
BLAKE2b-256 checksum
How to use checksums
8d4da505083c82d5538fcb9fd2d63fc388ca7f1e1be4c61529061b559c54da5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / gym_recorder-0.0.3-py3-none-any.whl

Download URL gym_recorder-0.0.3-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68b2dcf73f964b2f9be1f076145e36a7b6af5ebdadb92669edf54213054edf9f
BLAKE2b-256 checksum
How to use checksums
9ee87d71807d8c0255c98cf563e2548d71956f6c26f658d10215b1a05c499627
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Security for gym-recorder 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page