File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from logger import get_logger
1111from parse_config import ConfigParser
1212from mains import train , train_mp , test
13- from utils import msg_box , consuming_time
13+ from utils import msg_box , consuming_time , get_by_path
1414
1515
1616if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -36,11 +36,11 @@ while getopts "abc" flag; do
3636 RUN_ID=${VERSION}
3737
3838 # use optuna to find the best h.p.
39- # python3 mains/main.py --optuna --mp -c "configs/$CONFIG.json" --mode train \
40- # --run_id $RUN_ID --name $EXP
41- # python3 mains/main.py -c "saved/$EXP/$RUN_ID/best_hp/${CONFIG##*/}.json" --mode test \
42- # --resume "saved/$EXP/$RUN_ID/best_hp/fold_0_model_best.pth" --run_id $RUN_ID --k_fold 1 --bootstrapping
43- # exit
39+ python3 mains/main.py --optuna --mp -c " configs/$CONFIG .json" --mode train \
40+ --run_id $RUN_ID --name $EXP
41+ python3 mains/main.py -c " saved/$EXP /$RUN_ID /best_hp/${CONFIG##*/ } .json" --mode test \
42+ --resume " saved/$EXP /$RUN_ID /best_hp/fold_0_model_best.pth" --run_id $RUN_ID --k_fold 1 --bootstrapping
43+ exit
4444
4545 # given h.p. with k_fold = 1
4646 python3 mains/main.py -c " configs/$CONFIG .json" --mode train \
Original file line number Diff line number Diff line change 11from logger import get_logger
22from mains import train , train_mp
33from parse_config import ConfigParser
4- from utils import msg_box , consuming_time
4+ from utils import msg_box , consuming_time , get_by_path
55
66objective_results = []
77
@@ -17,7 +17,8 @@ def objective(trial):
1717 }
1818 config = ConfigParser (modification )
1919 logger = get_logger ("optuna" )
20- max_min , mnt_metric = config ["trainer" ]["kwargs" ]["monitor" ].split ()
20+ keys = ["trainers" , "trainer" , "kwargs" , "monitor" ]
21+ max_min , mnt_metric = get_by_path (config , keys ).split ()
2122 k_fold = config ["cross_validation" ]["k_fold" ]
2223 msg = msg_box ("Optuna progress" )
2324 i , N = len (objective_results ), config ["optuna" ]["n_trials" ]
You can’t perform that action at this time.
0 commit comments