DerHansVader commited on
Commit
1b8f552
·
verified ·
1 Parent(s): 07403b3

Add default inference system prompt

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