coax-dev / coax

Modular framework for Reinforcement Learning in python
https://coax.readthedocs.io
MIT License
168 stars 17 forks source link

Changed assertion in generate_gif to check on returned datatype #38

Closed pixelsandpointers closed 1 year ago

pixelsandpointers commented 1 year ago

G'day guys, I have just stumbled across coax today and wanted to run the examples. However, an assert statement in the generate_gif function was unable to pass (see #37). The problem could be isolated to only Atari environments, which do return None for the render_mode. Perhaps due to this change: https://github.com/openai/gym/blob/6a04d49722724677610e36c1f92908e72f51da0c/gym/envs/registration.py#L631 where the internal representation is automatically set to None if it does only work with the compatibility layer.

I changed the assertion to work onto the datatype which should always be an np.ndarray for the env.render_mode = 'rgb_array', and also differentiates from env.render_mode = 'rgb_array_list' which returns a list[np.ndarray].

image

This is only a minor problem but could solve some issues for people who want to try out the package and try the notebooks first.

Hope this helps. – Ben

Edit: This is the link to the test notebook: https://github.com/benjaminbeilharz/coax/blob/main/doc/_notebooks/atari/dqn.ipynb

KristianHolsheimer commented 1 year ago

Fixes #37