-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheval_multires.py
More file actions
80 lines (62 loc) · 2.2 KB
/
eval_multires.py
File metadata and controls
80 lines (62 loc) · 2.2 KB
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
#Copyright (c) 2021-2022 Megvii Inc. All rights reserved.
# modified by Bomps4 (luca.bompani5@unibo.it) Copyright (C) 2023-2024 University of Bologna, Italy.
import argparse
import os
import random
import torch
import warnings
from loguru import logger
from Testing_library.utils.launch import launch
from Testing_library.utils.env import *
from parser_general_options import set_parser_option
from Testing_library.Experiments.exp_getter import get_exp
import datetime
from Testing_library.utils.logger import setup_logger
@logger.catch
def main(exp, args):
if exp.seed is not None:
random.seed(exp.seed)
torch.manual_seed(exp.seed)
#cudnn.deterministic = True
warnings.warn(
"You have chosen to seed training. This will turn on the CUDNN deterministic setting, "
"which can slow down your training considerably! You may see unexpected behavior "
"when restarting from checkpoints."
)
if(args.devices*args.num_machines>1):
# set environment variables for distributed training
configure_nccl()
configure_omp()
trainer = exp.get_trainer(args,val=True)
if __name__ == "__main__":
configure_module()
parser = argparse.ArgumentParser("EVAL Parser")
parser=set_parser_option(parser)
args = parser.parse_args()
exp = get_exp(args.exp_file, args.name)
exp.merge(args.opts)
if not args.experiment_name:
args.experiment_name = exp.exp_name
#os.chdir('CNN_Training/')
print()
new_dir='Testing_library/Evaluator_outputs/'+str(exp.exp_name)+'_'+str(datetime.datetime.now())+'/'
os.mkdir(new_dir)
exp.saving_dir=new_dir
setup_logger(
new_dir,
distributed_rank=0,
filename=new_dir+"train_log.txt",
mode="a",
)
num_gpu = get_num_devices() if args.devices is None else args.devices
assert num_gpu <= get_num_devices()
dist_url = "auto" if args.dist_url is None else args.dist_url
launch(
main,
num_gpu,
args.num_machines,
args.machine_rank,
backend=args.dist_backend,
dist_url=dist_url,
args=(exp, args),
)