Skip to content

Commit

Permalink
[BugFix] fix bug where torch rng was never changed after each reset
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneT2000 committed Oct 29, 2024
1 parent c2f3036 commit c7dc70b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mani_skill/envs/sapien_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,12 @@ def reset(self, seed: Union[None, int, list[int]] = None, options: Union[None, d

if self.agent is not None:
self.agent.reset()
with torch.random.fork_rng():
torch.manual_seed(self._episode_seed[0])

if seed is not None or self._enhanced_determinism:
with torch.random.fork_rng():
torch.manual_seed(self._episode_seed[0])
self._initialize_episode(env_idx, options)
else:
self._initialize_episode(env_idx, options)
# reset the reset mask back to all ones so any internal code in maniskill can continue to manipulate all scenes at once as usual
self.scene._reset_mask = torch.ones(
Expand Down

0 comments on commit c7dc70b

Please sign in to comment.