Function
_run_predictions
(
*,
spec: AgentSpec,
swebench_repo: Path,
swebench_python: str,
dataset_local: Path,
split: str,
prompt_field: str,
instance_ids: list[str] | None,
output_path: Path,
request_timeout: int,
max_patch_retries: int,
patch_retry_backoff: float,
trace_dir: Path | None = None,
workers: int = 1,
)
Source from the content-addressed store, hash-verified
| 525 | |
| 526 | |
| 527 | def _run_predictions( |
| 528 | *, |
| 529 | spec: AgentSpec, |
| 530 | swebench_repo: Path, |
| 531 | swebench_python: str, |
| 532 | dataset_local: Path, |
| 533 | split: str, |
| 534 | prompt_field: str, |
| 535 | instance_ids: list[str] | None, |
| 536 | output_path: Path, |
| 537 | request_timeout: int, |
| 538 | max_patch_retries: int, |
| 539 | patch_retry_backoff: float, |
| 540 | trace_dir: Path | None = None, |
| 541 | workers: int = 1, |
| 542 | ) -> None: |
| 543 | cmd = [ |
| 544 | swebench_python, |
| 545 | "scripts/run_custom_api.py", |
| 546 | "--api_url", |
| 547 | f"http://127.0.0.1:{spec.port}/generate", |
| 548 | "--dataset_name_or_path", |
| 549 | str(dataset_local), |
| 550 | "--split", |
| 551 | split, |
| 552 | "--prompt_field", |
| 553 | prompt_field, |
| 554 | "--model_name_or_path", |
| 555 | f"{spec.name}-local", |
| 556 | "--output_file", |
| 557 | str(output_path), |
| 558 | "--timeout", |
| 559 | str(request_timeout), |
| 560 | "--append", |
| 561 | "--max_patch_retries", |
| 562 | str(max_patch_retries), |
| 563 | "--patch_retry_backoff_seconds", |
| 564 | str(patch_retry_backoff), |
| 565 | "--extra_payload", |
| 566 | json.dumps(spec.extra_payload), |
| 567 | "--workers", |
| 568 | str(workers), |
| 569 | ] |
| 570 | if instance_ids: |
| 571 | cmd.extend(["--instance_ids", ",".join(instance_ids)]) |
| 572 | if trace_dir is not None: |
| 573 | cmd.extend(["--trace_dir", str(trace_dir)]) |
| 574 | |
| 575 | _info(f" predictions: {spec.name} → {output_path}") |
| 576 | subprocess.run(cmd, cwd=str(swebench_repo), check=True) # noqa: S603 |
| 577 | |
| 578 | |
| 579 | def _run_harness( |
Tested by
no test coverage detected