-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with the latest versions of Gym #37
Comments
One important issue with the new gym version is that we are sometimes stepping the environment before resetting, which this new version does not like. |
I made some tests and it's not a problem to call env = ngym.make('MyEnv')
env: <OrderEnforcing<MyEnv>> # gym.make automatically adds the wrapper OrderEnforcing to the env
# calling env.reset() produces the following chain of calls:
OrderEnforcing.reset()
MyEnv -> TrialEnv.reset() # no problem to call self._top.step() here since OrderEnforcing.reset() has already been called
OrderEnforcing.step()
MyEnv -> TrialEnv.step()
MyEnv._step() However, there is indeed the error tasks = ngym.get_collection('yang19')
envs = [gym.make(task) for task in tasks]
schedule = RandomSchedule(len(envs))
env = ScheduleEnvs(envs, schedule=schedule, env_input=True)
env.reset() But the problem is coming from env = ScheduleEnvs(envs=[ngym.make('MyEnv1'), ngym.make('MyEnv2')])
env:
<ScheduleEnv
<OrderEnforcing<MyEnv1>>
<OrderEnforcing<MyEnv2>>
>
# calling env.reset() produces the following chain of calls:
ScheduleEnv -> TrialWrapper -> Wrapper.reset() # ScheduleEnv.env refers to the first env of the arg envs
OrderEnforcing<MyEnv1>.reset()
MyEnv1 -> TrialEnv.reset()
ScheduleEnv.step() # changes the current env to MyEnv2
OrderEnforcing<MyEnv2>.step() # error since MyEnv1 is reset but not MyEnv2 One solution would be to change |
Sounds good, have you tried it? does it work? Then the latest version of gym is compatible with the basic usage of NeuroGym? |
I modified ScheduleEnvs and I added some tests in c2efa7c. It seems to work now. I think so, it's just that we have to properly reset the environments. |
Here are some of the changes made in the latest releases of Gym, which might cause some problems with neurogym v0.0.1:
env.seed
is being deprecated and replaced by an additional argument inenv.reset
(v0.22.0)I created the branch fix-gym-compatibility to fix the compatibility issues due to these changes.
We should also keep an eye on this roadmap for Gym 1.0.
The text was updated successfully, but these errors were encountered: