mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-09-17 22:30:59 +00:00
Fix Atari wrapper bug: tried to step environment that needs reset (#1297)
* fix 1060 * update changelog
This commit is contained in:
parent
b702884c23
commit
637988c9cc
2 changed files with 9 additions and 5 deletions
|
|
@ -23,6 +23,7 @@ New Features:
|
||||||
|
|
||||||
Bug Fixes:
|
Bug Fixes:
|
||||||
^^^^^^^^^^
|
^^^^^^^^^^
|
||||||
|
- Fixed Atari wrapper that missed the reset condition (@luizapozzobon)
|
||||||
|
|
||||||
Deprecations:
|
Deprecations:
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
|
@ -1218,4 +1219,4 @@ And all the contributors:
|
||||||
@Gregwar @ycheng517 @quantitative-technologies @bcollazo @git-thor @TibiGG @cool-RR @MWeltevrede
|
@Gregwar @ycheng517 @quantitative-technologies @bcollazo @git-thor @TibiGG @cool-RR @MWeltevrede
|
||||||
@Melanol @qgallouedec @francescoluciano @jlp-ue @burakdmb @timothe-chaumont @honglu2875 @yuanmingqi
|
@Melanol @qgallouedec @francescoluciano @jlp-ue @burakdmb @timothe-chaumont @honglu2875 @yuanmingqi
|
||||||
@anand-bala @hughperkins @sidney-tio @AlexPasqua @dominicgkerr @Akhilez @Rocamonde @tobirohrer @ZikangXiong
|
@anand-bala @hughperkins @sidney-tio @AlexPasqua @dominicgkerr @Akhilez @Rocamonde @tobirohrer @ZikangXiong
|
||||||
@DavyMorgan
|
@DavyMorgan @luizapozzobon
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,13 @@ class EpisodicLifeEnv(gym.Wrapper):
|
||||||
obs = self.env.reset(**kwargs)
|
obs = self.env.reset(**kwargs)
|
||||||
else:
|
else:
|
||||||
# no-op step to advance from terminal/lost life state
|
# no-op step to advance from terminal/lost life state
|
||||||
obs, _, _, _ = self.env.step(0)
|
obs, _, done, _ = self.env.step(0)
|
||||||
|
|
||||||
|
# The no-op step can lead to a game over, so we need to check it again
|
||||||
|
# to see if we should reset the environment and avoid the
|
||||||
|
# monitor.py `RuntimeError: Tried to step environment that needs reset`
|
||||||
|
if done:
|
||||||
|
obs = self.env.reset(**kwargs)
|
||||||
self.lives = self.env.unwrapped.ale.lives()
|
self.lives = self.env.unwrapped.ale.lives()
|
||||||
return obs
|
return obs
|
||||||
|
|
||||||
|
|
@ -150,9 +156,6 @@ class MaxAndSkipEnv(gym.Wrapper):
|
||||||
|
|
||||||
return max_frame, total_reward, done, info
|
return max_frame, total_reward, done, info
|
||||||
|
|
||||||
def reset(self, **kwargs) -> GymObs:
|
|
||||||
return self.env.reset(**kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class ClipRewardEnv(gym.RewardWrapper):
|
class ClipRewardEnv(gym.RewardWrapper):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue