-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.py
51 lines (44 loc) · 1.3 KB
/
main.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
import argparse
import os
import sys
from src.utils.initialization import (
read_config_from_yaml,
seed_everything,
set_credentials,
get_out_file,
)
from src.configs import *
from src.thread.run_thread import run_thread
from src.thread.model_eval import run_eval
from src.thread.label_eval.check_human_labels import run_eval_labels
from src.thread.generate_online_profiles import gen_style_thread
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--config_path",
type=str,
default="configs/thread/thread.yaml",
help="Path to the config file",
)
args = parser.parse_args()
cfg = read_config_from_yaml(args.config_path)
seed_everything(cfg.seed)
set_credentials(cfg)
f, path = get_out_file(cfg)
try:
print(cfg)
if cfg.task == Task.THREAD:
run_thread(cfg)
elif cfg.task == Task.GENSTYLETHREAD:
gen_style_thread(cfg)
elif cfg.task == Task.EVAL:
run_eval(cfg)
elif cfg.task == Task.EVALLabels:
run_eval_labels(cfg)
else:
raise NotImplementedError(f"Task {cfg.task} not implemented")
except ValueError as e:
sys.stderr.write(f"Error: {e}")
finally:
if cfg.store:
f.close()