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
OpenDAS
Fairseq
Commits
88df72c0
Commit
88df72c0
authored
Apr 25, 2018
by
Myle Ott
Browse files
Remove src-padding from generation output
parent
8afb7761
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
fairseq/sequence_generator.py
fairseq/sequence_generator.py
+2
-2
No files found.
fairseq/sequence_generator.py
View file @
88df72c0
...
@@ -81,8 +81,8 @@ class SequenceGenerator(object):
...
@@ -81,8 +81,8 @@ class SequenceGenerator(object):
if
timer
is
not
None
:
if
timer
is
not
None
:
timer
.
stop
(
sum
(
len
(
h
[
0
][
'tokens'
])
for
h
in
hypos
))
timer
.
stop
(
sum
(
len
(
h
[
0
][
'tokens'
])
for
h
in
hypos
))
for
i
,
id
in
enumerate
(
s
[
'id'
].
data
):
for
i
,
id
in
enumerate
(
s
[
'id'
].
data
):
src
=
input
[
'src_tokens'
].
data
[
i
,
:]
# remove padding
# remove
pad
d
in
g from ref
src
=
utils
.
strip_
pad
(
in
put
[
'src_tokens'
].
data
[
i
,
:],
self
.
pad
)
ref
=
utils
.
strip_pad
(
s
[
'target'
].
data
[
i
,
:],
self
.
pad
)
if
s
[
'target'
]
is
not
None
else
None
ref
=
utils
.
strip_pad
(
s
[
'target'
].
data
[
i
,
:],
self
.
pad
)
if
s
[
'target'
]
is
not
None
else
None
yield
id
,
src
,
ref
,
hypos
[
i
]
yield
id
,
src
,
ref
,
hypos
[
i
]
...
...
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