google-deepmind / google-deepmind/lab
Determinism: Same random seed does not produce the same trajectory
- Dominant language
- C
- Stars
- 7.4k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to replicate exactly same trajectory of observations from a sequence of actions, for the sake of imitation learning. I found that even if we use the same random seed, i.e. `env.reset(seed=SEED)`, resulting episodes are not necessarily the same --- breaks the determinism.
```python
env = create_env('nav_maze_static_01') # creates deepmind Lab instance
def print_obs(obs):
x, y, z = obs['DEBUG.POS.TRANS']
pitch, yaw, roll = obs['DEBUG.POS.ROT']
print(("%.3f " * 3 + "%.5f " * 3) % (x, y, z, pitch, yaw, roll))
for _ in range(5):
env.reset(seed=42)
obs = env.observations()
print_obs(obs)
```
whose result is (x, y, z, pitch, yaw, roll):
```
50.000 150.000 25.125 0.00000 71.20239 0.00000
50.000 150.000 39.000 0.00000 71.20239 0.00000
50.000 150.000 39.000 0.00000 71.20457 0.00000
50.000 150.000 39.000 0.00000 71.20239 0.00000
50.000 150.000 39.000 0.00000 71.20457 0.00000
```
We can see random starting position (x, y) is always the same, but not for `z` and `yaw`, etc. However, this result is very consistent, indicating we can produce the same internal state and result when we *re-create* the `Lab` instance; if we reuse an `Lab` instance, `env.reset(seed=?)` is not enough.
How can we take a control over this so that one can use a RNG with the same seed?
Contributor guide
Assessment
This issue has not been assessed yet.