I’m trying to record the observations from a custom env.
I implemented the render
method for my environment that just returns an RGB array.
If I set monitor: True
then Gym complains that: WARN: Trying to monitor an environment which has no 'spec' set. This usually means you did not create it via 'gym.make', and is recommended only for advanced users.
So using the workflow to first register my env as a Gym env and then as an RLlib env works:
gym_register(id="env-v0", entry_point="EnvClass")
def env_creator(env_name, config):
env = gym.make(env_name)
return env
rllib_register("env-v0", lambda config: env_creator("env-v0", config))
However, there’s still nothing recorded. Also, I don’t know how to pass a config to gym.make
, but that’s a separate issue.
There’s also the render_env
and record_env
parameters in the config, but if I set them to true, I get:
File "/home/user/miniconda3/envs/sym-rl/lib/python3.8/site-packages/ray/rllib/agents/trainer_template.py", line 106, in __init__
Trainer.__init__(self, config, env, logger_creator)
File "/home/user/miniconda3/envs/sym-rl/lib/python3.8/site-packages/ray/rllib/agents/trainer.py", line 465, in __init__
super().__init__(config, logger_creator)
File "/home/user/miniconda3/envs/sym-rl/lib/python3.8/site-packages/ray/tune/trainable.py", line 96, in __init__
self.setup(copy.deepcopy(self.config))
File "/home/user/miniconda3/envs/sym-rl/lib/python3.8/site-packages/ray/rllib/agents/trainer.py", line 577, in setup
self.config = Trainer.merge_trainer_configs(self._default_config,
File "/home/user/miniconda3/envs/sym-rl/lib/python3.8/site-packages/ray/rllib/agents/trainer.py", line 1055, in merge_trainer_configs
return deep_update(config1, config2, _allow_unknown_configs,
File "/home/user/miniconda3/envs/sym-rl/lib/python3.8/site-packages/ray/tune/utils/util.py", line 220, in deep_update
raise Exception("Unknown config parameter `{}` ".format(k))
Exception: Unknown config parameter `render_env`
So what’s the right workflow to have the rendered environment recorded?
Thanks