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
04256053
Commit
04256053
authored
Nov 26, 2019
by
Hongkun Yu
Committed by
A. Unique TensorFlower
Nov 26, 2019
Browse files
Remove 'default' in get_distribution_strategy which is complex and error-prone
PiperOrigin-RevId: 282669615
parent
30165f86
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
72 additions
and
77 deletions
+72
-77
official/benchmark/keras_cifar_benchmark.py
official/benchmark/keras_cifar_benchmark.py
+6
-6
official/benchmark/keras_imagenet_benchmark.py
official/benchmark/keras_imagenet_benchmark.py
+37
-37
official/benchmark/resnet_ctl_imagenet_benchmark.py
official/benchmark/resnet_ctl_imagenet_benchmark.py
+7
-7
official/utils/flags/_base.py
official/utils/flags/_base.py
+2
-2
official/utils/misc/distribution_utils.py
official/utils/misc/distribution_utils.py
+9
-14
official/vision/image_classification/resnet_cifar_test.py
official/vision/image_classification/resnet_cifar_test.py
+4
-4
official/vision/image_classification/resnet_ctl_imagenet_test.py
...l/vision/image_classification/resnet_ctl_imagenet_test.py
+1
-1
official/vision/image_classification/resnet_imagenet_test.py
official/vision/image_classification/resnet_imagenet_test.py
+6
-6
No files found.
official/benchmark/keras_cifar_benchmark.py
View file @
04256053
...
@@ -241,7 +241,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -241,7 +241,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -253,7 +253,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -253,7 +253,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
run_eagerly
=
False
FLAGS
.
run_eagerly
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_xla'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_xla'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -263,7 +263,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -263,7 +263,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_force_v1_path'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_force_v1_path'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
FLAGS
.
force_v2_in_keras_compile
=
False
FLAGS
.
force_v2_in_keras_compile
=
False
...
@@ -275,7 +275,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -275,7 +275,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
run_eagerly
=
False
FLAGS
.
run_eagerly
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_1_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_1_gpu'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -346,7 +346,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -346,7 +346,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
2
FLAGS
.
num_gpus
=
2
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
run_eagerly
=
False
FLAGS
.
run_eagerly
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_2_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_2_gpu'
)
FLAGS
.
batch_size
=
128
*
2
# 2 GPUs
FLAGS
.
batch_size
=
128
*
2
# 2 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -357,7 +357,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -357,7 +357,7 @@ class Resnet56KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
2
FLAGS
.
num_gpus
=
2
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
run_eagerly
=
False
FLAGS
.
run_eagerly
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_2_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_2_gpu'
)
FLAGS
.
batch_size
=
128
*
2
# 2 GPUs
FLAGS
.
batch_size
=
128
*
2
# 2 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
...
official/benchmark/keras_imagenet_benchmark.py
View file @
04256053
...
@@ -319,7 +319,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -319,7 +319,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -332,7 +332,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -332,7 +332,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_amp'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_amp'
)
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -344,7 +344,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -344,7 +344,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -358,7 +358,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -358,7 +358,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_amp'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_amp'
)
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -369,7 +369,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -369,7 +369,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_fp16'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_fp16'
)
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
...
@@ -381,7 +381,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -381,7 +381,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_fp16_dynamic'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_fp16_dynamic'
)
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
...
@@ -395,7 +395,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -395,7 +395,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_fp16'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_fp16'
)
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
...
@@ -408,7 +408,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -408,7 +408,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_fp16_tweaked'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_fp16_tweaked'
)
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
...
@@ -423,7 +423,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -423,7 +423,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_fp16_dynamic'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_fp16_dynamic'
)
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
...
@@ -436,7 +436,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -436,7 +436,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_1_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_1_gpu'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -448,7 +448,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -448,7 +448,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_1_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_1_gpu'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -460,7 +460,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -460,7 +460,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_1_gpu_fp16'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_1_gpu_fp16'
)
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -473,7 +473,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -473,7 +473,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_1_gpu_fp16'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_1_gpu_fp16'
)
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -485,7 +485,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -485,7 +485,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_1_gpu_fp16_tweaked'
)
'benchmark_graph_xla_1_gpu_fp16_tweaked'
)
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
...
@@ -500,7 +500,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -500,7 +500,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu'
)
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -513,7 +513,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -513,7 +513,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_amp'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_amp'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -524,7 +524,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -524,7 +524,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_tweaked'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_tweaked'
)
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
FLAGS
.
use_tensor_lr
=
True
FLAGS
.
use_tensor_lr
=
True
...
@@ -538,7 +538,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -538,7 +538,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu'
)
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -552,7 +552,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -552,7 +552,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
FLAGS
.
fp16_implementation
=
'graph_rewrite'
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_amp'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_amp'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -564,7 +564,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -564,7 +564,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_tweaked'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_tweaked'
)
FLAGS
.
batch_size
=
128
*
8
FLAGS
.
batch_size
=
128
*
8
FLAGS
.
use_tensor_lr
=
True
FLAGS
.
use_tensor_lr
=
True
...
@@ -579,7 +579,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -579,7 +579,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_fp16'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_fp16'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -591,7 +591,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -591,7 +591,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_fp16_tweaked'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_fp16_tweaked'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
use_tensor_lr
=
True
FLAGS
.
use_tensor_lr
=
True
...
@@ -605,7 +605,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -605,7 +605,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_fp16_dynamic_tweaked'
)
'benchmark_8_gpu_fp16_dynamic_tweaked'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
...
@@ -622,7 +622,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -622,7 +622,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_fp16'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_fp16'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -635,7 +635,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -635,7 +635,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_fp16_tweaked'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_fp16_tweaked'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
use_tensor_lr
=
True
FLAGS
.
use_tensor_lr
=
True
...
@@ -654,7 +654,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -654,7 +654,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_fp16_tweaked_delay_measure'
)
'benchmark_xla_8_gpu_fp16_tweaked_delay_measure'
)
FLAGS
.
batch_size
=
256
*
8
FLAGS
.
batch_size
=
256
*
8
...
@@ -671,7 +671,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -671,7 +671,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_eager
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_fp16_dynamic_tweaked'
)
'benchmark_xla_8_gpu_fp16_dynamic_tweaked'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
...
@@ -687,7 +687,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -687,7 +687,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_8_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_8_gpu'
)
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -699,7 +699,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -699,7 +699,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_8_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_8_gpu'
)
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -711,7 +711,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -711,7 +711,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_8_gpu_fp16'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_8_gpu_fp16'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -724,7 +724,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -724,7 +724,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_8_gpu_fp16'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_8_gpu_fp16'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -736,7 +736,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -736,7 +736,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_8_gpu_fp16_tweaked'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_8_gpu_fp16_tweaked'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
use_tensor_lr
=
True
FLAGS
.
use_tensor_lr
=
True
...
@@ -751,7 +751,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -751,7 +751,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_8_gpu_fp16_tweaked'
)
'benchmark_graph_xla_8_gpu_fp16_tweaked'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
...
@@ -770,7 +770,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -770,7 +770,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_8_gpu_fp16_tweaked_delay_measure'
)
'benchmark_graph_xla_8_gpu_fp16_tweaked_delay_measure'
)
FLAGS
.
batch_size
=
256
*
8
FLAGS
.
batch_size
=
256
*
8
...
@@ -786,7 +786,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -786,7 +786,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_8_gpu_fp16_dynamic_tweaked'
)
'benchmark_graph_8_gpu_fp16_dynamic_tweaked'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
...
@@ -803,7 +803,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
...
@@ -803,7 +803,7 @@ class Resnet50KerasBenchmarkBase(keras_benchmark.KerasBenchmark):
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_eager
=
False
FLAGS
.
enable_xla
=
True
FLAGS
.
enable_xla
=
True
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_graph_xla_8_gpu_fp16_dynamic_tweaked'
)
'benchmark_graph_xla_8_gpu_fp16_dynamic_tweaked'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
...
@@ -888,7 +888,7 @@ class TrivialKerasBenchmarkReal(keras_benchmark.KerasBenchmark):
...
@@ -888,7 +888,7 @@ class TrivialKerasBenchmarkReal(keras_benchmark.KerasBenchmark):
def_flags
[
'data_dir'
]
=
os
.
path
.
join
(
root_data_dir
,
'imagenet'
)
def_flags
[
'data_dir'
]
=
os
.
path
.
join
(
root_data_dir
,
'imagenet'
)
def_flags
[
'train_steps'
]
=
600
def_flags
[
'train_steps'
]
=
600
def_flags
[
'log_steps'
]
=
100
def_flags
[
'log_steps'
]
=
100
def_flags
[
'distribution_strategy'
]
=
'
default
'
def_flags
[
'distribution_strategy'
]
=
'
mirrored
'
super
(
TrivialKerasBenchmarkReal
,
self
).
__init__
(
super
(
TrivialKerasBenchmarkReal
,
self
).
__init__
(
output_dir
=
output_dir
,
output_dir
=
output_dir
,
...
...
official/benchmark/resnet_ctl_imagenet_benchmark.py
View file @
04256053
...
@@ -231,7 +231,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
...
@@ -231,7 +231,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu'
)
FLAGS
.
batch_size
=
128
FLAGS
.
batch_size
=
128
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -241,7 +241,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
...
@@ -241,7 +241,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_amp'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_amp'
)
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
...
@@ -253,7 +253,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
...
@@ -253,7 +253,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_amp'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_1_gpu_amp'
)
FLAGS
.
batch_size
=
256
FLAGS
.
batch_size
=
256
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
...
@@ -266,7 +266,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
...
@@ -266,7 +266,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
1
FLAGS
.
num_gpus
=
1
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
one_device
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_eager'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_1_gpu_eager'
)
FLAGS
.
batch_size
=
64
FLAGS
.
batch_size
=
64
FLAGS
.
use_tf_function
=
False
FLAGS
.
use_tf_function
=
False
...
@@ -278,7 +278,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
...
@@ -278,7 +278,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu'
)
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
FLAGS
.
batch_size
=
128
*
8
# 8 GPUs
self
.
_run_and_report_benchmark
()
self
.
_run_and_report_benchmark
()
...
@@ -288,7 +288,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
...
@@ -288,7 +288,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_amp'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_8_gpu_amp'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
...
@@ -300,7 +300,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
...
@@ -300,7 +300,7 @@ class Resnet50CtlBenchmarkBase(CtlBenchmark):
self
.
_setup
()
self
.
_setup
()
FLAGS
.
num_gpus
=
8
FLAGS
.
num_gpus
=
8
FLAGS
.
distribution_strategy
=
'
default
'
FLAGS
.
distribution_strategy
=
'
mirrored
'
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_amp'
)
FLAGS
.
model_dir
=
self
.
_get_model_dir
(
'benchmark_xla_8_gpu_amp'
)
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
batch_size
=
256
*
8
# 8 GPUs
FLAGS
.
dtype
=
'fp16'
FLAGS
.
dtype
=
'fp16'
...
...
official/utils/flags/_base.py
View file @
04256053
...
@@ -139,9 +139,9 @@ def define_base(data_dir=True, model_dir=True, clean=False, train_epochs=False,
...
@@ -139,9 +139,9 @@ def define_base(data_dir=True, model_dir=True, clean=False, train_epochs=False,
if
distribution_strategy
:
if
distribution_strategy
:
flags
.
DEFINE_string
(
flags
.
DEFINE_string
(
name
=
"distribution_strategy"
,
short_name
=
"ds"
,
default
=
"
default
"
,
name
=
"distribution_strategy"
,
short_name
=
"ds"
,
default
=
"
mirrored
"
,
help
=
help_wrap
(
"The Distribution Strategy to use for training. "
help
=
help_wrap
(
"The Distribution Strategy to use for training. "
"Accepted values are 'off',
'default',
'one_device', "
"Accepted values are 'off', 'one_device', "
"'mirrored', 'parameter_server', 'collective', "
"'mirrored', 'parameter_server', 'collective', "
"case insensitive. 'off' means not to use "
"case insensitive. 'off' means not to use "
"Distribution Strategy; 'default' means to choose "
"Distribution Strategy; 'default' means to choose "
...
...
official/utils/misc/distribution_utils.py
View file @
04256053
...
@@ -81,7 +81,7 @@ def _mirrored_cross_device_ops(all_reduce_alg, num_packs):
...
@@ -81,7 +81,7 @@ def _mirrored_cross_device_ops(all_reduce_alg, num_packs):
return
cross_device_ops_class
(
num_packs
=
num_packs
)
return
cross_device_ops_class
(
num_packs
=
num_packs
)
def
get_distribution_strategy
(
distribution_strategy
=
"
default
"
,
def
get_distribution_strategy
(
distribution_strategy
=
"
mirrored
"
,
num_gpus
=
0
,
num_gpus
=
0
,
num_workers
=
1
,
num_workers
=
1
,
all_reduce_alg
=
None
,
all_reduce_alg
=
None
,
...
@@ -91,11 +91,9 @@ def get_distribution_strategy(distribution_strategy="default",
...
@@ -91,11 +91,9 @@ def get_distribution_strategy(distribution_strategy="default",
Args:
Args:
distribution_strategy: a string specifying which distribution strategy to
distribution_strategy: a string specifying which distribution strategy to
use. Accepted values are 'off',
'default',
'one_device', 'mirrored',
use. Accepted values are 'off', 'one_device', 'mirrored',
'parameter_server', 'multi_worker_mirrored', and 'tpu' -- case insensitive.
'parameter_server', 'multi_worker_mirrored', and 'tpu' -- case insensitive.
'off' means not to use Distribution Strategy; 'default' means to choose from
'off' means not to use Distribution Strategy; 'tpu' means to use
`MirroredStrategy`, `MultiWorkerMirroredStrategy`, or `OneDeviceStrategy`
according to the number of GPUs and number of workers. 'tpu' means to use
TPUStrategy using `tpu_address`.
TPUStrategy using `tpu_address`.
num_gpus: Number of GPUs to run this model.
num_gpus: Number of GPUs to run this model.
num_workers: Number of workers to run this model.
num_workers: Number of workers to run this model.
...
@@ -135,19 +133,16 @@ def get_distribution_strategy(distribution_strategy="default",
...
@@ -135,19 +133,16 @@ def get_distribution_strategy(distribution_strategy="default",
return
tf
.
distribute
.
experimental
.
MultiWorkerMirroredStrategy
(
return
tf
.
distribute
.
experimental
.
MultiWorkerMirroredStrategy
(
communication
=
_collective_communication
(
all_reduce_alg
))
communication
=
_collective_communication
(
all_reduce_alg
))
if
(
distribution_strategy
==
"one_device"
or
if
distribution_strategy
==
"one_device"
:
(
distribution_strategy
==
"default"
and
num_gpus
<=
1
)):
if
num_gpus
==
0
:
if
num_gpus
==
0
:
return
tf
.
distribute
.
OneDeviceStrategy
(
"device:CPU:0"
)
return
tf
.
distribute
.
OneDeviceStrategy
(
"device:CPU:0"
)
else
:
if
num_gpus
>
1
:
if
num_gpus
>
1
:
raise
ValueError
(
"`OneDeviceStrategy` can not be used for more than "
raise
ValueError
(
"`OneDeviceStrategy` can not be used for more than "
"one device."
)
"one device."
)
return
tf
.
distribute
.
OneDeviceStrategy
(
"device:GPU:0"
)
return
tf
.
distribute
.
OneDeviceStrategy
(
"device:GPU:0"
)
if
distribution_strategy
in
(
"mirrored"
,
"default"
)
:
if
distribution_strategy
==
"mirrored"
:
if
num_gpus
==
0
:
if
num_gpus
==
0
:
assert
distribution_strategy
==
"mirrored"
devices
=
[
"device:CPU:0"
]
devices
=
[
"device:CPU:0"
]
else
:
else
:
devices
=
[
"device:GPU:%d"
%
i
for
i
in
range
(
num_gpus
)]
devices
=
[
"device:GPU:%d"
%
i
for
i
in
range
(
num_gpus
)]
...
...
official/vision/image_classification/resnet_cifar_test.py
View file @
04256053
...
@@ -104,7 +104,7 @@ class KerasCifarTest(googletest.TestCase):
...
@@ -104,7 +104,7 @@ class KerasCifarTest(googletest.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"1"
,
"-num_gpus"
,
"1"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
"-model_dir"
,
"keras_cifar_1_gpu"
,
"-model_dir"
,
"keras_cifar_1_gpu"
,
"-data_format"
,
"channels_last"
,
"-data_format"
,
"channels_last"
,
]
]
...
@@ -126,7 +126,7 @@ class KerasCifarTest(googletest.TestCase):
...
@@ -126,7 +126,7 @@ class KerasCifarTest(googletest.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"1"
,
"-num_gpus"
,
"1"
,
"-noenable_eager"
,
"-noenable_eager"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
"-model_dir"
,
"keras_cifar_graph_1_gpu"
,
"-model_dir"
,
"keras_cifar_graph_1_gpu"
,
"-data_format"
,
"channels_last"
,
"-data_format"
,
"channels_last"
,
]
]
...
@@ -150,7 +150,7 @@ class KerasCifarTest(googletest.TestCase):
...
@@ -150,7 +150,7 @@ class KerasCifarTest(googletest.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"2"
,
"-num_gpus"
,
"2"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
"-model_dir"
,
"keras_cifar_2_gpu"
,
"-model_dir"
,
"keras_cifar_2_gpu"
,
]
]
extra_flags
=
extra_flags
+
self
.
_extra_flags
extra_flags
=
extra_flags
+
self
.
_extra_flags
...
@@ -171,7 +171,7 @@ class KerasCifarTest(googletest.TestCase):
...
@@ -171,7 +171,7 @@ class KerasCifarTest(googletest.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"2"
,
"-num_gpus"
,
"2"
,
"-enable_eager"
,
"false"
,
"-enable_eager"
,
"false"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
"-model_dir"
,
"keras_cifar_graph_2_gpu"
,
"-model_dir"
,
"keras_cifar_graph_2_gpu"
,
]
]
extra_flags
=
extra_flags
+
self
.
_extra_flags
extra_flags
=
extra_flags
+
self
.
_extra_flags
...
...
official/vision/image_classification/resnet_ctl_imagenet_test.py
View file @
04256053
...
@@ -82,7 +82,7 @@ class CtlImagenetTest(tf.test.TestCase):
...
@@ -82,7 +82,7 @@ class CtlImagenetTest(tf.test.TestCase):
extra_flags
=
[
extra_flags
=
[
'-num_gpus'
,
num_gpus
,
'-num_gpus'
,
num_gpus
,
'-distribution_strategy'
,
'
default
'
,
'-distribution_strategy'
,
'
mirrored
'
,
'-model_dir'
,
'ctl_imagenet_2_gpu'
,
'-model_dir'
,
'ctl_imagenet_2_gpu'
,
'-data_format'
,
'channels_last'
,
'-data_format'
,
'channels_last'
,
]
]
...
...
official/vision/image_classification/resnet_imagenet_test.py
View file @
04256053
...
@@ -94,7 +94,7 @@ class KerasImagenetTest(tf.test.TestCase):
...
@@ -94,7 +94,7 @@ class KerasImagenetTest(tf.test.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"1"
,
"-num_gpus"
,
"1"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
"-data_format"
,
"channels_last"
,
"-data_format"
,
"channels_last"
,
"-enable_checkpoint_and_export"
,
"1"
,
"-enable_checkpoint_and_export"
,
"1"
,
]
]
...
@@ -119,7 +119,7 @@ class KerasImagenetTest(tf.test.TestCase):
...
@@ -119,7 +119,7 @@ class KerasImagenetTest(tf.test.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"1"
,
"-num_gpus"
,
"1"
,
"-dtype"
,
"fp16"
,
"-dtype"
,
"fp16"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
"-data_format"
,
"channels_last"
,
"-data_format"
,
"channels_last"
,
]
]
extra_flags
=
extra_flags
+
self
.
_extra_flags
extra_flags
=
extra_flags
+
self
.
_extra_flags
...
@@ -143,7 +143,7 @@ class KerasImagenetTest(tf.test.TestCase):
...
@@ -143,7 +143,7 @@ class KerasImagenetTest(tf.test.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"2"
,
"-num_gpus"
,
"2"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
]
]
extra_flags
=
extra_flags
+
self
.
_extra_flags
extra_flags
=
extra_flags
+
self
.
_extra_flags
...
@@ -166,7 +166,7 @@ class KerasImagenetTest(tf.test.TestCase):
...
@@ -166,7 +166,7 @@ class KerasImagenetTest(tf.test.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"2"
,
"-num_gpus"
,
"2"
,
"-enable_xla"
,
"true"
,
"-enable_xla"
,
"true"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
]
]
extra_flags
=
extra_flags
+
self
.
_extra_flags
extra_flags
=
extra_flags
+
self
.
_extra_flags
...
@@ -189,7 +189,7 @@ class KerasImagenetTest(tf.test.TestCase):
...
@@ -189,7 +189,7 @@ class KerasImagenetTest(tf.test.TestCase):
extra_flags
=
[
extra_flags
=
[
"-num_gpus"
,
"2"
,
"-num_gpus"
,
"2"
,
"-dtype"
,
"fp16"
,
"-dtype"
,
"fp16"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
]
]
extra_flags
=
extra_flags
+
self
.
_extra_flags
extra_flags
=
extra_flags
+
self
.
_extra_flags
...
@@ -213,7 +213,7 @@ class KerasImagenetTest(tf.test.TestCase):
...
@@ -213,7 +213,7 @@ class KerasImagenetTest(tf.test.TestCase):
"-num_gpus"
,
"2"
,
"-num_gpus"
,
"2"
,
"-dtype"
,
"fp16"
,
"-dtype"
,
"fp16"
,
"-enable_xla"
,
"true"
,
"-enable_xla"
,
"true"
,
"-distribution_strategy"
,
"
default
"
,
"-distribution_strategy"
,
"
mirrored
"
,
]
]
extra_flags
=
extra_flags
+
self
.
_extra_flags
extra_flags
=
extra_flags
+
self
.
_extra_flags
...
...
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