Closed weiguowilliam closed 3 years ago
Hey, the KeyError
usually indicates that the environment wasn't registered with gym, so it can't find it. Looking through the code, I can't find where it gets registered, so I'm wondering whether I removed it when cleaning up the code for publication. I'll have a look over the weekend.
Thank you for the suggestion! I'll also check the registration of the environment..
Hey, sorry, I didn't have time yet to properly set everything up and debug (finished PhD, new computer, etc..), but I had a quick look and remembered what I did back then. The environment should be registered here: https://github.com/maximilianigl/DVRL/blob/38e896c929ed682e8cb37516aa1afd9f6070df76/code/main.py#L263
I'm wondering whether something goes wrong here. If you want, you could check if execution properly enters that if branch and executes the register
function. Another alternative I could imagine is that gym had some breaking changes (wouldn't be the first time) and registering now works differently.
Thank you! I'll try that.
Solved.
@weiguowilliam hey, I bumped into this error as well, how did you solve it?
I also bumped into it, I think it's caused by a mismatch with the openAI baseline version, but not sure. @weiguowilliam @shawnshenjx do you maybe have any tips how to solve this ?
Just for future reference. I think the problem was caused by SubProcVecEnv, so using DummyVecEnv should be fine. I'm not sure what is exactly causing the issue, didn't have much time to look into it. My suspicion was that there is now a mismatch with newer versions of OpenAI baselines. I tried an older commit of OpenAI baselines c0fa11a
which works well.
Thank you AAgha66 for your input on how to avoid it. I'm also still not sure what causes it, but I found another (very dirty and hacky solution) is to paste the following into main.py
(I did it at line 78, but shouldn't matter too much):
death_valley_configs = {
"transition_std": 0.025,
"observation_std": 0.0,
"goal_reward": None,
"goal_position": [0.7, 0.5],
"goal_radius": 0.1,
"goal_end": False,
"outside_box_cost": -1.5,
"starting_position": [-0.85, -0.85],
"starting_std": 0.1,
"max_time": 100,
"max_action_value": 0.05,
"action_cost_factor": 0.1,
"shaping_power": 4,
"hill_height": 4,
"box_scale": 10,
}
register(
id="DeathValley-v0",
entry_point="environments.death_valley:DeathValleyEnv",
kwargs=death_valley_configs,
max_episode_steps=75,
)
Something seems to be wrong with registering the environment in the sub-processes and this makes sure it always happens. WARNING: This hard-codes the environmental hyperparams, in particular the observation_std
, which now cannot be changed anymore via the command line!
I can run the sample command in Readme.md well. But when I tried to run MountainHike example:
It gives me the following error message. Can you help me with that? Thank you.