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
ModelZoo
ResNet50_tensorflow
Commits
154d3ffa
Unverified
Commit
154d3ffa
authored
Apr 02, 2019
by
Haoyu Zhang
Committed by
GitHub
Apr 02, 2019
Browse files
Add flag to enable Xprof (#6352)
parent
6dea4846
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
official/resnet/keras/keras_common.py
official/resnet/keras/keras_common.py
+5
-0
official/resnet/keras/keras_imagenet_main.py
official/resnet/keras/keras_imagenet_main.py
+7
-0
No files found.
official/resnet/keras/keras_common.py
View file @
154d3ffa
...
...
@@ -215,6 +215,11 @@ def define_keras_flags():
help
=
'The number of steps to run for training. If it is larger than '
'# batches per epoch, then use # batches per epoch. When this flag is '
'set, only one epoch is going to run for training.'
)
flags
.
DEFINE_boolean
(
name
=
'enable_e2e_xprof'
,
default
=
False
,
help
=
'Save end-to-end profiling data to model dir using Xprof. Profiling '
'has an overhead on both computation and memory usage, and can generate '
'gigantic files when profiling a lot of steps.'
)
def
get_synth_input_fn
(
height
,
width
,
num_channels
,
num_classes
,
...
...
official/resnet/keras/keras_imagenet_main.py
View file @
154d3ffa
...
...
@@ -22,6 +22,7 @@ from absl import app as absl_app
from
absl
import
flags
import
tensorflow
as
tf
# pylint: disable=g-bad-import-order
from
tensorflow.python.eager
import
profiler
from
official.resnet
import
imagenet_main
from
official.resnet.keras
import
keras_common
from
official.resnet.keras
import
resnet_model
...
...
@@ -220,6 +221,8 @@ def run(flags_obj):
callbacks
=
[
time_callback
,
lr_callback
]
if
flags_obj
.
enable_tensorboard
:
callbacks
.
append
(
tensorboard_callback
)
if
flags_obj
.
enable_e2e_xprof
:
profiler
.
start
()
history
=
model
.
fit
(
train_input_dataset
,
epochs
=
train_epochs
,
...
...
@@ -230,6 +233,10 @@ def run(flags_obj):
validation_freq
=
flags_obj
.
epochs_between_evals
,
verbose
=
2
)
if
flags_obj
.
enable_e2e_xprof
:
results
=
profiler
.
stop
()
profiler
.
save
(
flags_obj
.
model_dir
,
results
)
eval_output
=
None
if
not
flags_obj
.
skip_eval
:
eval_output
=
model
.
evaluate
(
eval_input_dataset
,
...
...
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