Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Doc: Coding challenge: Ignore *.pyc; apply patches (#719)

Kilian Lieretb7d191dfe812
diff --git a/docs/usage/coding_challenges.md b/docs/usage/coding_challenges.md
index f5814cd7..877c4181 100644
--- a/docs/usage/coding_challenges.md
+++ b/docs/usage/coding_challenges.md
@@ -28,6 +28,7 @@ Here, we can simply create an empty folder (outside of the SWE-agent repository)
mkdir empty
git init
touch main.py
+echo "*.pyc" > .gitignore # to avoid binary files in patches
```
and potentially populate it with the problem stub
@@ -59,7 +60,8 @@ python run.py \
--repo_path /path/to/empty \
--config_file config/coding_challenge.yaml \
--model gpt4 \
- --per_instance_cost_limit 3.0
+ --per_instance_cost_limit 3.0 \
+ --apply_patch_locally
```
<details>
@@ -147,6 +149,9 @@ index 1e7f08f..beabaa7 100644
```
</details>
+Because of the `--apply_patch_locally` flag, the patch has also already been applied to the repository,
+so you can also retrieve the final solution from there.
+
### Improving SWE-agent for coding challenges
By default, the demonstration trajectory the agent uses while solving a coding challenge is one in which it needs to solve a small bug in a short piece of code (from the HumanEvalFix dataset). Since that process is not too similar to solving a coding challenge, performance would probably substantially improve if the agent was given a demonstration trajectory in which it has to solve an actual programming challenge. To learn how to do that, read [this](../config/demonstrations.md).