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
9ff8aa21
Commit
9ff8aa21
authored
Mar 13, 2020
by
Sai Ganesh Bandiatmakuri
Committed by
A. Unique TensorFlower
Mar 13, 2020
Browse files
Add ability to take TPU address and output dir from environment variables.
PiperOrigin-RevId: 300858086
parent
225eda71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
official/utils/testing/perfzero_benchmark.py
official/utils/testing/perfzero_benchmark.py
+16
-5
No files found.
official/utils/testing/perfzero_benchmark.py
View file @
9ff8aa21
...
...
@@ -48,15 +48,26 @@ class PerfZeroBenchmark(tf.test.Benchmark):
flag_methods: Set of flag methods to run during setup.
tpu: (optional) TPU name to use in a TPU benchmark.
"""
if
not
output_dir
:
output_dir
=
'/tmp'
self
.
output_dir
=
output_dir
if
os
.
getenv
(
'BENCHMARK_OUTPUT_DIR'
):
self
.
output_dir
=
os
.
getenv
(
'BENCHMARK_OUTPUT_DIR'
)
elif
output_dir
:
self
.
output_dir
=
output_dir
else
:
self
.
output_dir
=
'/tmp'
self
.
default_flags
=
default_flags
or
{}
self
.
flag_methods
=
flag_methods
or
{}
if
tpu
:
if
os
.
getenv
(
'BENCHMARK_TPU'
):
resolved_tpu
=
os
.
getenv
(
'BENCHMARK_TPU'
)
elif
tpu
:
resolved_tpu
=
tpu
else
:
resolved_tpu
=
None
if
resolved_tpu
:
# TPU models are expected to accept a --tpu=name flag. PerfZero creates
# the TPU at runtime and passes the TPU's name to this flag.
self
.
default_flags
[
'tpu'
]
=
tpu
self
.
default_flags
[
'tpu'
]
=
resolved_
tpu
def
_get_model_dir
(
self
,
folder_name
):
"""Returns directory to store info, e.g. saved model and event log."""
...
...
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