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
c1468202
Commit
c1468202
authored
Apr 22, 2020
by
Tayo Oguntebi
Committed by
A. Unique TensorFlower
Apr 22, 2020
Browse files
Internal change
PiperOrigin-RevId: 307918408
parent
22f10c60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
official/nlp/transformer/misc.py
official/nlp/transformer/misc.py
+4
-8
official/nlp/transformer/transformer_main.py
official/nlp/transformer/transformer_main.py
+2
-1
No files found.
official/nlp/transformer/misc.py
View file @
c1468202
...
...
@@ -261,18 +261,15 @@ def get_callbacks(steps_per_epoch):
return
callbacks
def
build
_stats
(
history
,
callbacks
):
"""Normalizes and
return
s dictionary of stats.
def
update
_stats
(
history
,
stats
,
callbacks
):
"""Normalizes and
update
s dictionary of stats.
Args:
history: Results of the training step.
stats: Dict with pre-existing training stats.
callbacks: a list of callbacks which might include a time history callback
used during keras.fit.
Returns:
Dictionary of normalized results.
"""
stats
=
{}
if
history
and
history
.
history
:
train_hist
=
history
.
history
...
...
@@ -280,7 +277,7 @@ def build_stats(history, callbacks):
stats
[
'loss'
]
=
float
(
train_hist
[
'loss'
][
-
1
])
if
not
callbacks
:
return
stats
return
# Look for the time history callback which was used during keras.fit
for
callback
in
callbacks
:
...
...
@@ -293,4 +290,3 @@ def build_stats(history, callbacks):
callback
.
batch_size
*
callback
.
log_steps
*
(
len
(
callback
.
timestamp_log
)
-
1
)
/
(
timestamp_log
[
-
1
].
timestamp
-
timestamp_log
[
0
].
timestamp
))
return
stats
official/nlp/transformer/transformer_main.py
View file @
c1468202
...
...
@@ -363,7 +363,8 @@ class TransformerTask(object):
stats
=
({
"loss"
:
train_loss
}
if
history
is
None
else
misc
.
build_stats
(
history
,
callbacks
))
}
if
history
is
None
else
{})
misc
.
update_stats
(
history
,
stats
,
callbacks
)
if
uncased_score
and
cased_score
:
stats
[
"bleu_uncased"
]
=
uncased_score
stats
[
"bleu_cased"
]
=
cased_score
...
...
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