A recorder for open ai gym. you can easily add a text on the frame
Project description
gym_recorder
usage
pip install gym_recorder
import gym
from gym_recorder import Recorder
src_env = gym.make("CartPole-v1")
env = Recorder(src_env, episode_num=10)
for ep in range(10):
obs = env.reset()
done = False
while not done:
action = env.action_space.sample()
n_obs, reward, done, info = env.step(action)
env.txtqueue.append(f"episode:{ep}")
env.txtqueue.append(f"obs:{obs}")
env.txtqueue.append(f"action:{action}")
env.txtqueue.append(f"reward:{reward}")
env.txtqueue.append(f"next obs:{n_obs}")
tips
this library depends on opencv-python. so you may need some library to use opencv. this is .Dockerfile example to resolve it.
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y libgl1-mesa-dev
if you use docker, you have to set "SDL_VIDEODRIVER" to "dummy".
add this to your .Dockerfile
ENV SDL_VIDEODRIVER=dummy
or simply add this to your script.
import os
os.environ["SDL_VIDEODRIVER"] = "dummy"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gym-record-0.0.1.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for gym_record-0.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b37f2a810006d4041d50fb9b865e898fd9e9e4840b232bf3cb3f6ba2ac5182f |
|
MD5 | ac8c4809a26482c16c3034a1e0dfb6bf |
|
BLAKE2b-256 | e63857d498df225e79c9877b71e0c39628c70bbfc0c7056e804ddbebbd07cd6d |