-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
54 lines (41 loc) · 1.32 KB
/
Copy pathmain.py
File metadata and controls
54 lines (41 loc) · 1.32 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
#!/usr/bin/env python3
"""Unified launcher for A4VL benchmark entry scripts."""
from __future__ import annotations
import argparse
import sys
from utils.runner import available_targets, launch_target
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Run one A4VL benchmark script (or all of them) from a single entry point."
)
parser.add_argument(
"target",
nargs="?",
help="Benchmark target: nextqa | ego | mlvu | all",
)
parser.add_argument(
"--list",
action="store_true",
help="List available targets and exit.",
)
parser.add_argument(
"script_args",
nargs=argparse.REMAINDER,
help="Arguments forwarded to the underlying script. Use '--' before forwarded args.",
)
return parser.parse_args()
def main() -> int:
args = parse_args()
if args.list:
for name in available_targets():
print(name)
return 0
if not args.target:
print("Missing target. Use --list to see choices.", file=sys.stderr)
return 2
script_args = args.script_args
if script_args and script_args[0] == "--":
script_args = script_args[1:]
return launch_target(args.target, script_args)
if __name__ == "__main__":
raise SystemExit(main())