-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
53 lines (43 loc) · 1.17 KB
/
run.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
#!/bin/sh
# check number of args
if [ "$#" -ne 2 ]; then
echo "Usage: $0 mode settings_file"
echo "Modes: lm_only tsne_forward everything"
exit 1
fi
# check if mode is valid
if [ ! "$1" = "lm_only" ] && \
[ ! "$1" = "tsne_forward" ] && \
[ ! "$1" = "everything" ]; then
echo "Invalid mode."
exit 1
fi
# get project absolute path
prg=$0
if [ ! -e "$prg" ]; then
case $prg in
(*/*) exit 1;;
(*) prg=$(command -v -- "$prg") || exit;;
esac
fi
dir=$(
cd -P -- "$(dirname -- "$prg")" && pwd -P
) || exit
prg=$dir/$(basename -- "$prg") || exit
actual_dir=$(dirname $prg)
# get settings file absolute path
settings_ini="$(cd "$(dirname "$2")"; pwd)/$(basename "$2")"
# create outputs folder if doesn't exist
grep "outputs_folder" $settings_ini | awk '{print $3}' | xargs mkdir -p
# ignore first step of the program?
if [ ! "$1" = "tsne_forward" ]; then
python3 ${actual_dir}/00_lmkmeans.py ${settings_ini}
fi
# run only the first step of the program?
if [ "$1" = "lm_only" ]; then
exit 0
fi
# run everything else
python3 ${actual_dir}/01_tsne.py ${settings_ini}
python3 ${actual_dir}/02_treat_tsne.py ${settings_ini}
echo "Done!"