From ca5c0f19b792857cb6931bddde5fb3af7e117abd Mon Sep 17 00:00:00 2001 From: bhaddow Date: Wed, 7 Sep 2011 08:08:35 +0000 Subject: Multi-threading of mert, for random restarts. Fix mert tests. git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4182 1f5c12ca-751b-0410-a591-d2e778427230 --- scripts/Makefile | 4 ++-- scripts/training/mert-moses.pl | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile b/scripts/Makefile index 29a3f7265..8c749957b 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -8,8 +8,8 @@ DS?=$(shell date '+%Y%m%d') # Set TARGETDIR to directory where you want the compiled scripts to be copied # to. # Set BINDIR to the directory where GIZA++ and other tools are installed. -TARGETDIR=/opt/AO/sw/edinburgh-code/ -BINDIR=/opt/AO/sw/edinburgh-code/ +TARGETDIR=/home/bhaddow/work/moses.svn +BINDIR=/opt/statmt/moses/bin/ MAIN_SCRIPTS_TARGET_DIR=$(TARGETDIR) # MAIN_SCRIPTS_TARGET_DIR=$(shell echo `pwd`/temp) diff --git a/scripts/training/mert-moses.pl b/scripts/training/mert-moses.pl index c8c04cb90..15e1d0d00 100755 --- a/scripts/training/mert-moses.pl +++ b/scripts/training/mert-moses.pl @@ -10,6 +10,7 @@ # Excerpts from revision history +# Sept 2011 multi-threaded mert (Barry Haddow) # Jul 2011 simplifications (Ondrej Bojar) # -- rely on moses' -show-weights instead of parsing moses.ini # ... so moses is also run once *before* mert starts, checking @@ -99,6 +100,7 @@ my $___RANDOM_DIRECTIONS = 0; # search in random directions only my $___NUM_RANDOM_DIRECTIONS = 0; # number of random directions, also works with default optimizer [Cer&al.,2008] my $___PAIRWISE_RANKED_OPTIMIZER = 0; # use Hopkins&May[2011] my $___RANDOM_RESTARTS = 20; +my $__THREADS = 0; # Parameter for effective reference length when computing BLEU score # Default is to use shortest reference @@ -180,7 +182,8 @@ GetOptions( "range=s@" => \$___RANGES, "prev-aggregate-nbestlist=i" => \$prev_aggregate_nbl_size, #number of previous step to consider when loading data (default =-1, i.e. all previous) "maximum-iterations=i" => \$maximum_iterations, - "pairwise-ranked" => \$___PAIRWISE_RANKED_OPTIMIZER + "pairwise-ranked" => \$___PAIRWISE_RANKED_OPTIMIZER, + "threads=i" => \$__THREADS ) or exit(1); # the 4 required parameters can be supplied on the command line directly @@ -258,6 +261,9 @@ Options: --random-directions ... search only in random directions --number-of-random-directions=int ... number of random directions (also works with regular optimizer, default: 0) + --pairwise-ranked ... Use PRO for optimisation (Hopkins and May, emnlp 2011) + --threads=NUMBER ... Use multi-threaded mert (must be compiled in). + "; exit 1; } @@ -716,6 +722,10 @@ while(1) { $cmd = $cmd." --ifile run$run.$weights_in_file"; } + if ($__THREADS) { + $cmd = $cmd." --threads $__THREADS"; + } + if ($___PAIRWISE_RANKED_OPTIMIZER) { $cmd .= " --pro pro.data ; echo 'not used' > $weights_out_file; $pro_optimizer -fvals -maxi 30 -nobias binary pro.data"; } -- cgit v1.2.3