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
5ad0c9e8
Commit
5ad0c9e8
authored
Jan 15, 2021
by
Frederick Liu
Committed by
A. Unique TensorFlower
Jan 15, 2021
Browse files
Internal change
PiperOrigin-RevId: 352011767
parent
413d3f7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
official/nlp/tasks/translation.py
official/nlp/tasks/translation.py
+2
-2
No files found.
official/nlp/tasks/translation.py
View file @
5ad0c9e8
...
@@ -28,8 +28,8 @@ from official.core import config_definitions as cfg
...
@@ -28,8 +28,8 @@ from official.core import config_definitions as cfg
from
official.core
import
task_factory
from
official.core
import
task_factory
from
official.modeling.hyperparams
import
base_config
from
official.modeling.hyperparams
import
base_config
from
official.nlp.data
import
data_loader_factory
from
official.nlp.data
import
data_loader_factory
from
official.nlp.metrics
import
bleu
from
official.nlp.modeling
import
models
from
official.nlp.modeling
import
models
from
official.nlp.transformer
import
compute_bleu
def
_pad_tensors_to_same_length
(
x
,
y
):
def
_pad_tensors_to_same_length
(
x
,
y
):
...
@@ -364,6 +364,6 @@ class TranslationTask(base_task.Task):
...
@@ -364,6 +364,6 @@ class TranslationTask(base_task.Task):
src
,
translation
,
self
.
_references
[
u_id
])
src
,
translation
,
self
.
_references
[
u_id
])
sacrebleu_score
=
sacrebleu
.
corpus_bleu
(
sacrebleu_score
=
sacrebleu
.
corpus_bleu
(
translations
,
[
self
.
_references
]).
score
translations
,
[
self
.
_references
]).
score
bleu_score
=
compute_
bleu
.
bleu_on_list
(
self
.
_references
,
translations
)
bleu_score
=
bleu
.
bleu_on_list
(
self
.
_references
,
translations
)
return
{
"sacrebleu_score"
:
sacrebleu_score
,
return
{
"sacrebleu_score"
:
sacrebleu_score
,
"bleu_score"
:
bleu_score
}
"bleu_score"
:
bleu_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