neurips2020-procgen-starter-kit icon indicating copy to clipboard operation
neurips2020-procgen-starter-kit copied to clipboard

Unable to set seed explicitly

Open xlnwel opened this issue 5 years ago • 3 comments

If I append the following code to the end of envs.procgen_env_wrapper.py and run the file, I'll receive error:

TypeError: seed() takes 1 positional argument but 2 were given

code:

if __name__ == "__main__":
    env = ProcgenEnvWrapper({})
    env.seed(0)

xlnwel avatar Jun 10 '20 01:06 xlnwel

Did you try passing rand_seed in the env_config?

Refer: https://github.com/openai/procgen/blob/master/procgen/env.py#L77

jyotishp avatar Jun 18 '20 11:06 jyotishp

Hi, @jyotishp. No, I did not. I used the wrapper from env. procgen_env_wrapper.py, which did not pass rand_seed. After you mentioned that, I also tried to add "rand_seed=0" to self._default_config. The same error occurred, which said seedfunction only acceptedself` argument -- I also verified it with the following code

    def seed(self, seed=None):
        import inspect
        print(inspect.signature(self.env.seed))# print ()
        return self.env.seed(seed)

Currently I just omit seed, but this will give me a warning:

Warning: seed ignored.

Could you provide a exemplary code that works?

xlnwel avatar Jun 18 '20 23:06 xlnwel

So how we conduct repeat experiments with different seed? In my practice, I am using ray.tune's argument num_samples=3 but I think a better way is to explicit specify the seed, rather than setting config["seed"] = None.

pengzhenghao avatar Jan 06 '21 03:01 pengzhenghao