-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_study.sh
executable file
·90 lines (79 loc) · 2.59 KB
/
run_study.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
#!/bin/bash
Help()
{
# Display Help
echo "Build graphs from SMT Queries"
echo
echo "Syntax: ./build_graphs [-h|d|n]"
echo "options:"
echo "h Print this Help."
echo "d Chosen Dataset. Options are BMC, SyGuS, SymEx, or ICSE"
echo "j Parallel jobs to run when building graphs"
echo
}
PARALLEL=1
while getopts ":h:d:j:" option; do
case $option in
h) # display Help
Help
exit;;
d) # Enter a name
DATASET=$OPTARG;;
j)
PARALLEL=$OPTARG;;
\?) # Invalid option
echo "Error: Invalid option"
exit;;
esac
done
DATASETS='[ "ICSE", "BMC", "SyGuS", "SymEx" ]'
if ! [[ "$DATASETS" =~ "\"$DATASET\"" ]]; then
echo "${DATASET} is not a valid dataset."
echo "Valid datasets are: BMC, SymEx, SyGuS, or ICSE"
exit 1
fi
if command -v nvidia-smi; then
echo "You have NVIDIA Support"
echo "We can proceed with training."
else
echo "You do not have NVIDIA Support"
echo "This is a requirement to train models"
echo "Please install NVIDIA Support to train models."
echo "Alternatively, you can use of of our pretrained"
echo "model in the inferece directory"
exit 1
fi
if [ "$DATASET" = "ICSE" ]; then
echo ""
echo "=============================================="
echo " Building Graphs "
echo "=============================================="
echo ""
./build_graphs.sh -d "data/ICSE" -j $PARALLEL
echo ""
echo "=============================================="
echo " Training Network "
echo "=============================================="
echo ""
python3 src/networks/smtTrainer.py -t 2 --data data/${DATASET} --labels "data/${DATASET}_GNN_Labels.json" -e 5 --cross-valid 0
if [ $? -eq 0 ]; then
echo "Model Trained. The model file is located in the same directory this script has been run."
else
echo "Training appears to have failed"
echo "Please check error messages"
exit 1
fi
else
echo ""
echo "=============================================="
echo " Collecting Dataset "
echo "=============================================="
echo ""
./get_dataset.sh "${DATASET}-graph"
echo ""
echo "=============================================="
echo " Training Network "
echo "=============================================="
echo ""
python3 src/networks/smtTrainer.py -t 2 --data data/${DATASET} --labels "data/${DATASET}_GNN_Labels.json" -e 25 --cross-valid 0
fi