Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
a07b6262
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a07b6262
编写于
7月 31, 2020
作者:
L
lilong12
提交者:
GitHub
7月 31, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hidden the dataset call of pipeline to train_from_dataset (#25834)
* hidden the explicit setting of dataset for pipeline training.
上级
f132c2f4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
17 deletion
+20
-17
python/paddle/fluid/executor.py
python/paddle/fluid/executor.py
+19
-8
python/paddle/fluid/tests/unittests/test_pipeline.py
python/paddle/fluid/tests/unittests/test_pipeline.py
+1
-9
未找到文件。
python/paddle/fluid/executor.py
浏览文件 @
a07b6262
...
...
@@ -1334,14 +1334,25 @@ class Executor(object):
fetch_info
=
None
,
print_period
=
100
,
fetch_handler
=
None
):
if
dataset
is
None
:
raise
RuntimeError
(
"dataset is need and should be initialized"
)
if
program
.
_pipeline_opt
is
not
None
and
program
.
_pipeline_opt
[
"sync_steps"
]
!=
-
1
:
# hack for paddlebox: sync_steps(-1) denotes paddlebox
thread
=
self
.
_adjust_pipeline_resource
(
program
.
_pipeline_opt
,
dataset
,
thread
)
if
program
.
_pipeline_opt
is
not
None
:
import
paddle
if
dataset
is
not
None
:
raise
RuntimeError
(
"dataset should be None for pipeline mode"
)
# The following fake dataset is created to call
# the _prepare_trainer api, and it is meaningless.
data_vars
=
[]
for
var
in
program
.
global_block
().
vars
.
values
():
if
var
.
is_data
:
data_vars
.
append
(
var
)
dataset
=
paddle
.
fluid
.
DatasetFactory
().
create_dataset
(
'FileInstantDataset'
)
dataset
.
set_batch_size
(
1
)
dataset
.
set_thread
(
1
)
dataset
.
set_filelist
([
'None'
])
dataset
.
set_use_var
(
data_vars
)
else
:
if
dataset
is
None
:
raise
RuntimeError
(
"dataset is need and should be initialized"
)
dataset
.
_prepare_to_run
()
...
...
python/paddle/fluid/tests/unittests/test_pipeline.py
浏览文件 @
a07b6262
...
...
@@ -186,18 +186,10 @@ class TestPipeline(unittest.TestCase):
data_loader
.
set_sample_generator
(
train_reader
,
batch_size
=
1
)
place
=
fluid
.
CPUPlace
()
# The following dataset is only used for the
# interface 'train_from_dataset'.
# And it has no actual meaning.
dataset
=
fluid
.
DatasetFactory
().
create_dataset
(
'FileInstantDataset'
)
dataset
.
set_batch_size
(
1
)
dataset
.
set_thread
(
1
)
dataset
.
set_filelist
([
'/tmp/tmp_2.txt'
])
dataset
.
set_use_var
([
image
,
label
])
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
startup_prog
)
data_loader
.
start
()
exe
.
train_from_dataset
(
main_prog
,
d
ataset
,
d
ebug
=
debug
)
exe
.
train_from_dataset
(
main_prog
,
debug
=
debug
)
def
test_pipeline
(
self
):
self
.
_run
(
False
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录