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
cee79998
Commit
cee79998
authored
Aug 15, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gym atari
parent
aa124d20
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
14 deletions
+20
-14
examples/Inception/inceptionv3.py
examples/Inception/inceptionv3.py
+3
-2
examples/OpenAIGym/README.md
examples/OpenAIGym/README.md
+9
-4
examples/OpenAIGym/run-atari.py
examples/OpenAIGym/run-atari.py
+4
-6
tensorpack/RL/gymenv.py
tensorpack/RL/gymenv.py
+4
-2
No files found.
examples/Inception/inceptionv3.py
View file @
cee79998
...
@@ -271,8 +271,9 @@ def get_config():
...
@@ -271,8 +271,9 @@ def get_config():
ClassificationError
(
'wrong-top1'
,
'val-top1-error'
),
ClassificationError
(
'wrong-top1'
,
'val-top1-error'
),
ClassificationError
(
'wrong-top5'
,
'val-top5-error'
)]),
ClassificationError
(
'wrong-top5'
,
'val-top5-error'
)]),
ScheduledHyperParamSetter
(
'learning_rate'
,
ScheduledHyperParamSetter
(
'learning_rate'
,
[(
5
,
0.03
),
(
7
,
0.01
),
(
9
,
0.006
),
[(
5
,
0.03
),
(
9
,
0.01
),
(
12
,
0.006
),
(
15
,
0.001
),
(
20
,
2e-4
),
(
24
,
6e-5
)]),
(
17
,
0.003
),
(
22
,
1e-3
),
(
36
,
2e-4
),
(
41
,
8e-5
),
(
48
,
1e-5
),
(
53
,
2e-6
)]),
HumanHyperParamSetter
(
'learning_rate'
)
HumanHyperParamSetter
(
'learning_rate'
)
]),
]),
session_config
=
sess_config
,
session_config
=
sess_config
,
...
...
examples/OpenAIGym/README.md
View file @
cee79998
...
@@ -7,10 +7,15 @@
...
@@ -7,10 +7,15 @@
Models are available for the following gym atari environments (click links for videos):
Models are available for the following gym atari environments (click links for videos):
+
[
Breakout-v0
](
https://gym.openai.com/evaluations/eval_L55gczPrQJamMGihq9tzA
)
+
[
AirRaid-v0
](
https://gym.openai.com/evaluations/eval_zIeNk5MxSGOmvGEUxrZDUw
)
(
a
bit flickering, don't know why)
+
[
AirRaid-v0
](
https://gym.openai.com/evaluations/eval_zIeNk5MxSGOmvGEUxrZDUw
)
+
[
Alien-v0
](
https://gym.openai.com/evaluations/eval_8NR1IvjTQkSIT6En4xSMA
)
+
[
Asterix-v0
](
https://gym.openai.com/evaluations/eval_mees2c58QfKm5GspCjRfCA
)
+
[
Amidar-v0
](
https://gym.openai.com/evaluations/eval_HwEazbHtTYGpCialv9uPhA
)
+
[
Amidar-v0
](
https://gym.openai.com/evaluations/eval_HwEazbHtTYGpCialv9uPhA
)
+
[
Assault-v0
](
https://gym.openai.com/evaluations/eval_tCiHwy5QrSdFVucSbBV6Q
)
+
[
Asterix-v0
](
https://gym.openai.com/evaluations/eval_mees2c58QfKm5GspCjRfCA
)
+
[
Asteroids-v0
](
https://gym.openai.com/evaluations/eval_8eHKsRL4RzuZEq9AOLZA
)
+
[
Atlantis-v0
](
https://gym.openai.com/evaluations/eval_Z1B3d7A1QCaQk1HpO1Rg
)
+
[
Breakout-v0
](
https://gym.openai.com/evaluations/eval_L55gczPrQJamMGihq9tzA
)
+
[
Pong-v0
](
https://gym.openai.com/evaluations/eval_8L7SV59nSW6GGbbP3N4G6w
)
+
[
Seaquest-v0
](
https://gym.openai.com/evaluations/eval_N2624y3NSJWrOgoMSpOi4w
)
+
[
Seaquest-v0
](
https://gym.openai.com/evaluations/eval_N2624y3NSJWrOgoMSpOi4w
)
Note that atari game settings in gym is
more difficult than the settings DeepMind papers, therefore
the scores are not comparable.
Note that atari game settings in gym is
quite different from DeepMind papers, so
the scores are not comparable.
examples/OpenAIGym/run-atari.py
View file @
cee79998
...
@@ -23,7 +23,7 @@ NUM_ACTIONS = None
...
@@ -23,7 +23,7 @@ NUM_ACTIONS = None
ENV_NAME
=
None
ENV_NAME
=
None
def
get_player
(
dumpdir
=
None
):
def
get_player
(
dumpdir
=
None
):
pl
=
GymEnv
(
ENV_NAME
,
dumpdir
=
dumpdir
)
pl
=
GymEnv
(
ENV_NAME
,
dumpdir
=
dumpdir
,
auto_restart
=
False
)
pl
=
MapPlayerState
(
pl
,
lambda
img
:
cv2
.
resize
(
img
,
IMAGE_SIZE
[::
-
1
]))
pl
=
MapPlayerState
(
pl
,
lambda
img
:
cv2
.
resize
(
img
,
IMAGE_SIZE
[::
-
1
]))
global
NUM_ACTIONS
global
NUM_ACTIONS
...
@@ -32,10 +32,6 @@ def get_player(dumpdir=None):
...
@@ -32,10 +32,6 @@ def get_player(dumpdir=None):
pl
=
HistoryFramePlayer
(
pl
,
FRAME_HISTORY
)
pl
=
HistoryFramePlayer
(
pl
,
FRAME_HISTORY
)
return
pl
return
pl
class
MySimulatorWorker
(
SimulatorProcess
):
def
_build_player
(
self
):
return
get_player
(
train
=
True
)
class
Model
(
ModelDesc
):
class
Model
(
ModelDesc
):
def
_get_input_vars
(
self
):
def
_get_input_vars
(
self
):
assert
NUM_ACTIONS
is
not
None
assert
NUM_ACTIONS
is
not
None
...
@@ -80,7 +76,9 @@ def run_submission(cfg):
...
@@ -80,7 +76,9 @@ def run_submission(cfg):
dirname
=
'gym-submit'
dirname
=
'gym-submit'
player
=
get_player
(
dumpdir
=
dirname
)
player
=
get_player
(
dumpdir
=
dirname
)
predfunc
=
get_predict_func
(
cfg
)
predfunc
=
get_predict_func
(
cfg
)
for
_
in
range
(
100
):
for
k
in
range
(
10
):
if
k
!=
0
:
player
.
restart_episode
()
score
=
play_one_episode
(
player
,
predfunc
)
score
=
play_one_episode
(
player
,
predfunc
)
print
(
"Score:"
,
score
)
print
(
"Score:"
,
score
)
...
...
tensorpack/RL/gymenv.py
View file @
cee79998
...
@@ -25,7 +25,7 @@ class GymEnv(RLEnvironment):
...
@@ -25,7 +25,7 @@ class GymEnv(RLEnvironment):
"""
"""
An OpenAI/gym wrapper. Will auto restart.
An OpenAI/gym wrapper. Will auto restart.
"""
"""
def
__init__
(
self
,
name
,
dumpdir
=
None
,
viz
=
False
):
def
__init__
(
self
,
name
,
dumpdir
=
None
,
viz
=
False
,
auto_restart
=
True
):
with
_ALE_LOCK
:
with
_ALE_LOCK
:
self
.
gymenv
=
gym
.
make
(
name
)
self
.
gymenv
=
gym
.
make
(
name
)
if
dumpdir
:
if
dumpdir
:
...
@@ -35,6 +35,7 @@ class GymEnv(RLEnvironment):
...
@@ -35,6 +35,7 @@ class GymEnv(RLEnvironment):
self
.
reset_stat
()
self
.
reset_stat
()
self
.
rwd_counter
=
StatCounter
()
self
.
rwd_counter
=
StatCounter
()
self
.
restart_episode
()
self
.
restart_episode
()
self
.
auto_restart
=
auto_restart
self
.
viz
=
viz
self
.
viz
=
viz
def
restart_episode
(
self
):
def
restart_episode
(
self
):
...
@@ -55,7 +56,8 @@ class GymEnv(RLEnvironment):
...
@@ -55,7 +56,8 @@ class GymEnv(RLEnvironment):
self
.
rwd_counter
.
feed
(
r
)
self
.
rwd_counter
.
feed
(
r
)
if
isOver
:
if
isOver
:
self
.
finish_episode
()
self
.
finish_episode
()
self
.
restart_episode
()
if
self
.
auto_restart
:
self
.
restart_episode
()
return
r
,
isOver
return
r
,
isOver
def
get_action_space
(
self
):
def
get_action_space
(
self
):
...
...
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