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
f6c2d9f8
Unverified
Commit
f6c2d9f8
authored
May 30, 2019
by
Haoyu Zhang
Committed by
GitHub
May 30, 2019
Browse files
Support pure eager execution in ResNet50 (#6929)
* Support pure eager execution in ResNet50 * Use smaller batch size
parent
15db2195
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
official/resnet/keras/keras_common.py
official/resnet/keras/keras_common.py
+3
-0
official/resnet/keras/keras_imagenet_benchmark.py
official/resnet/keras/keras_imagenet_benchmark.py
+13
-0
official/resnet/keras/keras_imagenet_main.py
official/resnet/keras/keras_imagenet_main.py
+1
-0
No files found.
official/resnet/keras/keras_common.py
View file @
f6c2d9f8
...
...
@@ -279,6 +279,9 @@ def define_keras_flags():
"""Define flags for Keras models."""
flags
.
DEFINE_boolean
(
name
=
'enable_eager'
,
default
=
False
,
help
=
'Enable eager?'
)
flags
.
DEFINE_boolean
(
name
=
'run_eagerly'
,
default
=
False
,
help
=
'Run the model op by op without building a model function.'
)
flags
.
DEFINE_boolean
(
name
=
'skip_eval'
,
default
=
False
,
help
=
'Skip evaluation?'
)
flags
.
DEFINE_boolean
(
name
=
'use_trivial_model'
,
default
=
False
,
help
=
'Whether to use a trivial Keras model.'
)
...
...
official/resnet/keras/keras_imagenet_benchmark.py
View file @
f6c2d9f8
...
...
@@ -192,6 +192,19 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
def
benchmark_1_gpu_no_dist_strat_run_eagerly
(
self
):
"""Test Keras model with 1 GPU, no distribution strategy, run eagerly."""
self
.
_setup
()
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
run_eagerly
=
True
FLAGS
.
distribution_strategy
=
'off'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_no_dist_strat_run_eagerly'
)
FLAGS
.
batch_size
=
64
self
.
_run_and_report_benchmark
()
def
benchmark_graph_1_gpu_no_dist_strat
(
self
):
"""Test Keras model in legacy graph mode with 1 GPU, no dist strat."""
self
.
_setup
()
...
...
official/resnet/keras/keras_imagenet_main.py
View file @
f6c2d9f8
...
...
@@ -222,6 +222,7 @@ def run(flags_obj):
optimizer
=
optimizer
,
metrics
=
([
'sparse_categorical_accuracy'
]
if
flags_obj
.
report_accuracy_metrics
else
None
),
run_eagerly
=
flags_obj
.
run_eagerly
,
cloning
=
flags_obj
.
clone_model_in_keras_dist_strat
)
callbacks
=
keras_common
.
get_callbacks
(
...
...
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