缺少种子函数,无法使用 Open AI Gym 和 PyTorch 创建可重现的 RL 实验

Missing seed functions to create reproducible RL experiments with Open AI Gym and PyTorch

我正在使用简单的 DDQN-PER (https://github.com/higgsfield/RL-Adventure/blob/master/4.prioritized%20dqn.ipynb) 运行 我的 RL 实验。这可以用作我的问题的最小且可验证的代码。

此外,这是我发现有用的种子函数 -

random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
env.seed(seed)
env.action_space.seed(seed)

尽管如此,我无法重现我的实验。我相信我缺少一些种子功能,并且会感谢相同的输入。

检查你的健身房版本。最近对 v0.20 进行了重大升级。

Here is also a blog post,描述新环境应该是确定性的,引用精华:

Determinism

Up until now, the ALE hasn’t been completely deterministic. There exist games that implement their own PRNG seeded by various methods which depend on the console’s state. We now properly control for this source of stochasticity and can now say with confidence that the emulator is 100% deterministic.