https://github.com/ryanrudes/colabgymrender
Render OpenAI Gym environments in Google Colaboratory
https://github.com/ryanrudes/colabgymrender
Last synced: 4 months ago
JSON representation
Render OpenAI Gym environments in Google Colaboratory
- Host: GitHub
- URL: https://github.com/ryanrudes/colabgymrender
- Owner: ryanrudes
- License: mit
- Archived: true
- Created: 2021-02-07T00:03:08.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-06T14:52:13.000Z (almost 2 years ago)
- Last Synced: 2024-10-28T22:21:44.844Z (4 months ago)
- Language: Jupyter Notebook
- Homepage: https://pypi.org/project/colabgymrender/
- Size: 163 KB
- Stars: 57
- Watchers: 3
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## This repository has been archived (read below)
Due to breaking changes released in the introduction of `gymnasium`, I have taken a similar route to continue support and avoid confusion, hereby moving all future code maintenance to a newly named repository. See [`renderlab`](https://github.com/ryanrudes/renderlab) for details.# Gym Rendering for Colab
[](https://pypi.python.org/pypi/colabgymrender/)
[](https://pypi.python.org/pypi/colabgymrender/)
[](https://pypi.python.org/pypi/colabgymrender/)

[](https://colab.research.google.com/github/Ryan-Rudes/colabgymrender/blob/main/notebooks/demo.ipynb)## Installation
```bash
apt-get install -y xvfb python-opengl ffmpeg > /dev/null 2>&1
pip install -U colabgymrender
pip install imageio==2.4.1
pip install --upgrade AutoROM
AutoROM --accept-license
pip install gym[atari,accept-rom-license]
```## Usage
```python
import gym
from colabgymrender.recorder import Recorderenv = gym.make("Breakout-v0")
directory = './video'
env = Recorder(env, directory)observation = env.reset()
terminal = False
while not terminal:
action = env.action_space.sample()
observation, reward, terminal, info = env.step(action)env.play()
```## Demo
[Watch it on YouTube](https://youtu.be/nv2dU_9oZJ0)
https://user-images.githubusercontent.com/18452581/116127430-d2afb300-a695-11eb-991a-99d13c015006.mp4
https://user-images.githubusercontent.com/18452581/116128757-48684e80-a697-11eb-9fbd-a716476b7c90.mp4
https://user-images.githubusercontent.com/18452581/116128782-4ef6c600-a697-11eb-80d2-fbf22ff7cf6f.mp4
https://user-images.githubusercontent.com/18452581/116128789-50c08980-a697-11eb-8ed3-6b4f645c3e1f.mp4