diff options
Diffstat (limited to 'scripts/training')
-rwxr-xr-x | scripts/training/mert-moses.pl | 3 | ||||
-rwxr-xr-x | scripts/training/reduce-factors.perl | 25 | ||||
-rwxr-xr-x | scripts/training/train-model.perl | 4 |
3 files changed, 29 insertions, 3 deletions
diff --git a/scripts/training/mert-moses.pl b/scripts/training/mert-moses.pl index 682b6fe7e..d1ac5828a 100755 --- a/scripts/training/mert-moses.pl +++ b/scripts/training/mert-moses.pl @@ -863,7 +863,8 @@ while (1) { $mira_settings .= "$batch_mira_args "; } - $mira_settings .= " --dense-init run$run.dense"; + $mira_settings .= " --dense-init run$run.$weights_in_file"; + #$mira_settings .= " --dense-init run$run.dense"; if (-e "run$run.sparse-weights") { $mira_settings .= " --sparse-init run$run.sparse-weights"; } diff --git a/scripts/training/reduce-factors.perl b/scripts/training/reduce-factors.perl index fd4906a48..c7269abf9 100755 --- a/scripts/training/reduce-factors.perl +++ b/scripts/training/reduce-factors.perl @@ -47,7 +47,9 @@ sub reduce_factors { $firstline =~ s/^\s*//; $firstline =~ s/\s.*//; # count factors - my $maxfactorindex = $firstline =~ tr/|/|/; + my @WORD = split(/ /,$firstline); + my @FACTOR = split(/$___FACTOR_DELIMITER/,$WORD[0]); + my $maxfactorindex = scalar(@FACTOR)-1; if (join(",", @INCLUDE) eq join(",", 0..$maxfactorindex)) { # create just symlink; preserving compression my $realfull = $full; @@ -107,3 +109,24 @@ sub open_or_zcat { open($hdl,$read) or die "Can't read $fn ($read)"; return $hdl; } + +sub safesystem { + print STDERR "Executing: @_\n"; + system(@_); + if ($? == -1) { + print STDERR "ERROR: Failed to execute: @_\n $!\n"; + exit(1); + } + elsif ($? & 127) { + printf STDERR "ERROR: Execution of: @_\n died with signal %d, %s coredump\n", + ($? & 127), ($? & 128) ? 'with' : 'without'; + exit(1); + } + else { + my $exitcode = $? >> 8; + print STDERR "Exit code: $exitcode\n" if $exitcode; + return ! $exitcode; + } +} + + diff --git a/scripts/training/train-model.perl b/scripts/training/train-model.perl index 5a13b6e1f..a9ed58535 100755 --- a/scripts/training/train-model.perl +++ b/scripts/training/train-model.perl @@ -755,7 +755,9 @@ sub reduce_factors { $firstline =~ s/^\s*//; $firstline =~ s/\s.*//; # count factors - my $maxfactorindex = $firstline =~ tr/$___FACTOR_DELIMITER/$___FACTOR_DELIMITER/; + my @WORD = split(/ /,$firstline); + my @FACTOR = split(/$___FACTOR_DELIMITER/,$WORD[0]); + my $maxfactorindex = scalar(@FACTOR)-1; if (join(",", @INCLUDE) eq join(",", 0..$maxfactorindex)) { # create just symlink; preserving compression my $realfull = $full; |