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
154e8c46
Commit
154e8c46
authored
Sep 03, 2019
by
David Chen
Committed by
A. Unique TensorFlower
Sep 03, 2019
Browse files
Internal change
PiperOrigin-RevId: 267063328
parent
b903049a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
official/staging/shakespeare/shakespeare_benchmark.py
official/staging/shakespeare/shakespeare_benchmark.py
+7
-1
official/staging/shakespeare/shakespeare_main.py
official/staging/shakespeare/shakespeare_main.py
+1
-1
No files found.
official/staging/shakespeare/shakespeare_benchmark.py
View file @
154e8c46
...
@@ -21,6 +21,7 @@ import os
...
@@ -21,6 +21,7 @@ import os
import
time
import
time
from
absl
import
flags
from
absl
import
flags
import
tensorflow
as
tf
# pylint: disable=g-bad-import-order
from
official.staging.shakespeare
import
shakespeare_main
from
official.staging.shakespeare
import
shakespeare_main
from
official.utils.flags
import
core
as
flags_core
from
official.utils.flags
import
core
as
flags_core
...
@@ -28,6 +29,7 @@ from official.utils.misc import keras_utils
...
@@ -28,6 +29,7 @@ from official.utils.misc import keras_utils
from
official.utils.testing.perfzero_benchmark
import
PerfZeroBenchmark
from
official.utils.testing.perfzero_benchmark
import
PerfZeroBenchmark
SHAKESPEARE_TRAIN_DATA
=
'shakespeare/shakespeare.txt'
SHAKESPEARE_TRAIN_DATA
=
'shakespeare/shakespeare.txt'
TMP_DIR
=
os
.
getenv
(
'TMPDIR'
)
FLAGS
=
flags
.
FLAGS
FLAGS
=
flags
.
FLAGS
...
@@ -212,7 +214,7 @@ class ShakespeareAccuracy(ShakespeareBenchmarkBase):
...
@@ -212,7 +214,7 @@ class ShakespeareAccuracy(ShakespeareBenchmarkBase):
class
ShakespeareKerasBenchmarkReal
(
ShakespeareBenchmarkBase
):
class
ShakespeareKerasBenchmarkReal
(
ShakespeareBenchmarkBase
):
"""Benchmark accuracy tests."""
"""Benchmark accuracy tests."""
def
__init__
(
self
,
output_dir
=
None
,
root_data_dir
=
None
,
**
kwargs
):
def
__init__
(
self
,
output_dir
=
None
,
root_data_dir
=
TMP_DIR
,
**
kwargs
):
"""Benchmark tests w/Keras.
"""Benchmark tests w/Keras.
Args:
Args:
...
@@ -369,3 +371,7 @@ class ShakespeareKerasBenchmarkReal(ShakespeareBenchmarkBase):
...
@@ -369,3 +371,7 @@ class ShakespeareKerasBenchmarkReal(ShakespeareBenchmarkBase):
"""Run and report benchmark."""
"""Run and report benchmark."""
super
(
ShakespeareKerasBenchmarkReal
,
self
).
_run_and_report_benchmark
(
super
(
ShakespeareKerasBenchmarkReal
,
self
).
_run_and_report_benchmark
(
top_1_train_min
=
None
,
log_steps
=
FLAGS
.
log_steps
)
top_1_train_min
=
None
,
log_steps
=
FLAGS
.
log_steps
)
if
__name__
==
'__main__'
:
tf
.
test
.
main
()
official/staging/shakespeare/shakespeare_main.py
View file @
154e8c46
...
@@ -94,7 +94,7 @@ def get_dataset(path_to_file, batch_size=None, seq_length=SEQ_LENGTH):
...
@@ -94,7 +94,7 @@ def get_dataset(path_to_file, batch_size=None, seq_length=SEQ_LENGTH):
A tuple, consisting of the Dataset and the class to character mapping
A tuple, consisting of the Dataset and the class to character mapping
and character to class mapping.
and character to class mapping.
"""
"""
with
open
(
path_to_file
,
'rb'
)
as
train_data
:
with
tf
.
io
.
gfile
.
GFile
(
path_to_file
,
'rb'
)
as
train_data
:
text
=
train_data
.
read
().
decode
(
encoding
=
'utf-8'
)
text
=
train_data
.
read
().
decode
(
encoding
=
'utf-8'
)
# Create vocab
# Create vocab
...
...
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