Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
9cf6c4e8
P
PaddleOCR
项目概览
weixin_41840029
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9cf6c4e8
编写于
9月 29, 2021
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix profile_options
上级
8dd14799
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
9 deletion
+11
-9
tools/program.py
tools/program.py
+6
-3
tools/train.py
tools/train.py
+5
-6
未找到文件。
tools/program.py
浏览文件 @
9cf6c4e8
...
@@ -159,8 +159,7 @@ def train(config,
...
@@ -159,8 +159,7 @@ def train(config,
eval_class
,
eval_class
,
pre_best_model_dict
,
pre_best_model_dict
,
logger
,
logger
,
vdl_writer
=
None
,
vdl_writer
=
None
):
profiler_options
=
None
):
cal_metric_during_train
=
config
[
'Global'
].
get
(
'cal_metric_during_train'
,
cal_metric_during_train
=
config
[
'Global'
].
get
(
'cal_metric_during_train'
,
False
)
False
)
log_smooth_window
=
config
[
'Global'
][
'log_smooth_window'
]
log_smooth_window
=
config
[
'Global'
][
'log_smooth_window'
]
...
@@ -168,6 +167,8 @@ def train(config,
...
@@ -168,6 +167,8 @@ def train(config,
print_batch_step
=
config
[
'Global'
][
'print_batch_step'
]
print_batch_step
=
config
[
'Global'
][
'print_batch_step'
]
eval_batch_step
=
config
[
'Global'
][
'eval_batch_step'
]
eval_batch_step
=
config
[
'Global'
][
'eval_batch_step'
]
profiler_options
=
config
[
'profiler_options'
]
global_step
=
0
global_step
=
0
if
'global_step'
in
pre_best_model_dict
:
if
'global_step'
in
pre_best_model_dict
:
global_step
=
pre_best_model_dict
[
'global_step'
]
global_step
=
pre_best_model_dict
[
'global_step'
]
...
@@ -405,6 +406,8 @@ def preprocess(is_train=False):
...
@@ -405,6 +406,8 @@ def preprocess(is_train=False):
profiler_options
=
FLAGS
.
profiler_options
profiler_options
=
FLAGS
.
profiler_options
config
=
load_config
(
FLAGS
.
config
)
config
=
load_config
(
FLAGS
.
config
)
merge_config
(
FLAGS
.
opt
)
merge_config
(
FLAGS
.
opt
)
profile_dic
=
{
"profiler_options"
:
FLAGS
.
profiler_options
}
merge_config
(
profile_dic
)
# check if set use_gpu=True in paddlepaddle cpu version
# check if set use_gpu=True in paddlepaddle cpu version
use_gpu
=
config
[
'Global'
][
'use_gpu'
]
use_gpu
=
config
[
'Global'
][
'use_gpu'
]
...
@@ -442,4 +445,4 @@ def preprocess(is_train=False):
...
@@ -442,4 +445,4 @@ def preprocess(is_train=False):
print_dict
(
config
,
logger
)
print_dict
(
config
,
logger
)
logger
.
info
(
'train with paddle {} and device {}'
.
format
(
paddle
.
__version__
,
logger
.
info
(
'train with paddle {} and device {}'
.
format
(
paddle
.
__version__
,
device
))
device
))
return
config
,
device
,
logger
,
vdl_writer
,
profiler_options
return
config
,
device
,
logger
,
vdl_writer
tools/train.py
浏览文件 @
9cf6c4e8
...
@@ -41,7 +41,7 @@ import tools.program as program
...
@@ -41,7 +41,7 @@ import tools.program as program
dist
.
get_world_size
()
dist
.
get_world_size
()
def
main
(
config
,
device
,
logger
,
vdl_writer
,
profiler_options
):
def
main
(
config
,
device
,
logger
,
vdl_writer
):
# init dist environment
# init dist environment
if
config
[
'Global'
][
'distributed'
]:
if
config
[
'Global'
][
'distributed'
]:
dist
.
init_parallel_env
()
dist
.
init_parallel_env
()
...
@@ -105,8 +105,7 @@ def main(config, device, logger, vdl_writer, profiler_options):
...
@@ -105,8 +105,7 @@ def main(config, device, logger, vdl_writer, profiler_options):
# start train
# start train
program
.
train
(
config
,
train_dataloader
,
valid_dataloader
,
device
,
model
,
program
.
train
(
config
,
train_dataloader
,
valid_dataloader
,
device
,
model
,
loss_class
,
optimizer
,
lr_scheduler
,
post_process_class
,
loss_class
,
optimizer
,
lr_scheduler
,
post_process_class
,
eval_class
,
pre_best_model_dict
,
logger
,
vdl_writer
,
eval_class
,
pre_best_model_dict
,
logger
,
vdl_writer
)
profiler_options
)
def
test_reader
(
config
,
device
,
logger
):
def
test_reader
(
config
,
device
,
logger
):
...
@@ -128,8 +127,8 @@ def test_reader(config, device, logger):
...
@@ -128,8 +127,8 @@ def test_reader(config, device, logger):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
config
,
device
,
logger
,
vdl_writer
,
profiler_options
=
program
.
preprocess
(
config
,
device
,
logger
,
vdl_writer
=
program
.
preprocess
(
is_train
=
True
)
is_train
=
True
)
main
(
config
,
device
,
logger
,
vdl_writer
,
profiler_options
)
logger
.
info
(
f
"config.profiler_options:
{
config
.
profiler_options
}
"
)
# test_reader(config, device, logg
er)
main
(
config
,
device
,
logger
,
vdl_writ
er
)
# test_reader(config, device, logger)
# test_reader(config, device, logger)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录