Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
8c6711c8
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8c6711c8
编写于
8月 27, 2019
作者:
P
pkpk
提交者:
Yibing Liu
8月 27, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test=develop (#3205)
上级
05795e85
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
26 addition
and
23 deletion
+26
-23
.gitmodules
.gitmodules
+3
-0
PaddleRL
PaddleRL
+1
-0
legacy/PaddleRL/DeepQNetwork/DQN_agent.py
legacy/PaddleRL/DeepQNetwork/DQN_agent.py
+6
-7
legacy/PaddleRL/DeepQNetwork/DoubleDQN_agent.py
legacy/PaddleRL/DeepQNetwork/DoubleDQN_agent.py
+10
-9
legacy/PaddleRL/DeepQNetwork/DuelingDQN_agent.py
legacy/PaddleRL/DeepQNetwork/DuelingDQN_agent.py
+6
-7
legacy/PaddleRL/DeepQNetwork/README.md
legacy/PaddleRL/DeepQNetwork/README.md
+0
-0
legacy/PaddleRL/DeepQNetwork/README_cn.md
legacy/PaddleRL/DeepQNetwork/README_cn.md
+0
-0
legacy/PaddleRL/DeepQNetwork/assets/dqn.png
legacy/PaddleRL/DeepQNetwork/assets/dqn.png
+0
-0
legacy/PaddleRL/DeepQNetwork/atari.py
legacy/PaddleRL/DeepQNetwork/atari.py
+0
-0
legacy/PaddleRL/DeepQNetwork/atari_wrapper.py
legacy/PaddleRL/DeepQNetwork/atari_wrapper.py
+0
-0
legacy/PaddleRL/DeepQNetwork/expreplay.py
legacy/PaddleRL/DeepQNetwork/expreplay.py
+0
-0
legacy/PaddleRL/DeepQNetwork/play.py
legacy/PaddleRL/DeepQNetwork/play.py
+0
-0
legacy/PaddleRL/DeepQNetwork/requirement.txt
legacy/PaddleRL/DeepQNetwork/requirement.txt
+0
-0
legacy/PaddleRL/DeepQNetwork/rom_files/breakout.bin
legacy/PaddleRL/DeepQNetwork/rom_files/breakout.bin
+0
-0
legacy/PaddleRL/DeepQNetwork/rom_files/pong.bin
legacy/PaddleRL/DeepQNetwork/rom_files/pong.bin
+0
-0
legacy/PaddleRL/DeepQNetwork/train.py
legacy/PaddleRL/DeepQNetwork/train.py
+0
-0
legacy/PaddleRL/README.md
legacy/PaddleRL/README.md
+0
-0
legacy/PaddleRL/policy_gradient/README.md
legacy/PaddleRL/policy_gradient/README.md
+0
-0
legacy/PaddleRL/policy_gradient/brain.py
legacy/PaddleRL/policy_gradient/brain.py
+0
-0
legacy/PaddleRL/policy_gradient/env.py
legacy/PaddleRL/policy_gradient/env.py
+0
-0
legacy/PaddleRL/policy_gradient/images/PG_1.svg
legacy/PaddleRL/policy_gradient/images/PG_1.svg
+0
-0
legacy/PaddleRL/policy_gradient/images/PG_2.svg
legacy/PaddleRL/policy_gradient/images/PG_2.svg
+0
-0
legacy/PaddleRL/policy_gradient/images/PG_3.svg
legacy/PaddleRL/policy_gradient/images/PG_3.svg
+0
-0
legacy/PaddleRL/policy_gradient/run.py
legacy/PaddleRL/policy_gradient/run.py
+0
-0
未找到文件。
.gitmodules
浏览文件 @
8c6711c8
...
@@ -4,3 +4,6 @@
...
@@ -4,3 +4,6 @@
[submodule "PaddleNLP/language_representations_kit/ERNIE"]
[submodule "PaddleNLP/language_representations_kit/ERNIE"]
path = PaddleNLP/language_representations_kit/ERNIE
path = PaddleNLP/language_representations_kit/ERNIE
url = https://github.com/PaddlePaddle/ERNIE
url = https://github.com/PaddlePaddle/ERNIE
[submodule "PaddleRL"]
path = PaddleRL
url = https://github.com/PaddlePaddle/PARL
PaddleRL
@
a8846355
Subproject commit a884635519c529c69c34e1134ca6c9d99f2c0007
PaddleRL/DeepQNetwork/DQN_agent.py
→
legacy/
PaddleRL/DeepQNetwork/DQN_agent.py
浏览文件 @
8c6711c8
...
@@ -71,17 +71,17 @@ class DQNModel(object):
...
@@ -71,17 +71,17 @@ class DQNModel(object):
optimizer
.
minimize
(
cost
)
optimizer
.
minimize
(
cost
)
vars
=
list
(
self
.
train_program
.
list_vars
())
vars
=
list
(
self
.
train_program
.
list_vars
())
target_vars
=
list
(
filter
(
target_vars
=
list
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
policy_vars_name
=
[
policy_vars_name
=
[
x
.
name
.
replace
(
'target'
,
'policy'
)
for
x
in
target_vars
]
x
.
name
.
replace
(
'target'
,
'policy'
)
for
x
in
target_vars
policy_vars
=
list
(
filter
(
]
lambda
x
:
x
.
name
in
policy_vars_name
,
vars
))
policy_vars
=
list
(
filter
(
lambda
x
:
x
.
name
in
policy_vars_name
,
vars
))
policy_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
policy_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
with
fluid
.
program_guard
(
self
.
_sync_program
):
with
fluid
.
program_guard
(
self
.
_sync_program
):
sync_ops
=
[]
sync_ops
=
[]
for
i
,
var
in
enumerate
(
policy_vars
):
for
i
,
var
in
enumerate
(
policy_vars
):
...
@@ -153,7 +153,6 @@ class DQNModel(object):
...
@@ -153,7 +153,6 @@ class DQNModel(object):
bias_attr
=
ParamAttr
(
name
=
'{}_fc1_b'
.
format
(
variable_field
)))
bias_attr
=
ParamAttr
(
name
=
'{}_fc1_b'
.
format
(
variable_field
)))
return
out
return
out
def
act
(
self
,
state
,
train_or_test
):
def
act
(
self
,
state
,
train_or_test
):
sample
=
np
.
random
.
random
()
sample
=
np
.
random
.
random
()
if
train_or_test
==
'train'
and
sample
<
self
.
exploration
:
if
train_or_test
==
'train'
and
sample
<
self
.
exploration
:
...
...
PaddleRL/DeepQNetwork/DoubleDQN_agent.py
→
legacy/
PaddleRL/DeepQNetwork/DoubleDQN_agent.py
浏览文件 @
8c6711c8
...
@@ -64,9 +64,11 @@ class DoubleDQNModel(object):
...
@@ -64,9 +64,11 @@ class DoubleDQNModel(object):
greedy_action
=
fluid
.
layers
.
argmax
(
next_s_predcit_value
,
axis
=
1
)
greedy_action
=
fluid
.
layers
.
argmax
(
next_s_predcit_value
,
axis
=
1
)
greedy_action
=
fluid
.
layers
.
unsqueeze
(
greedy_action
,
axes
=
[
1
])
greedy_action
=
fluid
.
layers
.
unsqueeze
(
greedy_action
,
axes
=
[
1
])
predict_onehot
=
fluid
.
layers
.
one_hot
(
greedy_action
,
self
.
action_dim
)
predict_onehot
=
fluid
.
layers
.
one_hot
(
greedy_action
,
self
.
action_dim
)
best_v
=
fluid
.
layers
.
reduce_sum
(
best_v
=
fluid
.
layers
.
reduce_sum
(
fluid
.
layers
.
elementwise_mul
(
predict_onehot
,
targetQ_predict_value
),
fluid
.
layers
.
elementwise_mul
(
predict_onehot
,
targetQ_predict_value
),
dim
=
1
)
dim
=
1
)
best_v
.
stop_gradient
=
True
best_v
.
stop_gradient
=
True
...
@@ -79,17 +81,17 @@ class DoubleDQNModel(object):
...
@@ -79,17 +81,17 @@ class DoubleDQNModel(object):
optimizer
.
minimize
(
cost
)
optimizer
.
minimize
(
cost
)
vars
=
list
(
self
.
train_program
.
list_vars
())
vars
=
list
(
self
.
train_program
.
list_vars
())
target_vars
=
list
(
filter
(
target_vars
=
list
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
policy_vars_name
=
[
policy_vars_name
=
[
x
.
name
.
replace
(
'target'
,
'policy'
)
for
x
in
target_vars
]
x
.
name
.
replace
(
'target'
,
'policy'
)
for
x
in
target_vars
policy_vars
=
list
(
filter
(
]
lambda
x
:
x
.
name
in
policy_vars_name
,
vars
))
policy_vars
=
list
(
filter
(
lambda
x
:
x
.
name
in
policy_vars_name
,
vars
))
policy_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
policy_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
with
fluid
.
program_guard
(
self
.
_sync_program
):
with
fluid
.
program_guard
(
self
.
_sync_program
):
sync_ops
=
[]
sync_ops
=
[]
for
i
,
var
in
enumerate
(
policy_vars
):
for
i
,
var
in
enumerate
(
policy_vars
):
...
@@ -161,7 +163,6 @@ class DoubleDQNModel(object):
...
@@ -161,7 +163,6 @@ class DoubleDQNModel(object):
bias_attr
=
ParamAttr
(
name
=
'{}_fc1_b'
.
format
(
variable_field
)))
bias_attr
=
ParamAttr
(
name
=
'{}_fc1_b'
.
format
(
variable_field
)))
return
out
return
out
def
act
(
self
,
state
,
train_or_test
):
def
act
(
self
,
state
,
train_or_test
):
sample
=
np
.
random
.
random
()
sample
=
np
.
random
.
random
()
if
train_or_test
==
'train'
and
sample
<
self
.
exploration
:
if
train_or_test
==
'train'
and
sample
<
self
.
exploration
:
...
...
PaddleRL/DeepQNetwork/DuelingDQN_agent.py
→
legacy/
PaddleRL/DeepQNetwork/DuelingDQN_agent.py
浏览文件 @
8c6711c8
...
@@ -71,17 +71,17 @@ class DuelingDQNModel(object):
...
@@ -71,17 +71,17 @@ class DuelingDQNModel(object):
optimizer
.
minimize
(
cost
)
optimizer
.
minimize
(
cost
)
vars
=
list
(
self
.
train_program
.
list_vars
())
vars
=
list
(
self
.
train_program
.
list_vars
())
target_vars
=
list
(
filter
(
target_vars
=
list
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
policy_vars_name
=
[
policy_vars_name
=
[
x
.
name
.
replace
(
'target'
,
'policy'
)
for
x
in
target_vars
]
x
.
name
.
replace
(
'target'
,
'policy'
)
for
x
in
target_vars
policy_vars
=
list
(
filter
(
]
lambda
x
:
x
.
name
in
policy_vars_name
,
vars
))
policy_vars
=
list
(
filter
(
lambda
x
:
x
.
name
in
policy_vars_name
,
vars
))
policy_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
policy_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
with
fluid
.
program_guard
(
self
.
_sync_program
):
with
fluid
.
program_guard
(
self
.
_sync_program
):
sync_ops
=
[]
sync_ops
=
[]
for
i
,
var
in
enumerate
(
policy_vars
):
for
i
,
var
in
enumerate
(
policy_vars
):
...
@@ -163,7 +163,6 @@ class DuelingDQNModel(object):
...
@@ -163,7 +163,6 @@ class DuelingDQNModel(object):
advantage
,
dim
=
1
,
keep_dim
=
True
))
advantage
,
dim
=
1
,
keep_dim
=
True
))
return
Q
return
Q
def
act
(
self
,
state
,
train_or_test
):
def
act
(
self
,
state
,
train_or_test
):
sample
=
np
.
random
.
random
()
sample
=
np
.
random
.
random
()
if
train_or_test
==
'train'
and
sample
<
self
.
exploration
:
if
train_or_test
==
'train'
and
sample
<
self
.
exploration
:
...
...
PaddleRL/DeepQNetwork/README.md
→
legacy/
PaddleRL/DeepQNetwork/README.md
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/README_cn.md
→
legacy/
PaddleRL/DeepQNetwork/README_cn.md
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/assets/dqn.png
→
legacy/
PaddleRL/DeepQNetwork/assets/dqn.png
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/atari.py
→
legacy/
PaddleRL/DeepQNetwork/atari.py
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/atari_wrapper.py
→
legacy/
PaddleRL/DeepQNetwork/atari_wrapper.py
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/expreplay.py
→
legacy/
PaddleRL/DeepQNetwork/expreplay.py
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/play.py
→
legacy/
PaddleRL/DeepQNetwork/play.py
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/requirement.txt
→
legacy/
PaddleRL/DeepQNetwork/requirement.txt
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/rom_files/breakout.bin
→
legacy/
PaddleRL/DeepQNetwork/rom_files/breakout.bin
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/rom_files/pong.bin
→
legacy/
PaddleRL/DeepQNetwork/rom_files/pong.bin
浏览文件 @
8c6711c8
文件已移动
PaddleRL/DeepQNetwork/train.py
→
legacy/
PaddleRL/DeepQNetwork/train.py
浏览文件 @
8c6711c8
文件已移动
PaddleRL/README.md
→
legacy/
PaddleRL/README.md
浏览文件 @
8c6711c8
文件已移动
PaddleRL/policy_gradient/README.md
→
legacy/
PaddleRL/policy_gradient/README.md
浏览文件 @
8c6711c8
文件已移动
PaddleRL/policy_gradient/brain.py
→
legacy/
PaddleRL/policy_gradient/brain.py
浏览文件 @
8c6711c8
文件已移动
PaddleRL/policy_gradient/env.py
→
legacy/
PaddleRL/policy_gradient/env.py
浏览文件 @
8c6711c8
文件已移动
PaddleRL/policy_gradient/images/PG_1.svg
→
legacy/
PaddleRL/policy_gradient/images/PG_1.svg
浏览文件 @
8c6711c8
文件已移动
PaddleRL/policy_gradient/images/PG_2.svg
→
legacy/
PaddleRL/policy_gradient/images/PG_2.svg
浏览文件 @
8c6711c8
文件已移动
PaddleRL/policy_gradient/images/PG_3.svg
→
legacy/
PaddleRL/policy_gradient/images/PG_3.svg
浏览文件 @
8c6711c8
文件已移动
PaddleRL/policy_gradient/run.py
→
legacy/
PaddleRL/policy_gradient/run.py
浏览文件 @
8c6711c8
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录