Skip to content

Commit

Permalink
Merge pull request #169 from princeton-nlp/handle-empty-patches
Browse files Browse the repository at this point in the history
Handle failures because of None/empty patches
  • Loading branch information
john-b-yang authored Jul 3, 2024
2 parents 4498af9 + b27bbfd commit e92d105
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 e92d105

Please sign in to comment.