-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensemble #732
Merged
Merged
Ensemble #732
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b6ce2b1
WIP: Ensemble. Dummy DecoderState that wraps real DecoderStates
Waino 7578f1b
WIP: Ensemble: Dummy Encoder that delegates to real Encoders
Waino 41923d2
WIP: Ensemble: EnsembleDistribution.forward
Waino a806513
WIP: Ensemble
Waino a473c77
Ensemble translation
Waino 0c80608
Wrong enc_hidden and memory_lengths passed to RNN decoder in ensemble.
Waino 023564d
.
da03 4537383
Merge branch 'master' into ensemble
Waino cab5b62
Merge branch 'master' into ensemble
Waino d9fc84e
refactoring
Waino 5efc2de
flake8
Waino f988f2f
removed FIXME
Waino 270ada6
removed print
Waino 0e02fae
make ensemble_translate.py redundant. Fix translation_server.
Waino 4a6a9cd
Merge branch 'master' into ensemble
Waino c087dc6
Change action='append' to nargs='+'
Waino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python | ||
from __future__ import division, unicode_literals | ||
import argparse | ||
|
||
from onmt.translate.Translator import make_translator | ||
|
||
import onmt.io | ||
import onmt.translate | ||
import onmt | ||
import onmt.ModelConstructor | ||
import onmt.modules | ||
import onmt.opts | ||
|
||
|
||
def main(opt): | ||
translator = make_translator(opt, report_score=True, use_ensemble=True) | ||
translator.translate(opt.src_dir, opt.src, opt.tgt, | ||
opt.batch_size, opt.attn_debug) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
description='ensemble_translate.py', | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
onmt.opts.add_md_help_argument(parser) | ||
onmt.opts.translate_opts(parser, use_ensemble=True) | ||
|
||
opt = parser.parse_args() | ||
main(opt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this #FIXME Repaired?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least for now, the only value of
model_opt
that is accessed after this point iscopy_attn
.It is not possible to ensemble models using copy attention with those not using it.
A check could be added, but in that case checks should be added also for other incompatible configurations, which is too many.
I'm considering this FIXME resolved for now.