Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
9cf6c4e8
Commit
9cf6c4e8
authored
Sep 29, 2021
by
LDOUBLEV
Browse files
fix profile_options
parent
8dd14799
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
tools/program.py
tools/program.py
+6
-3
tools/train.py
tools/train.py
+5
-6
No files found.
tools/program.py
View file @
9cf6c4e8
...
...
@@ -159,8 +159,7 @@ def train(config,
eval_class
,
pre_best_model_dict
,
logger
,
vdl_writer
=
None
,
profiler_options
=
None
):
vdl_writer
=
None
):
cal_metric_during_train
=
config
[
'Global'
].
get
(
'cal_metric_during_train'
,
False
)
log_smooth_window
=
config
[
'Global'
][
'log_smooth_window'
]
...
...
@@ -168,6 +167,8 @@ def train(config,
print_batch_step
=
config
[
'Global'
][
'print_batch_step'
]
eval_batch_step
=
config
[
'Global'
][
'eval_batch_step'
]
profiler_options
=
config
[
'profiler_options'
]
global_step
=
0
if
'global_step'
in
pre_best_model_dict
:
global_step
=
pre_best_model_dict
[
'global_step'
]
...
...
@@ -405,6 +406,8 @@ def preprocess(is_train=False):
profiler_options
=
FLAGS
.
profiler_options
config
=
load_config
(
FLAGS
.
config
)
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
use_gpu
=
config
[
'Global'
][
'use_gpu'
]
...
...
@@ -442,4 +445,4 @@ def preprocess(is_train=False):
print_dict
(
config
,
logger
)
logger
.
info
(
'train with paddle {} and device {}'
.
format
(
paddle
.
__version__
,
device
))
return
config
,
device
,
logger
,
vdl_writer
,
profiler_options
return
config
,
device
,
logger
,
vdl_writer
tools/train.py
View file @
9cf6c4e8
...
...
@@ -41,7 +41,7 @@ import tools.program as program
dist
.
get_world_size
()
def
main
(
config
,
device
,
logger
,
vdl_writer
,
profiler_options
):
def
main
(
config
,
device
,
logger
,
vdl_writer
):
# init dist environment
if
config
[
'Global'
][
'distributed'
]:
dist
.
init_parallel_env
()
...
...
@@ -105,8 +105,7 @@ def main(config, device, logger, vdl_writer, profiler_options):
# start train
program
.
train
(
config
,
train_dataloader
,
valid_dataloader
,
device
,
model
,
loss_class
,
optimizer
,
lr_scheduler
,
post_process_class
,
eval_class
,
pre_best_model_dict
,
logger
,
vdl_writer
,
profiler_options
)
eval_class
,
pre_best_model_dict
,
logger
,
vdl_writer
)
def
test_reader
(
config
,
device
,
logger
):
...
...
@@ -128,8 +127,8 @@ def test_reader(config, device, logger):
if
__name__
==
'__main__'
:
config
,
device
,
logger
,
vdl_writer
,
profiler_options
=
program
.
preprocess
(
config
,
device
,
logger
,
vdl_writer
=
program
.
preprocess
(
is_train
=
True
)
main
(
config
,
device
,
logger
,
vdl_writer
,
profiler_options
)
# test_reader
(config, device, logger)
logger
.
info
(
f
"config.profiler_options:
{
config
.
profiler_options
}
"
)
main
(
config
,
device
,
logger
,
vdl_writer
)
# test_reader(config, device, logger)
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