Closed tudor-berariu closed 2 years ago
Hi @tudor-berariu. I think you are correct.
It seems to me it should be safe to just change the default signature to def seed(self, seed=None)
and not check if seed is None
in the method. For serious ML experiments, users will already have supplied their own seed value.
Relatedly I think it's a bit confusing that some environments default to a seed (e.g. the multi room envs) and some do not (e.g. unlock).
I would accept a PR if you'd like to fix that :)
@pseudo-rnd-thoughts What happened to the seed() function in the current version? I am updating old code that uses gym-minigrid.
@shreyanmitra gym-minigrid was updated gymnasium backend, see this guide for more info https://gymnasium.farama.org/content/migration-guide/
@pseudo-rnd-thoughts Thanks so much for the resource. However, I get the following error:
TypeError: reset() got an unexpected keyword argument 'seed'
Although the recommendation in the migration guide was to replace env.seed(seed=seed) with env.reset(seed=seed)
Method
gym.core.Env.seed
has the following signaturedef seed(self, seed=None)
. Theseed
method ingym.core.Wrapper
also has a default value ofNone
for parameterseed
(which is the actual issue, as it should have passed*args, **kwargs
toself.env.seed
).gym_minigrid.MiniGridEnv.seed
has a default value of 1337 for parameterseed
, but when some environment is wrapped, the effective default value becomesNone
(because ofgym.core.Wrapper.seed
).Maybe it would be a good idea to preserve the signature from
gym
and treatNone
as a special case:but this might be problematic too, as one cannot explicitly send
None
now.