-
Notifications
You must be signed in to change notification settings - Fork 0
/
depp_distance.py
56 lines (44 loc) · 1.66 KB
/
depp_distance.py
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
#!/home/y5jiang/miniconda3/envs/depp_env/bin/python
import os
import Model_pl
import Model_recon
import utils
import default_config
from omegaconf import OmegaConf
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
def main():
args_base = OmegaConf.create(default_config.default_config)
args_cli = OmegaConf.from_cli()
# if args_cli.config_file is not None:
# args_cfg = OmegaConf.load(args_cli.config_file)
# args_base = OmegaConf.merge(args_base, args_cfg)
# args_base.exp_name = os.path.splitext(os.path.basename(args_cli.config_file))[0]
# elif args_cli.exp_name is None:
# raise ValueError('exp_name cannot be empty without specifying a config file')
# del args_cli['config_file']
args = OmegaConf.merge(args_base, args_cli)
if args.recon_model_path:
if not os.path.isfile(args.recon_model_path):
print(f"{args.recon_model_path} not exist.")
recon_model = None
else:
recon_model = Model_recon.model.load_from_checkpoint(args.recon_model_path)
recon_model.is_training=False
else:
recon_model = None
if args.model_path:
if not os.path.isfile(args.model_path):
print(f"{args.model_path} not exist.")
model = None
else:
model = Model_pl.model.load_from_checkpoint(args.model_path)
else:
model = None
if model is None and recon_model is None:
print('No model exist. exit...')
return
# utils.save_depp_dist(model=model, args=args, recon_model=recon_model)
utils.save_depp_dist(model=model, args=args)
if __name__ == '__main__':
main()