summaryrefslogtreecommitdiff
path: root/training/mira/mira.py
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-12 13:56:42 +0200
committerPatrick Simianer <p@simianer.de>2014-06-12 13:56:42 +0200
commit244971287003d079e46193b8a209c28955f90134 (patch)
tree8beaae6b12b913acb213fc7f2415fd63886192f9 /training/mira/mira.py
parent5250fd67a4b8f242068cff87f0a6a4211f8b0fcf (diff)
parentb66e838ed52decc0be1eb5817b2a77c3840db2c5 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'training/mira/mira.py')
-rwxr-xr-xtraining/mira/mira.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/training/mira/mira.py b/training/mira/mira.py
index 539a0b0e..691a62a6 100755
--- a/training/mira/mira.py
+++ b/training/mira/mira.py
@@ -203,14 +203,15 @@ def main():
if have_mpl: graph_file = graph(args.output_dir, hope_best_fear, args.metric)
dev_results, dev_bleu = evaluate(args.devset, args.weights, args.config,
- script_dir, args.output_dir)
+ script_dir, args.output_dir, args.jobs)
if args.test:
if args.test_config:
test_results, test_bleu = evaluate(args.test, args.weights,
- args.test_config, script_dir, args.output_dir)
+ args.test_config, script_dir, args.output_dir,
+ args.jobs)
else:
test_results, test_bleu = evaluate(args.test, args.weights, args.config,
- script_dir, args.output_dir)
+ script_dir, args.output_dir, args.jobs)
else:
test_results = ''
test_bleu = ''
@@ -240,11 +241,11 @@ def graph(output_dir, hope_best_fear, metric):
return graph_file
#evaluate a given test set using decode-and-evaluate.pl
-def evaluate(testset, weights, ini, script_dir, out_dir):
+def evaluate(testset, weights, ini, script_dir, out_dir, jobs):
evaluator = '{}/../utils/decode-and-evaluate.pl'.format(script_dir)
try:
p = subprocess.Popen([evaluator, '-c', ini, '-w', weights, '-i', testset,
- '-d', out_dir, '--jobs', args.jobs], stdout=subprocess.PIPE)
+ '-d', out_dir, '--jobs', str(jobs)], stdout=subprocess.PIPE)
results, err = p.communicate()
bleu, results = results.split('\n',1)
except subprocess.CalledProcessError: