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
8b18491b
Unverified
Commit
8b18491b
authored
Jun 05, 2019
by
guptapriya
Committed by
GitHub
Jun 05, 2019
Browse files
transformer v2: fix gfile reading
parent
bc557d14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
official/transformer/compute_bleu.py
official/transformer/compute_bleu.py
+2
-2
No files found.
official/transformer/compute_bleu.py
View file @
8b18491b
...
@@ -88,9 +88,9 @@ def bleu_tokenize(string):
...
@@ -88,9 +88,9 @@ def bleu_tokenize(string):
def
bleu_wrapper
(
ref_filename
,
hyp_filename
,
case_sensitive
=
False
):
def
bleu_wrapper
(
ref_filename
,
hyp_filename
,
case_sensitive
=
False
):
"""Compute BLEU for two files (reference and hypothesis translation)."""
"""Compute BLEU for two files (reference and hypothesis translation)."""
ref_lines
=
tokenizer
.
native_to_unicode
(
ref_lines
=
tokenizer
.
native_to_unicode
(
tf
.
gfile
.
Open
(
ref_filename
,
"r"
).
read
()).
s
plit
(
"
\n
"
)
tf
.
io
.
gfile
.
GFile
(
ref_filename
).
read
()).
s
trip
().
splitlines
(
)
hyp_lines
=
tokenizer
.
native_to_unicode
(
hyp_lines
=
tokenizer
.
native_to_unicode
(
tf
.
gfile
.
Open
(
hyp_filename
,
"r"
).
read
()).
s
plit
(
"
\n
"
)
tf
.
io
.
gfile
.
GFile
(
hyp_filename
).
read
()).
s
trip
().
splitlines
(
)
if
len
(
ref_lines
)
!=
len
(
hyp_lines
):
if
len
(
ref_lines
)
!=
len
(
hyp_lines
):
raise
ValueError
(
"Reference and translation files have different number of "
raise
ValueError
(
"Reference and translation files have different number of "
...
...
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