forked from horsedayday/DualGCN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
train_example.sh
63 lines (53 loc) · 1.72 KB
/
train_example.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
#!/bin/bash
set -ue
# epochs=20
# epochs=1
# epochs=20
epochs=200
# epochs=500
# Start timer
start_time=$(date +%s)
while true; do
nvidia-smi --query-gpu=utilization.gpu --format=csv >> gpu_logs.txt;
sleep 5;
done &
SPLIT=0
# Within-study
# All train outputs are saved in params["model_outdir"]
# SOURCE=CCLE
SOURCE=gCSI
TARGET=$SOURCE
echo "SOURCE: $SOURCE"
echo "TARGET: $TARGET"
echo "SPLIT: $SPLIT"
python dualgcn_train_improve.py \
--train_ml_data_dir ml_data/${SOURCE}-${TARGET}/split_${SPLIT} \
--val_ml_data_dir ml_data/${SOURCE}-${TARGET}/split_${SPLIT} \
--model_outdir out_model/${SOURCE}/split_${SPLIT} \
--epochs $epochs \
# --drug_path ml_data/#{SOURCE}-${TARGET}/split_${SPLIT}/drug_features \
# --omics_path ml_data/#{SOURCE}-${TARGET}/split_${SPLIT}_omics_data \
# --ppi_path ml_data/#{SOURCE}-${TARGET}/split_${SPLIT}_PPI/PPI_network_new.txt\
# --cuda_name cuda:7
echo "GPU UTILIZATION"
awk 'NR%2==0 {print}' gpu_logs.txt | tr -d " %" > gpu_log_strip.txt
awk '{s+=$1}END{print "average %:",s/NR}' gpu_log_strip.txt
awk '{if($1>0+max){max=$1}} END{print "peak %:",max}' gpu_log_strip.txt
# # Cross-study
# # All train outputs are saved in params["model_outdir"]
# SOURCE=GDSCv1
# TARGET=CCLE
# echo "SOURCE: $SOURCE"
# echo "TARGET: $TARGET"
# echo "SPLIT: $SPLIT"
# python graphdrp_train_improve.py \
# --train_ml_data_dir ml_data/${SOURCE}-${TARGET}/split_${SPLIT} \
# --val_ml_data_dir ml_data/${SOURCE}-${TARGET}/split_${SPLIT} \
# --model_outdir out_model/${SOURCE}/split_${SPLIT} \
# --cuda_name cuda:7
# # --epochs $epochs \
# End timer
end_time=$(date +%s)
# Calculate elapsed time
elapsed_time=$((end_time - start_time))
echo "Elapsed time: $elapsed_time seconds"