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
543fb4cf
Commit
543fb4cf
authored
Apr 22, 2020
by
Tayo Oguntebi
Committed by
A. Unique TensorFlower
Apr 22, 2020
Browse files
Internal change
PiperOrigin-RevId: 307950230
parent
c1468202
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
official/benchmark/transformer_benchmark.py
official/benchmark/transformer_benchmark.py
+27
-1
No files found.
official/benchmark/transformer_benchmark.py
View file @
543fb4cf
...
@@ -112,7 +112,7 @@ class TransformerBenchmark(PerfZeroBenchmark):
...
@@ -112,7 +112,7 @@ class TransformerBenchmark(PerfZeroBenchmark):
'max_value'
:
bleu_max
})
'max_value'
:
bleu_max
})
if
(
warmup
and
'step_timestamp_log'
in
stats
and
if
(
warmup
and
'step_timestamp_log'
in
stats
and
len
(
stats
[
'step_timestamp_log'
])
>
warmup
):
len
(
stats
[
'step_timestamp_log'
])
>
warmup
+
1
):
# first entry in the time_log is start of step 1. The rest of the
# first entry in the time_log is start of step 1. The rest of the
# entries are the end of each step recorded
# entries are the end of each step recorded
time_log
=
stats
[
'step_timestamp_log'
]
time_log
=
stats
[
'step_timestamp_log'
]
...
@@ -127,6 +127,11 @@ class TransformerBenchmark(PerfZeroBenchmark):
...
@@ -127,6 +127,11 @@ class TransformerBenchmark(PerfZeroBenchmark):
metrics
.
append
({
'name'
:
'avg_exp_per_second'
,
metrics
.
append
({
'name'
:
'avg_exp_per_second'
,
'value'
:
stats
[
'avg_exp_per_second'
]})
'value'
:
stats
[
'avg_exp_per_second'
]})
if
'step_timestamp_log'
in
stats
:
time_log
=
stats
[
'step_timestamp_log'
]
metrics
.
append
({
'name'
:
'startup_time'
,
'value'
:
time_log
[
0
].
timestamp
-
start_time_sec
})
flags_str
=
flags_core
.
get_nondefault_flags_as_str
()
flags_str
=
flags_core
.
get_nondefault_flags_as_str
()
self
.
report_benchmark
(
iters
=-
1
,
wall_time
=
wall_time_sec
,
metrics
=
metrics
,
self
.
report_benchmark
(
iters
=-
1
,
wall_time
=
wall_time_sec
,
metrics
=
metrics
,
extras
=
{
'flags'
:
flags_str
})
extras
=
{
'flags'
:
flags_str
})
...
@@ -686,6 +691,7 @@ class TransformerBigKerasBenchmarkReal(TransformerKerasBenchmark):
...
@@ -686,6 +691,7 @@ class TransformerBigKerasBenchmarkReal(TransformerKerasBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_2x2_tpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_2x2_tpu'
)
FLAGS
.
train_steps
=
300
FLAGS
.
train_steps
=
300
FLAGS
.
log_steps
=
300
FLAGS
.
distribution_strategy
=
'tpu'
FLAGS
.
distribution_strategy
=
'tpu'
FLAGS
.
static_batch
=
True
FLAGS
.
static_batch
=
True
FLAGS
.
use_ctl
=
True
FLAGS
.
use_ctl
=
True
...
@@ -700,6 +706,26 @@ class TransformerBigKerasBenchmarkReal(TransformerKerasBenchmark):
...
@@ -700,6 +706,26 @@ class TransformerBigKerasBenchmarkReal(TransformerKerasBenchmark):
total_batch_size
=
FLAGS
.
batch_size
,
total_batch_size
=
FLAGS
.
batch_size
,
log_steps
=
FLAGS
.
log_steps
)
log_steps
=
FLAGS
.
log_steps
)
def
benchmark_4x4_tpu
(
self
):
"""Port of former GCP transformer_big model on 4x4."""
self
.
_setup
()
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_4x4_tpu'
)
FLAGS
.
train_steps
=
300
FLAGS
.
log_steps
=
300
FLAGS
.
distribution_strategy
=
'tpu'
FLAGS
.
static_batch
=
True
FLAGS
.
use_ctl
=
True
FLAGS
.
batch_size
=
24576
FLAGS
.
max_length
=
64
FLAGS
.
decode_batch_size
=
32
FLAGS
.
decode_max_length
=
97
FLAGS
.
padded_decode
=
True
FLAGS
.
enable_checkpointing
=
False
self
.
_run_and_report_benchmark
(
total_batch_size
=
FLAGS
.
batch_size
,
log_steps
=
FLAGS
.
log_steps
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
tf
.
test
.
main
()
tf
.
test
.
main
()
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