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
49aeab2d
Unverified
Commit
49aeab2d
authored
Mar 07, 2018
by
Myle Ott
Committed by
GitHub
Mar 07, 2018
Browse files
Enforce upper-bound on maximum generation length (#121)
parent
cbaf59d4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
fairseq/sequence_generator.py
fairseq/sequence_generator.py
+1
-0
No files found.
fairseq/sequence_generator.py
View file @
49aeab2d
...
...
@@ -37,6 +37,7 @@ class SequenceGenerator(object):
self
.
beam_size
=
beam_size
self
.
minlen
=
minlen
max_decoder_len
=
min
([
m
.
max_decoder_positions
()
for
m
in
self
.
models
])
max_decoder_len
-=
1
# we define maxlen not including the EOS marker
self
.
maxlen
=
max_decoder_len
if
maxlen
is
None
else
min
(
maxlen
,
max_decoder_len
)
self
.
stop_early
=
stop_early
self
.
normalize_scores
=
normalize_scores
...
...
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