Unverified Commit 49aeab2d authored by Myle Ott's avatar Myle Ott Committed by GitHub
Browse files

Enforce upper-bound on maximum generation length (#121)

parent cbaf59d4
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment