DerHansVader commited on
Commit
f90de37
·
verified ·
1 Parent(s): 0ecbbd2

Add default inference system prompt

Browse files
Files changed (1) hide show
  1. pointerbench-pro/eval.py +19 -1
pointerbench-pro/eval.py CHANGED
@@ -14,6 +14,7 @@ Accepted point keys: "point" / "pred" / "coordinate", or flat "x" and "y".
14
  Coordinates are absolute pixels on the 1024x768 image.
15
 
16
  Usage:
 
17
  python eval.py --predictions preds.jsonl
18
  python eval.py --predictions preds.jsonl --json report.json
19
  """
@@ -30,6 +31,15 @@ GT_PATH = ROOT / "data" / "test" / "metadata.jsonl"
30
 
31
  AXES = ("element_type", "app_category", "platform", "app")
32
 
 
 
 
 
 
 
 
 
 
33
 
34
  def _load_jsonl(path: Path) -> list[dict]:
35
  text = path.read_text(encoding="utf-8").strip()
@@ -111,7 +121,9 @@ def _print(report: dict) -> None:
111
  def main() -> None:
112
  ap = argparse.ArgumentParser(description=__doc__,
113
  formatter_class=argparse.RawDescriptionHelpFormatter)
114
- ap.add_argument("--predictions", required=True, type=Path,
 
 
115
  help="JSONL/JSON predictions: {id, point:[x,y]} per example")
116
  ap.add_argument("--gt", type=Path, default=GT_PATH,
117
  help=f"ground-truth metadata (default: {GT_PATH})")
@@ -119,6 +131,12 @@ def main() -> None:
119
  help="also write the full report to this JSON path")
120
  args = ap.parse_args()
121
 
 
 
 
 
 
 
122
  gt = _load_jsonl(args.gt)
123
  preds = {r["id"]: r for r in _load_jsonl(args.predictions) if "id" in r}
124
  report = evaluate(gt, preds)
 
14
  Coordinates are absolute pixels on the 1024x768 image.
15
 
16
  Usage:
17
+ python eval.py --show-system-prompt
18
  python eval.py --predictions preds.jsonl
19
  python eval.py --predictions preds.jsonl --json report.json
20
  """
 
31
 
32
  AXES = ("element_type", "app_category", "platform", "app")
33
 
34
+ DEFAULT_SYSTEM_PROMPT = (
35
+ "You are evaluating Pointerbench, a GUI grounding benchmark. "
36
+ "You will receive one 1024x768 screenshot and one task instruction. "
37
+ "Use absolute pixel coordinates with origin at the top-left of the image. "
38
+ "Do not return normalized coordinates. Do not crop or resize the coordinate frame. "
39
+ "For point tasks, return JSON like {\"point\": [x, y]}. "
40
+ "For bounding-box tasks, return JSON like {\"bbox\": [x0, y0, x1, y1]}."
41
+ )
42
+
43
 
44
  def _load_jsonl(path: Path) -> list[dict]:
45
  text = path.read_text(encoding="utf-8").strip()
 
121
  def main() -> None:
122
  ap = argparse.ArgumentParser(description=__doc__,
123
  formatter_class=argparse.RawDescriptionHelpFormatter)
124
+ ap.add_argument("--show-system-prompt", action="store_true",
125
+ help="print the recommended inference system prompt and exit")
126
+ ap.add_argument("--predictions", type=Path,
127
  help="JSONL/JSON predictions: {id, point:[x,y]} per example")
128
  ap.add_argument("--gt", type=Path, default=GT_PATH,
129
  help=f"ground-truth metadata (default: {GT_PATH})")
 
131
  help="also write the full report to this JSON path")
132
  args = ap.parse_args()
133
 
134
+ if args.show_system_prompt:
135
+ print(DEFAULT_SYSTEM_PROMPT)
136
+ return
137
+ if args.predictions is None:
138
+ ap.error("--predictions is required unless --show-system-prompt is used")
139
+
140
  gt = _load_jsonl(args.gt)
141
  preds = {r["id"]: r for r in _load_jsonl(args.predictions) if "id" in r}
142
  report = evaluate(gt, preds)