-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen_task.sh
106 lines (98 loc) · 2.27 KB
/
gen_task.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# This script wraps to generate programs with varying parameters
FUNC=$1
DDIR='data/'
DCMD='python3 data_gen.py'
shift
SIZE=$1
TSIZE=$((SIZE / 10))
shift
ARGS='-pl 2 -cl 2 -ns 2'
eval_single() {
echo "Generating evaluation data for all tasks..."
fns=('val' 'easy' 'med' 'hard')
ns=(2 4 8 12)
for i in {0..3}; do
for j in {1..13}; do
F=$DDIR'test_'${fns[i]}'_task'$j.txt
echo Writing to $F
$DCMD -pl ${ns[i]} -cl ${ns[i]} -ns ${ns[i]} -t $j -s $SIZE > $F
done
done
}
eval_nstep() {
echo "Generating nstep evaluation data."
rm -f $DDIR'test_nstep'*.txt
for i in {1..32}; do
F=$DDIR'test_nstep'$i.txt
echo Writing to $F
$DCMD $ARGS -s $SIZE --nstep $i > $F
done
}
eval_len() {
echo "Generating increasing length data."
rm -f $DDIR'test_pl'*.txt
rm -f $DDIR'test_cl'*.txt
for i in {2..64}; do
F=$DDIR'test_pl'$i.txt
echo Writing to $F
$DCMD -s $SIZE -t 3 -pl $i -cl 2 > $F
F=$DDIR'test_cl'$i.txt
echo Writing to $F
$DCMD -s $SIZE -t 3 -pl 2 -cl $i > $F
done
}
acc() {
echo "Generating accumulating training data..."
for i in {1..5}; do
F=$DDIR'train_task1-'$i.txt
TF=$DDIR'test_task1-'$i.txt
echo Writing to $F $TF
rm -f $F $TF
for j in $(seq $i); do
$DCMD $ARGS -t $j -s $SIZE >> $F
$DCMD $ARGS -t $j -s $TSIZE >> $TF
done
done
}
iter() {
echo "Generating tasks based on iteration..."
TS[1]="1 2"
TS[2]="1 2 3 7 9 12"
TS[3]="1 2 3 4 6 7 8 9 10 11 12"
for i in {1..3}; do
F=$DDIR'train_iter'$i.txt
TF=$DDIR'test_iter'$i.txt
echo Writing to $F $TF
rm -rf $F $TF
for j in ${TS[i]}; do
$DCMD $ARGS -t $j -s $SIZE >> $F
$DCMD $ARGS -t $j -s $TSIZE >> $TF
done
done
}
all() {
echo "Generating all tasks..."
for i in {1..13}; do
F=$DDIR'train_task'$i.txt
TF=$DDIR'val_task'$i.txt
echo Writing to $F $TF
rm -f $F $TF
$DCMD $ARGS -t $i -s $SIZE >> $F
$DCMD $ARGS -t $i -s $TSIZE >> $TF
done
}
custom() {
echo "Generating certain tasks only..."
F=$DDIR'train_custom.txt'
TF=$DDIR'test_custom.txt'
echo Writing to $F $TF
rm -f $F $TF
for i in "$@"; do
echo Generating task $i
$DCMD $ARGS -t $i -s $SIZE >> $F
$DCMD $ARGS -t $i -s $TSIZE >> $TF
done
}
# Run given function
$FUNC "$@"