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
6f4e596a
Commit
6f4e596a
authored
Nov 22, 2021
by
Hongkun Yu
Committed by
A. Unique TensorFlower
Nov 22, 2021
Browse files
Fix
https://github.com/tensorflow/models/issues/10383
PiperOrigin-RevId: 411678726
parent
2f936b41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
official/nlp/transformer/compute_bleu.py
official/nlp/transformer/compute_bleu.py
+3
-3
No files found.
official/nlp/transformer/compute_bleu.py
View file @
6f4e596a
...
@@ -24,6 +24,7 @@ import unicodedata
...
@@ -24,6 +24,7 @@ import unicodedata
from
absl
import
app
from
absl
import
app
from
absl
import
flags
from
absl
import
flags
from
absl
import
logging
import
six
import
six
from
six.moves
import
range
from
six.moves
import
range
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -109,11 +110,11 @@ def bleu_on_list(ref_lines, hyp_lines, case_sensitive=False):
...
@@ -109,11 +110,11 @@ def bleu_on_list(ref_lines, hyp_lines, case_sensitive=False):
def
main
(
unused_argv
):
def
main
(
unused_argv
):
if
FLAGS
.
bleu_variant
in
(
"both"
,
"uncased"
):
if
FLAGS
.
bleu_variant
in
(
"both"
,
"uncased"
):
score
=
bleu_wrapper
(
FLAGS
.
reference
,
FLAGS
.
translation
,
False
)
score
=
bleu_wrapper
(
FLAGS
.
reference
,
FLAGS
.
translation
,
False
)
tf
.
logging
.
info
(
"Case-insensitive results: %f"
%
score
)
logging
.
info
(
"Case-insensitive results: %f"
,
score
)
if
FLAGS
.
bleu_variant
in
(
"both"
,
"cased"
):
if
FLAGS
.
bleu_variant
in
(
"both"
,
"cased"
):
score
=
bleu_wrapper
(
FLAGS
.
reference
,
FLAGS
.
translation
,
True
)
score
=
bleu_wrapper
(
FLAGS
.
reference
,
FLAGS
.
translation
,
True
)
tf
.
logging
.
info
(
"Case-sensitive results: %f"
%
score
)
logging
.
info
(
"Case-sensitive results: %f"
,
score
)
def
define_compute_bleu_flags
():
def
define_compute_bleu_flags
():
...
@@ -142,7 +143,6 @@ def define_compute_bleu_flags():
...
@@ -142,7 +143,6 @@ def define_compute_bleu_flags():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
tf
.
logging
.
set_verbosity
(
tf
.
logging
.
INFO
)
define_compute_bleu_flags
()
define_compute_bleu_flags
()
FLAGS
=
flags
.
FLAGS
FLAGS
=
flags
.
FLAGS
app
.
run
(
main
)
app
.
run
(
main
)
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