-
Notifications
You must be signed in to change notification settings - Fork 10
/
train_rnn_holmes_example.sh
executable file
·55 lines (50 loc) · 1.56 KB
/
train_rnn_holmes_example.sh
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
#!/bin/sh
# This is the path that should be edited,
# depending on where the JSON books are stored
PATH_JSON=$PWD"/../Data/GutenbergHolmes/"
# Define the minimum number of word occurrences as 5 and use existing vocabulary file
MIN_WORD_OCCURRENCE=5
DEP_LABELS=2
RNN_HIDDENS=600
RNN_CLASSES=250
NGRAM_SIZE_MB=2000
NGRAM_ORDER=3
BPTT_ORDER=5
FEATURE_GAMMA=0.5
# If we need to debug, change this to "true"
DEBUG_MODE="true"
# Automatic path generation
PATH_DATA="./books"
PATH_MODELS="./models"
LIST_VALID=$PATH_DATA"/valid.txt"
LIST_TRAIN=$PATH_DATA"/train.txt"
FILE_SENTENCE_LABELS=$PATH_DATA"/valid.labels"
FILE_VOCAB=$PATH_DATA"/vocab_mw"$MIN_WORD_OCCURRENCE".txt"
FILE_MODEL=$PATH_MODELS"/GutenbergHolmes_p"$DEP_LABELS
FILE_MODEL=$FILE_MODEL"_mw"$MIN_WORD_OCCURRENCE
FILE_MODEL=$FILE_MODEL"_h"$RNN_HIDDENS
FILE_MODEL=$FILE_MODEL"_c"$RNN_CLASSES
FILE_MODEL=$FILE_MODEL"_m"$NGRAM_SIZE_MB
FILE_MODEL=$FILE_MODEL"_d"$NGRAM_ORDER
FILE_MODEL=$FILE_MODEL"_b"$BPTT_ORDER
FILE_MODEL=$FILE_MODEL"_g"$FEATURE_GAMMA
FILE_MODEL=$FILE_MODEL".model"
echo "RNN model will be stored in $FILE_MODEL..."
# Train the dependency-parsing model
RnnDependencyTree \
-rnnlm $FILE_MODEL \
-train $LIST_TRAIN \
-valid $LIST_VALID \
-sentence-labels $FILE_SENTENCE_LABELS \
-path-json-books $PATH_JSON \
-min-word-occurrence $MIN_WORD_OCCURRENCE \
-feature-labels-type $DEP_LABELS \
-hidden $RNN_HIDDENS \
-direct $NGRAM_SIZE_MB \
-direct-order $NGRAM_ORDER \
-bptt $BPTT_ORDER \
-bptt-block 1 \
-class $RNN_CLASSES \
-feature-gamma $FEATURE_GAMMA \
-debug $DEBUG_MODE \
-vocab $FILE_VOCAB