Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ALE for ROM fixes and snapshot/restore of state #15

Merged
merged 5 commits into from
May 5, 2017

Conversation

shelhamer
Copy link
Contributor

@shelhamer shelhamer commented Apr 13, 2017

ALE development has gone on from the point that atari-py forked. While atari-py forked from ALE without keeping it's history, the diff can be inspected by comparing atari-py/atari_py/ale_interface/src and ale/src. Among the various fixes and improvements two stand out for the purposes of gym:

  • ROM fixes that alter the env semantics(!)
  • proper snapshot/restore of the emulator state including pseudorandomness (cloneSystemState() and restoreSystemState())

This is required to address openai/gym#402. I'm happy to carry out the gym change to expose the snapshot/restore functionality next.

Do not merge until we double-check that nothing breaks and decide that we're happy with the new ROM semantics. Once merged, gym should bump the env versions when the new atari-py is incorporated.

these ALE fixes alter the semantics of the following Atari envs:

- Asteroids: add score wrapping
- Breakout: reduce minimal action set
- Kaboom: add missing action, fix terminal (was never done?)
- Kangaroo: different score(?)
- QBert: fix lives/terminal issue
- WizardOfWor: different score and lives(?)
@shelhamer shelhamer changed the title Update ALE for ROM fixes and snapshot/restore of state WIP: Update ALE for ROM fixes and snapshot/restore of state Apr 13, 2017
@shelhamer
Copy link
Contributor Author

shelhamer commented Apr 13, 2017

Note that I almost certainly blew away improves by Trevor Blackwell—I'll review the history and spare them from this diff. Apologies! Just kidding—the customizations that have been made for atari-py are safe.

@shelhamer
Copy link
Contributor Author

shelhamer commented Apr 13, 2017

Right now this includes new ALE output on when making an env. I'll most likely disable it, or better yet switch it to being a verbose option.

A.L.E: Arcade Learning Environment (version 0.5.1)
[Powered by Stella]
Use -help for help screen.
Warning: couldn't load settings file: ./ale.cfg
Game console created:
  ROM file:  /Users/shelhamer/h/desk/atari/atari-py/atari_py/atari_roms/pong.bin
  Cart Name: Video Olympics (1978) (Atari)
  Cart MD5:  60e0ea3cbe0913d39803477945e9e5ec
  Display Format:  AUTO-DETECT ==> NTSC
  ROM Size:        2048
  Bankswitch Type: AUTO-DETECT ==> 2K

Running ROM file...
Random seed is 436853534
[2017-04-12 23:31:47,088] Making new env: PongNoFrameskip-v3

By default only errors are logged.

@shelhamer
Copy link
Contributor Author

shelhamer commented Apr 13, 2017

Note to self: double-check stellarc/ale.cfg The configuration file is deprecated and defaults are handled by settings in emucore.

n.b. only the existing ROMs are updated and new ROMs are not included
`State` is the environment state without system state like
pseudorandomness while `SystemState` is the full state. To restore an
identical environment where the same actions yield the same successors,
make use of `SystemState`s.
@shelhamer shelhamer changed the title WIP: Update ALE for ROM fixes and snapshot/restore of state Update ALE for ROM fixes and snapshot/restore of state May 2, 2017
@shelhamer
Copy link
Contributor Author

Alright, this should be ready. I did a few simple checks of the environments, but more testing and review might be a good idea before merge.

@joschu
Copy link
Contributor

joschu commented May 3, 2017

@nottombrown could you try running our RL algorithm baselines with this branch?

@nottombrown
Copy link
Contributor

Bumped the version and am testing now using PPO (because it's fast)

 ॐ  python -c 'import pkg_resources;  print(pkg_resources.require("atari-py")[0].version)'
0.0.22.dev0

@nottombrown
Copy link
Contributor

nottombrown commented May 4, 2017

Results
image

Is it supposed to preserve seed determinism with previous versions?

I'm a bit confused by the graph above, @shelhamer. It looks like enduro was preserved, but not pong

@joschu
Copy link
Contributor

joschu commented May 4, 2017

Awesome -- the rare uniform improvement. Let's merge!

@shelhamer
Copy link
Contributor Author

shelhamer commented May 4, 2017

@nottombrown I'd expect slight improvement in Qbert and Breakout because of minor alterations of the ROMs in 199fdf3 (which fix a terminal condition and reduce the minimal action set respectively), and otherwise equivalent results.

However, seeds are not preserved across this change because of a switch in the ALE RNG in Farama-Foundation/Arcade-Learning-Environment@a5241ce; see https://github.com/mgbellemare/Arcade-Learning-Environment/commits/master/src/emucore/Random.cxx for more history. There is still determinism for the new seed/RNG scheme, but it will give different random numbers so it's all the more important to bump the Atari envs to v4.

@shelhamer shelhamer merged commit 72acda2 into openai:master May 5, 2017
@shelhamer
Copy link
Contributor Author

Thanks @nottombrown for catching the version bump!

@shelhamer shelhamer deleted the ale-latest branch May 13, 2017 00:19
shelhamer added a commit to openai/gym that referenced this pull request May 14, 2017
gym 0.9.1 upgrades the Atari environments to v4 by:

- upgrading atari-py to the latest ALE, including ROM fixes
  openai/atari-py#15
- upgrading gym to the latest atari-py and declaring Atari v4
  #584
- exposing snapshot/restore of Atari environments through gym
  #575

Switching to v4 is encouraged for correctness, although the environment
differences are minor. For exact comparison with existing Atari v3
results, make use of earlier gym and atari-py versions.
random->mat1 = 4753849;
random->mat2 = 3231259923;
random->tmat = 614784120;

int i;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only GNU extension allows declaring variables in the middle of the block.

PaulMcMillan pushed a commit that referenced this pull request Apr 25, 2023
Update ALE for ROM fixes and snapshot/restore of state
tanuwinitc added a commit to tanuwinitc/gym that referenced this pull request Aug 5, 2024
gym 0.9.1 upgrades the Atari environments to v4 by:

- upgrading atari-py to the latest ALE, including ROM fixes
  openai/atari-py#15
- upgrading gym to the latest atari-py and declaring Atari v4
  openai/gym#584
- exposing snapshot/restore of Atari environments through gym
  openai/gym#575

Switching to v4 is encouraged for correctness, although the environment
differences are minor. For exact comparison with existing Atari v3
results, make use of earlier gym and atari-py versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants