File size: 1,348 Bytes
d9c5371
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# file: run_train.sh
#
# This is a simple driver script that runs training and then decoding
# on the training set and the val set.
#
# To run this script, execute the following line:
#
#  run_train.sh train.dat val.dat
#
# The first argument ($1) is the training data. The last two arguments,
# test data ($2) and evaluation data ($3) are optional.
#
# An example of how to run this is as follows:
#
# xzt: echo $PWD
# /home/xzt/SOGMP
# xzt: sh run_train.sh ~/semantic2d_data/ ~/semantic2d_data/
#

# decode the number of command line arguments
#
NARGS=$#

if (test "$NARGS" -eq "0") then
    echo "usage: run_train.sh train.dat val.dat"
    exit 1
fi

# define a base directory for the experiment
#
DL_EXP=`pwd`;
DL_SCRIPTS="$DL_EXP/scripts";
DL_OUT="$DL_EXP/output";

# define the number of feats environment variable
#
export DL_NUM_FEATS=3

# define the output directories for training/decoding/scoring
#
#DL_TRAIN_ODIR="$DL_OUT/00_train";
DL_TRAIN_ODIR="$DL_EXP/model";
DL_MDL_PATH="$DL_TRAIN_ODIR/model.pth";

# create the output directory
#
rm -fr $DL_OUT
mkdir -p $DL_OUT

# execute training: training must always be run
#
echo "... starting training on $1 ..."
$DL_SCRIPTS/train.py $DL_MDL_PATH $1 $2 | tee $DL_OUT/00_train.log | \
      grep "reading\|Step\|Average\|Warning\|Error" 
echo "... finished training on $1 ..."

#