Skip to content Skip to sidebar Skip to footer

Register Gym Environment That Is Defined Inside A Jupyter Notebook Cell

I'm trying to register an environment that has been defined inside a cell of a jupyter notebook running on colab. My problem is concerned with the entry_point. Some module has to b

Solution 1:

After writing this question I finally figured out the right key words to conduct a proper search to find the solution.

The underlying module name can be retrieved using

import sys
sys.modules[__name__]

Therefore the module's name for the entrypoint is "main".

try:
  gym.envs.register(
      id='myenv-v0',
      entry_point='__main__:MyEnv',
      max_episode_steps=320
  )
except:
    pass

Post a Comment for "Register Gym Environment That Is Defined Inside A Jupyter Notebook Cell"