-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.py
75 lines (52 loc) · 1.64 KB
/
run.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python3
import argparse
from habitat.datasets import make_dataset
from VLN_CE.vlnce_baselines.config.default import get_config
from navid_agent import evaluate_agent
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"--exp-config",
type=str,
required=True,
help="path to config yaml containing info about experiment",
)
parser.add_argument(
"--split-num",
type=int,
required=True,
help="chunks of evluation"
)
parser.add_argument(
"--split-id",
type=int,
required=True,
help="chunks ID of evluation"
)
parser.add_argument(
"--model-path",
type=str,
required=True,
help="location of model weights"
)
parser.add_argument(
"--result-path",
type=str,
required=True,
help="location to save results"
)
args = parser.parse_args()
run_exp(**vars(args))
def run_exp(exp_config: str, split_num: str, split_id: str, model_path: str, result_path: str, opts=None) -> None:
"""Runs experiment given mode and config
Args:
exp_config: path to config file.
run_type: "train" or "eval.
opts: list of strings of additional config options.
"""
config = get_config(exp_config, opts)
dataset = make_dataset(id_dataset=config.TASK_CONFIG.DATASET.TYPE, config=config.TASK_CONFIG.DATASET)
dataset_split = dataset.get_splits(split_num)[split_id]
evaluate_agent(config, split_id, dataset_split, model_path, result_path)
if __name__ == "__main__":
main()