Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
13530934
baselines
Commits
7327a156
Commit
7327a156
authored
May 25, 2017
by
Szymon Sidor
Browse files
update Atari envs to v4 and warn Python 2 users.
parent
0071b852
Changes
7
Hide whitespace changes
Inline
Side-by-side
baselines/common/tf_util.py
View file @
7327a156
...
...
@@ -355,43 +355,6 @@ def dropout(x, pkeep, phase=None, mask=None):
return
switch
(
phase
,
mask
*
x
,
pkeep
*
x
)
def
batchnorm
(
x
,
name
,
phase
,
updates
,
gamma
=
0.96
):
k
=
x
.
get_shape
()[
1
]
runningmean
=
tf
.
get_variable
(
name
+
"/mean"
,
shape
=
[
1
,
k
],
initializer
=
tf
.
constant_initializer
(
0.0
),
trainable
=
False
)
runningvar
=
tf
.
get_variable
(
name
+
"/var"
,
shape
=
[
1
,
k
],
initializer
=
tf
.
constant_initializer
(
1e-4
),
trainable
=
False
)
testy
=
(
x
-
runningmean
)
/
tf
.
sqrt
(
runningvar
)
mean_
=
mean
(
x
,
axis
=
0
,
keepdims
=
True
)
var_
=
mean
(
tf
.
square
(
x
),
axis
=
0
,
keepdims
=
True
)
std
=
tf
.
sqrt
(
var_
)
trainy
=
(
x
-
mean_
)
/
std
updates
.
extend
([
tf
.
assign
(
runningmean
,
runningmean
*
gamma
+
mean_
*
(
1
-
gamma
)),
tf
.
assign
(
runningvar
,
runningvar
*
gamma
+
var_
*
(
1
-
gamma
))
])
y
=
switch
(
phase
,
trainy
,
testy
)
scaling
=
tf
.
get_variable
(
name
+
"/scaling"
,
shape
=
[
1
,
k
],
initializer
=
tf
.
constant_initializer
(
1.0
),
trainable
=
True
)
translation
=
tf
.
get_variable
(
name
+
"/translation"
,
shape
=
[
1
,
k
],
initializer
=
tf
.
constant_initializer
(
0.0
),
trainable
=
True
)
return
y
*
scaling
+
translation
# ================================================================
# Theano-like Function
# ================================================================
...
...
baselines/deepq/experiments/atari/enjoy.py
View file @
7327a156
...
...
@@ -29,7 +29,7 @@ def parse_args():
def
make_env
(
game_name
):
env
=
gym
.
make
(
game_name
+
"NoFrameskip-v
3
"
)
env
=
gym
.
make
(
game_name
+
"NoFrameskip-v
4
"
)
env
=
SimpleMonitor
(
env
)
env
=
wrap_dqn
(
env
)
return
env
...
...
baselines/deepq/experiments/atari/train.py
View file @
7327a156
...
...
@@ -57,7 +57,7 @@ def parse_args():
def
make_env
(
game_name
):
env
=
gym
.
make
(
game_name
+
"NoFrameskip-v
3
"
)
env
=
gym
.
make
(
game_name
+
"NoFrameskip-v
4
"
)
monitored_env
=
SimpleMonitor
(
env
)
# puts rewards and number of steps in info, before environment is wrapped
env
=
wrap_dqn
(
monitored_env
)
# applies a bunch of modification to simplify the observation space (downsample, make b/w)
return
env
,
monitored_env
...
...
baselines/deepq/experiments/atari/wang2015_eval.py
View file @
7327a156
...
...
@@ -12,7 +12,7 @@ from baselines.deepq.experiments.atari.model import model, dueling_model
def
make_env
(
game_name
):
env
=
gym
.
make
(
game_name
+
"NoFrameskip-v
3
"
)
env
=
gym
.
make
(
game_name
+
"NoFrameskip-v
4
"
)
env_monitored
=
SimpleMonitor
(
env
)
env
=
wrap_dqn
(
env_monitored
)
return
env_monitored
,
env
...
...
baselines/deepq/experiments/enjoy_pong.py
View file @
7327a156
...
...
@@ -5,7 +5,7 @@ from baselines.common.atari_wrappers_deprecated import wrap_dqn, ScaledFloatFram
def
main
():
env
=
gym
.
make
(
"PongNoFrameskip-v
3
"
)
env
=
gym
.
make
(
"PongNoFrameskip-v
4
"
)
env
=
ScaledFloatFrame
(
wrap_dqn
(
env
))
act
=
deepq
.
load
(
"pong_model.pkl"
)
...
...
baselines/deepq/experiments/train_pong.py
View file @
7327a156
...
...
@@ -5,7 +5,7 @@ from baselines.common.atari_wrappers_deprecated import wrap_dqn, ScaledFloatFram
def
main
():
env
=
gym
.
make
(
"PongNoFrameskip-v
3
"
)
env
=
gym
.
make
(
"PongNoFrameskip-v
4
"
)
env
=
ScaledFloatFrame
(
wrap_dqn
(
env
))
model
=
deepq
.
models
.
cnn_to_mlp
(
convs
=
[(
32
,
8
,
4
),
(
64
,
4
,
2
),
(
64
,
3
,
1
)],
...
...
setup.py
View file @
7327a156
from
setuptools
import
setup
,
find_packages
import
os
repo_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
import
sys
if
sys
.
version_info
.
major
!=
3
:
print
(
"This Python is only compatible with Python 3, but you are running "
"Python {}. The installation will likely fail."
.
format
(
sys
.
version_info
.
major
))
setup
(
name
=
'baselines'
,
packages
=
[
package
for
package
in
find_packages
()
if
package
.
startswith
(
'baselines'
)],
install_requires
=
[
'gym'
,
'scipy'
,
'tqdm'
,
'joblib'
,
...
...
@@ -22,4 +23,4 @@ setup(name='baselines',
author
=
"OpenAI"
,
url
=
'https://github.com/openai/baselines'
,
author_email
=
"gym@openai.com"
,
version
=
"0.1.
0
"
)
version
=
"0.1.
3
"
)
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