Commit 287104d4 authored by Arne Köhn's avatar Arne Köhn

Running jobs through ssh now works, the taggers had to be adopted a bit.

Getting the absolute path for the taggers was implemented wrongly.
This is now fixed by some magic found in the internets.
parent 4baf004c
#! /bin/sh
# usage: test [modelname] [inputfile] [outputfile]
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
cat $2 | ../hunpos/tagger.native $WORKDIR/models/$1 2>tmp-out-$1 | sed 's/\t/ /g'| sed 's/ */ /g' >$3
TAGTIME=$(grep "Tagging: " tmp-out-$1)
SETUPTIME=$(grep "Setup: " tmp-out-$1)
......
......@@ -2,6 +2,8 @@
# usage: train [trainfile] [modelname]
# where modelname is the name of this experiment
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
sed 's/ /\t/' $1 | ../hunpos/trainer.native $WORKDIR/models/$2 2>/dev/null
#! /bin/sh
# usage: test [modelname] [inputfile] [outputfile]
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
. ../svmt-config
......
#! /bin/sh
# usage: test [modelname] [inputfile] [outputfile]
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
. ../svmt-config
......
......@@ -2,7 +2,9 @@
# usage: train [trainfile] [modelname]
# where modelname is the name of this experiment
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
# with this you get $SVMDIR and $SVMTOOLDIR
......
#! /bin/sh
# usage: test [modelname] [inputfile] [outputfile]
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
. ../svmt-config
......
#! /bin/sh
# usage: test [modelname] [inputfile] [outputfile]
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
. ../svmt-config
......
......@@ -2,7 +2,9 @@
# usage: train [trainfile] [modelname]
# where modelname is the name of this experiment
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
# with this you get $SVMDIR and $SVMTOOLDIR
......
#! /bin/sh
# usage: test [modelname] [inputfile] [outputfile]
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
../tnt/tnt $WORKDIR/models/$1 $2 2>tmp-out-$1 | grep -v "^%% " | sed "s/\t/ /g"| sed "s/ */ /g" >$3
TAGTIME=$(grep "Tagging: " tmp-out-$1)
......
......@@ -2,6 +2,9 @@
# usage: train [trainfile] [modelname]
# where modelname is the name of this experiment
WORKDIR=$(pwd)/$(dirname $0)
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
WORKDIR=$(dirname $abspath)
cd $WORKDIR
../tnt/tnt-para -o$WORKDIR/models/$2 $1 2>/dev/null
\ No newline at end of file
../tnt/tnt-para -o$WORKDIR/models/$2 $1 2>/dev/null
......@@ -268,43 +268,45 @@ sub train_tagger {
my $tagger = shift;
my $tset = shift;
my $host = shift;
if ( $host eq 'local') {
# TODO: measure time of execution
my $command = "sh taggers/$tagger/train \$(pwd)/tfiles/$tset/train $tset";
print STDERR "running ",$command;
`$command`;
$job_results->enqueue({'type'=>'train','tagger'=>$tagger,'tset'=> $tset,'host'=> $host});
} else {
die "remote train not yet implemented";
# TODO: measure time of execution
my $pwd = `pwd`;
chomp $pwd;
my $command = "sh $pwd/taggers/$tagger/train $pwd/tfiles/$tset/train $tset";
if ( not ($host eq 'local')) {
$command = "ssh $host $command";
}
print STDERR "running ",$command;
`$command`;
$job_results->enqueue({'type'=>'train','tagger'=>$tagger,'tset'=> $tset,'host'=> $host});
}
sub test_tagger {
my $tagger = shift;
my $tset = shift;
my $host = shift;
if ( $host eq 'local') {
my $command = "sh taggers/$tagger/tag $tset \$(pwd)/tfiles/$tset/test \$(pwd)/tmp/$tagger-$tset";
print STDERR "running ",$command;
my $time = `$command`;
my $setuptime = -1;
my $tagtime = -1;
if ($time =~ m/SETUPTIME=(\d+)/) {
$setuptime = $1
}
if ($time =~ m/TAGTIME=(\d+)/) {
$tagtime = $1
}
$job_results->enqueue({'type'=>'test',
'tagger'=>$tagger,
'tset'=> $tset,
'host'=> $host,
'tagtime'=> $tagtime,
'setuptime'=> $setuptime,
});
} else {
die "remote train not yet implemented";
my $pwd = `pwd`;
chomp $pwd;
my $command = "sh $pwd/taggers/$tagger/tag $tset $pwd/tfiles/$tset/test $pwd/tmp/$tagger-$tset";
if ( not ($host eq 'local')) {
$command ="ssh $host $command";
}
print STDERR "running ",$command;
my $time = `$command`;
my $setuptime = -1;
my $tagtime = -1;
if ($time =~ m/SETUPTIME=(\d+)/) {
$setuptime = $1
}
if ($time =~ m/TAGTIME=(\d+)/) {
$tagtime = $1
}
$job_results->enqueue({'type'=>'test',
'tagger'=>$tagger,
'tset'=> $tset,
'host'=> $host,
'tagtime'=> $tagtime,
'setuptime'=> $setuptime,
});
}
sub get_or_restore_tset {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment