toybox-rs / Toybox

The Machine Learning Toybox for testing the behavior of autonomous agents.
http://toybox.rs
27 stars 12 forks source link

Fix Python gym environments #176

Closed Miffyli closed 3 years ago

Miffyli commented 3 years ago

Closes #175

On top of the discussed problem with RGB images, I added some other fixes required + a little clarification on the README about using this library. I was initially confused when I saw pip install ctoybox, I did not realize that this repo was not part of that pip install.

With these fixes the following code will run/train as expected (using stable-baselines as this is what I use for my project):

from stable_baselines3 import PPO
from stable_baselines3.common.atari_wrappers import AtariWrapper
import gym
import toybox

env = gym.make("BreakoutToyboxNoFrameskip-v4", alpha=False, grayscale=False)
env = AtariWrapper(env)
agent = PPO("CnnPolicy", env)
agent.learn(1000)
jjfiv commented 3 years ago

I think the broken build is a github-actions version rot that I saw in a similar project. Trying that fix now.