Skip to content

Commit d4d1013

Browse files
author
deeperlearner
committed
Fix small bugs
1 parent f422f3e commit d4d1013

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

mains/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from logger import get_logger
1111
from parse_config import ConfigParser
1212
from 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

1616
if __name__ == "__main__":

scripts/examples.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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 \

tune/objective.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from logger import get_logger
22
from mains import train, train_mp
33
from parse_config import ConfigParser
4-
from utils import msg_box, consuming_time
4+
from utils import msg_box, consuming_time, get_by_path
55

66
objective_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"]

0 commit comments

Comments
 (0)