Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
a9c4cbb9
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看板
未验证
提交
a9c4cbb9
编写于
4月 15, 2019
作者:
B
Bo Zhou
提交者:
GitHub
4月 15, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2054 from zenghsh3/develop
fix a compatible problem in DQN introduced by the the newest version of fluid
上级
490b85cf
c56313b9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
9 deletion
+20
-9
PaddleRL/DeepQNetwork/DQN_agent.py
PaddleRL/DeepQNetwork/DQN_agent.py
+6
-2
PaddleRL/DeepQNetwork/DoubleDQN_agent.py
PaddleRL/DeepQNetwork/DoubleDQN_agent.py
+6
-2
PaddleRL/DeepQNetwork/DuelingDQN_agent.py
PaddleRL/DeepQNetwork/DuelingDQN_agent.py
+6
-2
PaddleRL/DeepQNetwork/requirement.txt
PaddleRL/DeepQNetwork/requirement.txt
+1
-1
PaddleRL/DeepQNetwork/train.py
PaddleRL/DeepQNetwork/train.py
+1
-2
未找到文件。
PaddleRL/DeepQNetwork/DQN_agent.py
浏览文件 @
a9c4cbb9
...
...
@@ -71,10 +71,14 @@ class DQNModel(object):
optimizer
.
minimize
(
cost
)
vars
=
list
(
self
.
train_program
.
list_vars
())
policy_vars
=
list
(
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'policy'
in
x
.
name
,
vars
))
target_vars
=
list
(
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
policy_vars_name
=
[
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
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
...
...
PaddleRL/DeepQNetwork/DoubleDQN_agent.py
浏览文件 @
a9c4cbb9
...
...
@@ -79,10 +79,14 @@ class DoubleDQNModel(object):
optimizer
.
minimize
(
cost
)
vars
=
list
(
self
.
train_program
.
list_vars
())
policy_vars
=
list
(
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'policy'
in
x
.
name
,
vars
))
target_vars
=
list
(
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
policy_vars_name
=
[
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
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
...
...
PaddleRL/DeepQNetwork/DuelingDQN_agent.py
浏览文件 @
a9c4cbb9
...
...
@@ -71,10 +71,14 @@ class DuelingDQNModel(object):
optimizer
.
minimize
(
cost
)
vars
=
list
(
self
.
train_program
.
list_vars
())
policy_vars
=
list
(
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'policy'
in
x
.
name
,
vars
))
target_vars
=
list
(
filter
(
lambda
x
:
'GRAD'
not
in
x
.
name
and
'target'
in
x
.
name
,
vars
))
policy_vars_name
=
[
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
.
sort
(
key
=
lambda
x
:
x
.
name
)
target_vars
.
sort
(
key
=
lambda
x
:
x
.
name
)
...
...
PaddleRL/DeepQNetwork/requirement.txt
浏览文件 @
a9c4cbb9
...
...
@@ -2,4 +2,4 @@ numpy
gym
tqdm
opencv-python
paddlepaddle-gpu
==0.12
.0
paddlepaddle-gpu
>=1.0
.0
PaddleRL/DeepQNetwork/train.py
浏览文件 @
a9c4cbb9
...
...
@@ -19,7 +19,6 @@ from collections import deque
UPDATE_FREQ
=
4
#MEMORY_WARMUP_SIZE = 2000
MEMORY_SIZE
=
1e6
MEMORY_WARMUP_SIZE
=
MEMORY_SIZE
//
20
IMAGE_SIZE
=
(
84
,
84
)
...
...
@@ -109,7 +108,7 @@ def train_agent():
print
(
'Input algorithm name error!'
)
return
with
tqdm
(
total
=
MEMORY_WARMUP_SIZE
)
as
pbar
:
with
tqdm
(
total
=
MEMORY_WARMUP_SIZE
,
desc
=
'Memory warmup'
)
as
pbar
:
while
len
(
exp
)
<
MEMORY_WARMUP_SIZE
:
total_reward
,
step
=
run_train_episode
(
agent
,
env
,
exp
)
pbar
.
update
(
step
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录