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
b8ceb49c
Commit
b8ceb49c
authored
Sep 05, 2019
by
Vinh Nguyen
Browse files
adding perfzero benchmark configs
parent
0adbb1c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
0 deletions
+72
-0
official/bert/benchmark/bert_benchmark.py
official/bert/benchmark/bert_benchmark.py
+37
-0
official/bert/benchmark/bert_squad_benchmark.py
official/bert/benchmark/bert_squad_benchmark.py
+35
-0
No files found.
official/bert/benchmark/bert_benchmark.py
View file @
b8ceb49c
...
@@ -227,6 +227,43 @@ class BertClassifyBenchmarkReal(BertClassifyBenchmarkBase):
...
@@ -227,6 +227,43 @@ class BertClassifyBenchmarkReal(BertClassifyBenchmarkBase):
summary_path
=
os
.
path
.
join
(
FLAGS
.
model_dir
,
'training_summary.txt'
)
summary_path
=
os
.
path
.
join
(
FLAGS
.
model_dir
,
'training_summary.txt'
)
self
.
_run_and_report_benchmark
(
summary_path
)
self
.
_run_and_report_benchmark
(
summary_path
)
def
benchmark_1_gpu_amp_mrpc_no_dist_strat
(
self
):
"""Test BERT model performance with 1 GPU, no distribution strategy
with automatic mixed precision """
self
.
_setup
()
self
.
num_gpus
=
1
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_amp_mrpc_no_dist_strat'
)
FLAGS
.
train_data_path
=
self
.
train_data_path
FLAGS
.
eval_data_path
=
self
.
eval_data_path
FLAGS
.
input_meta_data_path
=
self
.
input_meta_data_path
FLAGS
.
bert_config_file
=
self
.
bert_config_file
FLAGS
.
train_batch_size
=
4
FLAGS
.
eval_batch_size
=
4
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
summary_path
=
os
.
path
.
join
(
FLAGS
.
model_dir
,
'training_summary.txt'
)
self
.
_run_and_report_benchmark
(
summary_path
,
use_ds
=
False
)
def
benchmark_8_gpu_amp_mrpc
(
self
):
"""Test BERT model performance with 8 GPUs
with automatic mixed precision """
self
.
_setup
()
self
.
num_gpus
=
8
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_amp_mrpc'
)
FLAGS
.
train_data_path
=
self
.
train_data_path
FLAGS
.
eval_data_path
=
self
.
eval_data_path
FLAGS
.
input_meta_data_path
=
self
.
input_meta_data_path
FLAGS
.
bert_config_file
=
self
.
bert_config_file
FLAGS
.
train_batch_size
=
32
FLAGS
.
eval_batch_size
=
32
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
summary_path
=
os
.
path
.
join
(
FLAGS
.
model_dir
,
'training_summary.txt'
)
self
.
_run_and_report_benchmark
(
summary_path
,
use_ds
=
False
)
class
BertClassifyAccuracy
(
BertClassifyBenchmarkBase
):
class
BertClassifyAccuracy
(
BertClassifyBenchmarkBase
):
"""Short accuracy test for BERT model.
"""Short accuracy test for BERT model.
...
...
official/bert/benchmark/bert_squad_benchmark.py
View file @
b8ceb49c
...
@@ -281,6 +281,41 @@ class BertSquadBenchmarkReal(BertSquadBenchmarkBase):
...
@@ -281,6 +281,41 @@ class BertSquadBenchmarkReal(BertSquadBenchmarkBase):
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
def
benchmark_1_gpu_amp
(
self
):
"""Tests BERT SQuAD model performance with 1 GPU with automatic mixed precision."""
self
.
_setup
()
self
.
num_gpus
=
1
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_amp_squad'
)
FLAGS
.
train_batch_size
=
4
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
self
.
_run_and_report_benchmark
()
def
benchmark_4_gpu_amp
(
self
):
"""Tests BERT SQuAD model performance with 1 GPU with automatic mixed precision."""
self
.
_setup
()
self
.
num_gpus
=
4
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_4_gpu_amp_squad'
)
FLAGS
.
train_batch_size
=
16
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
self
.
_run_and_report_benchmark
()
def
benchmark_8_gpu_amp
(
self
):
"""Tests BERT SQuAD model performance with 1 GPU with automatic mixed precision."""
self
.
_setup
()
self
.
num_gpus
=
8
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_amp_squad'
)
FLAGS
.
train_batch_size
=
32
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
self
.
_run_and_report_benchmark
()
class
BertSquadAccuracy
(
BertSquadBenchmarkBase
):
class
BertSquadAccuracy
(
BertSquadBenchmarkBase
):
"""Short accuracy test for BERT SQuAD model.
"""Short accuracy test for BERT SQuAD model.
...
...
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