forked from qipeng/gcn-over-pruned-trees
-
Notifications
You must be signed in to change notification settings - Fork 0
/
train.sh
80 lines (64 loc) · 1.98 KB
/
train.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
show_help() {
cat << EOF
Usage: ${0##*/} [--ud] [--ucca] [--seq] [--emb] model-id
optional args:
--ud use UD based adjacency matrix
--ucca use UCCA based adjacency matrix
--seq use 'SEQ' based adjacency matrix
--emb use UCCA terminal-to-root embeddings
positional args:
model-id Model ID under which to save models
EOF
}
die() {
printf '%s\n' "$1" >&2
exit 1
}
# Initialize all the option variables to ensure we are not contaminated by variables from the environment.
UD=0
UCCA=0
SEQ=0
EMB=0
ID=
while :; do
case $1 in
--help)
show_help && exit
;;
--ud)
UD=1
;;
--ucca)
UCCA=1
;;
--seq)
SEQ=1
;;
--emb)
EMB=1
;;
--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
ID=$1
[ -z $ID ] && show_help && exit
ADJACENCY_OPTIONS=
((UD == 1)) && ADJACENCY_OPTIONS="--ud_heads"
((UCCA == 1)) && ADJACENCY_OPTIONS="$ADJACENCY_OPTIONS --ucca_multi_heads"
((SEQ == 1)) && ADJACENCY_OPTIONS="$ADJACENCY_OPTIONS --sequential_heads"
[ -z "$ADJACENCY_OPTIONS" ] && ADJACENCY_OPTIONS="--ud_heads" && printf 'NO adjacency options provided, using UD\n'
EMBEDDING_OPTIONS=
((EMB == 1)) && EMBEDDING_OPTIONS="--ucca_embedding_dim 80"
printf 'run train.py with arguments: '
printf '%s\n' "--id $ID $ADJACENCY_OPTIONS $EMBEDDING_OPTIONS --seed 21213 --prune_k 1 --lr 0.3 --rnn_hidden 200 --num_epoch 100 --pooling max --mlp_layers 2 --pooling_l2 0.003"
python train.py --id $ID $ADJACENCY_OPTIONS $EMBEDDING_OPTIONS --seed 21213 --prune_k 1 --lr 0.3 --rnn_hidden 200 --num_epoch 100 --pooling max --mlp_layers 2 --pooling_l2 0.003