-
Notifications
You must be signed in to change notification settings - Fork 0
/
online_change_task_pretrain.sh
95 lines (91 loc) · 2.75 KB
/
online_change_task_pretrain.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
#!/usr/bin/bash
expand_str=`date +"%Y%m%d%H%M%S"`
test_arg=""
algorithms=""
dataset="halfcheetah"
qualities='medium'
n_critics="2"
first_n_steps=1000000
n_buffer=0
gpu=0
#ARGS=`getopt -o tc --long test,copy_optim -n 'online_change_task.sh' -- "$@"`
ARGS=`getopt -o +tg --long test,algorithms:,qualities:,dataset:,first_n_steps:,n_buffer:,n_critics:,gpu: -n "$0" -- "$@"`
if [ $? != 0 ]; then
echo "Terminating..."
exit 1
fi
eval set -- "${ARGS}"
while true; do
case "$1" in
-t|--test)
expand_str="test";
test_arg="--test";
shift
;;
--algorithms)
algorithms=$2;
shift 2
;;
--dataset)
dataset=$2;
shift 2
;;
--qualities)
qualities=$2;
shift 2
;;
--first_n_steps)
first_n_steps=$2;
shift 2
;;
--n_buffer)
n_buffer=$2;
shift 2
;;
--n_critics)
n_critics=$2;
shift 2
;;
-g|--gpu)
gpu=$2;
shift 2
;;
--)
shift
break
;;
*)
echo $1
echo "Internal error!";
exit 1
;;
esac
done
#must_args="n_buffer"
#for must_arg_str in $must_args; do
# must_arg=`eval echo '$'$must_arg_str`
# if [ $must_arg -eq 0 ]; then
# echo "$must_arg_str must be set!"
# exit 1
# fi
#done
algorithms_offline=( "iql" "iqln" "cql" "cal" "td3_plus_bc" )
echo "${algorithms_offline[@]}" | grep -wq ${algorithms}
if [[ $? == 0 ]]; then
output_file_name=logs/online_change_task_${dataset}_${qualities}_${algorithms}_${n_critics}_${first_n_steps}.${expand_str}.log
must_arg_strs=( "algorithms" "dataset" "qualities" )
else
output_file_name=logs/online_change_task_${dataset}_${algorithms}_${n_critics}_${first_n_steps}_${n_buffer}.${expand_str}.log
must_arg_strs=( "algorithms" "dataset" "n_buffer" )
fi
for must_arg_str in ${must_arg_strs[@]}; do
must_arg=`eval echo '$'$must_arg_strs`
if [[ $must_arg == '' ]]; then
echo "$must_arg_str must be set!"
exit 1
fi
done
echo $output_file_name
echo "python online_change_task.py --dataset ${dataset} --algorithms=${algorithms} --n_critics=${n_critics} --qualities=${qualities} --first_n_steps ${first_n_steps} --n_buffer ${n_buffer} ${test_arg}" > ${output_file_name}
echo "" >> ${output_file_name}
python online_change_task_pretrain.py --dataset ${dataset} --algorithms ${algorithms} --n_critics=${n_critics} --qualities ${qualities} --first_n_steps ${first_n_steps} --n_buffer ${n_buffer} --gpu ${gpu} ${test_arg} | tee ${output_file_name}