Skip to content

Commit

Permalink
Handle failures because of None/empty patches
Browse files Browse the repository at this point in the history
  • Loading branch information
klieret committed Jul 2, 2024
1 parent 4498af9 commit b27bbfd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions swebench/harness/run_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ def run_instance(

# Copy model prediction as patch file to container
patch_file = Path(log_dir / "patch.diff")
patch_file.write_text(pred["model_patch"])
patch_file.write_text(pred["model_patch"] or "")
logger.info(
f"Intermediate patch for {instance_id} written to {patch_file}, now applying to container..."
)
copy_to_container(container, patch_file, Path("/tmp/patch.diff"))

# Attempt to apply patch to container
val = container.exec_run(
"git apply -v /tmp/patch.diff",
"git apply --allow-empty -v /tmp/patch.diff",
workdir="/testbed",
user="root",
)
Expand Down

0 comments on commit b27bbfd

Please sign in to comment.