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
80a6318b
Commit
80a6318b
authored
Aug 06, 2020
by
A. Unique TensorFlower
Browse files
Internal change
PiperOrigin-RevId: 325352935
parent
b9785623
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
official/nlp/bert/model_training_utils.py
official/nlp/bert/model_training_utils.py
+9
-3
No files found.
official/nlp/bert/model_training_utils.py
View file @
80a6318b
...
...
@@ -524,13 +524,14 @@ def run_customized_training_loop(
_save_checkpoint
(
strategy
,
checkpoint
,
model_dir
,
checkpoint_name
.
format
(
step
=
current_step
))
if
eval_input_fn
:
logging
.
info
(
'Running evaluation after step: %s.'
,
current_step
)
logs
=
_run_evaluation
(
current_step
,
_get_input_iterator
(
eval_input_fn
,
strategy
))
# Re-initialize evaluation metric.
eval_loss_metric
.
reset_states
()
for
metric
in
eval_metrics
+
model
.
metrics
:
metric
.
reset_states
()
logging
.
info
(
'Running evaluation after step: %s.'
,
current_step
)
logs
=
_run_evaluation
(
current_step
,
_get_input_iterator
(
eval_input_fn
,
strategy
))
# We add train_loss here rather than call on_batch_end twice to make
# sure that no duplicated values are generated.
logs
[
'loss'
]
=
train_loss
...
...
@@ -548,6 +549,11 @@ def run_customized_training_loop(
_save_checkpoint
(
strategy
,
checkpoint
,
model_dir
,
checkpoint_name
.
format
(
step
=
current_step
))
if
eval_input_fn
:
# Re-initialize evaluation metric.
eval_loss_metric
.
reset_states
()
for
metric
in
eval_metrics
+
model
.
metrics
:
metric
.
reset_states
()
logging
.
info
(
'Running final evaluation after training is complete.'
)
logs
=
_run_evaluation
(
current_step
,
_get_input_iterator
(
eval_input_fn
,
strategy
))
...
...
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