Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
364fe347
Commit
364fe347
authored
Jun 11, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lock for atari simulator init
parent
f461ed2e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
26 deletions
+30
-26
examples/Atari2600/common.py
examples/Atari2600/common.py
+0
-1
tensorpack/RL/atari.py
tensorpack/RL/atari.py
+30
-25
No files found.
examples/Atari2600/common.py
View file @
364fe347
...
@@ -52,7 +52,6 @@ def eval_with_funcs(predict_funcs, nr_eval):
...
@@ -52,7 +52,6 @@ def eval_with_funcs(predict_funcs, nr_eval):
for
k
in
threads
:
for
k
in
threads
:
k
.
start
()
k
.
start
()
time
.
sleep
(
0.1
)
# avoid simulator bugs
stat
=
StatCounter
()
stat
=
StatCounter
()
try
:
try
:
for
_
in
tqdm
(
range
(
nr_eval
)):
for
_
in
tqdm
(
range
(
nr_eval
)):
...
...
tensorpack/RL/atari.py
View file @
364fe347
...
@@ -7,6 +7,7 @@ import numpy as np
...
@@ -7,6 +7,7 @@ import numpy as np
import
time
,
os
import
time
,
os
import
cv2
import
cv2
from
collections
import
deque
from
collections
import
deque
import
threading
import
six
import
six
from
six.moves
import
range
from
six.moves
import
range
from
..utils
import
get_rng
,
logger
,
memoized
,
get_dataset_dir
from
..utils
import
get_rng
,
logger
,
memoized
,
get_dataset_dir
...
@@ -25,6 +26,8 @@ __all__ = ['AtariPlayer']
...
@@ -25,6 +26,8 @@ __all__ = ['AtariPlayer']
def
log_once
():
def
log_once
():
logger
.
warn
(
"https://github.com/mgbellemare/Arcade-Learning-Environment/pull/171 is not merged!"
)
logger
.
warn
(
"https://github.com/mgbellemare/Arcade-Learning-Environment/pull/171 is not merged!"
)
_ALE_LOCK
=
threading
.
Lock
()
class
AtariPlayer
(
RLEnvironment
):
class
AtariPlayer
(
RLEnvironment
):
"""
"""
A wrapper for atari emulator.
A wrapper for atari emulator.
...
@@ -50,17 +53,19 @@ class AtariPlayer(RLEnvironment):
...
@@ -50,17 +53,19 @@ class AtariPlayer(RLEnvironment):
rom_file
=
os
.
path
.
join
(
get_dataset_dir
(
'atari_rom'
),
rom_file
)
rom_file
=
os
.
path
.
join
(
get_dataset_dir
(
'atari_rom'
),
rom_file
)
assert
os
.
path
.
isfile
(
rom_file
),
"rom {} not found"
.
format
(
rom_file
)
assert
os
.
path
.
isfile
(
rom_file
),
"rom {} not found"
.
format
(
rom_file
)
try
:
ALEInterface
.
setLoggerMode
(
ALEInterface
.
Logger
.
Warning
)
except
AttributeError
:
log_once
()
# avoid simulator bugs: https://github.com/mgbellemare/Arcade-Learning-Environment/issues/86
with
_ALE_LOCK
:
self
.
ale
=
ALEInterface
()
self
.
ale
=
ALEInterface
()
self
.
rng
=
get_rng
(
self
)
self
.
rng
=
get_rng
(
self
)
self
.
ale
.
setInt
(
"random_seed"
,
self
.
rng
.
randint
(
0
,
10000
))
self
.
ale
.
setInt
(
"random_seed"
,
self
.
rng
.
randint
(
0
,
10000
))
self
.
ale
.
setBool
(
"showinfo"
,
False
)
self
.
ale
.
setBool
(
"showinfo"
,
False
)
try
:
ALEInterface
.
setLoggerMode
(
ALEInterface
.
Logger
.
Warning
)
except
AttributeError
:
log_once
()
self
.
ale
.
setInt
(
"frame_skip"
,
1
)
self
.
ale
.
setInt
(
"frame_skip"
,
1
)
self
.
ale
.
setBool
(
'color_averaging'
,
False
)
self
.
ale
.
setBool
(
'color_averaging'
,
False
)
# manual.pdf suggests otherwise.
# manual.pdf suggests otherwise.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment