Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fairseq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simon Will
fairseq
Commits
7e86e30c
Unverified
Commit
7e86e30c
authored
7 years ago
by
Myle Ott
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow larger maxlen (fixes #100) (#101)
parent
9a951216
No related branches found
Branches containing commit
Tags
v0.3.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fairseq/sequence_generator.py
+3
-2
3 additions, 2 deletions
fairseq/sequence_generator.py
with
3 additions
and
2 deletions
fairseq/sequence_generator.py
+
3
−
2
View file @
7e86e30c
...
...
@@ -17,7 +17,7 @@ from fairseq.models import FairseqIncrementalDecoder
class
SequenceGenerator
(
object
):
def
__init__
(
self
,
models
,
beam_size
=
1
,
minlen
=
1
,
maxlen
=
200
,
def
__init__
(
self
,
models
,
beam_size
=
1
,
minlen
=
1
,
maxlen
=
None
,
stop_early
=
True
,
normalize_scores
=
True
,
len_penalty
=
1
,
unk_penalty
=
0
,
retain_dropout
=
False
):
"""
Generates translations of a given source sentence.
...
...
@@ -40,7 +40,8 @@ class SequenceGenerator(object):
self
.
vocab_size
=
len
(
models
[
0
].
dst_dict
)
self
.
beam_size
=
beam_size
self
.
minlen
=
minlen
self
.
maxlen
=
min
(
maxlen
,
*
[
m
.
max_decoder_positions
()
for
m
in
self
.
models
])
max_decoder_len
=
min
([
m
.
max_decoder_positions
()
for
m
in
self
.
models
])
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
self
.
len_penalty
=
len_penalty
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment