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: Document keywords of run.py (#443)
Kilian Lieret7032986cb4b1
diff --git a/run.py b/run.pyindex 22622428..6fc1f601 100644--- a/run.py+++ b/run.py@@ -57,6 +57,8 @@ python run.py --model_name "gpt4" --data_path "https://github.com/pvlib/pvlib-py# Apply a patch in a local repository to an issue specified as Markdown file and run a custom installer script in the containerpython run.py --model_name "gpt4" --data_path "/path/to/my_issue.md" --repo_path "/path/to/my/local/repo" --environment_setup "/path/to/setup.sh" --config_file "config/default_from_url.yaml" --apply_patch_locally```++**For more information**: https://princeton-nlp.github.io/SWE-agent/usage/cl_tutorial/"""handler = RichHandler(show_time=False, show_path=False)@@ -96,8 +98,11 @@ class ScriptArguments(FlattenedAccess, FrozenSerializable):environment: EnvironmentArgumentsagent: AgentArgumentsactions: ActionsArguments- instance_filter: str = ".*" # Only run instances that completely match this regex- skip_existing: bool = True # Skip instances with existing trajectories+ # Only run instances that completely match this regex+ instance_filter: str = ".*"+ # Skip instances with existing trajectories+ skip_existing: bool = True+ # Suffix for the run name (used for example in trajectory directory naming)suffix: str = ""# Raise unhandled exceptions during the run (useful for debugging)raise_exceptions: bool = Falsediff --git a/sweagent/agent/models.py b/sweagent/agent/models.pyindex fd67c500..61c8637d 100644--- a/sweagent/agent/models.py+++ b/sweagent/agent/models.py@@ -32,12 +32,19 @@ logger.propagate = Falseclass ModelArguments(FrozenSerializable):"""Arguments configuring the model and its behavior."""+ # Name of the model to usemodel_name: str+ # Cost limit for every instance (task)per_instance_cost_limit: float = 0.0+ # Total cost limittotal_cost_limit: float = 0.0+ # Sampling temperaturetemperature: float = 1.0+ # Sampling top-ptop_p: float = 1.0+ # Path to replay file when using the replay modelreplay_path: str = None+ # Host URL when using Ollama modelhost_url: str = "localhost:11434"diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.pyindex c87564b2..1f72c7c1 100644--- a/sweagent/environment/swe_env.py+++ b/sweagent/environment/swe_env.py@@ -59,16 +59,27 @@ class EnvironmentArguments(FrozenSerializable):# (`json`, `jsonl`) or directory. To run over single issue: github issue url or path to markdown file# with problem statement or problem statement as text prefixed with `text://`.data_path: str- image_name: str+ # Name of the docker image to use for the environment. Defaults to sweagent/swe-agent:latest+ image_name: str = "sweagent/swe-agent:latest"+ # When running over SWE-bench issues: Specify the split to use.split: str = "dev"# Specify a branch name or a commit hash to checkout before running the task.# Only used when running over a single problem statement/issue.base_commit: str | None = None+ # Use a persistent container with this namecontainer_name: str | None = None+ # Try to install the environment before running the task.install_environment: bool = True- timeout: int = 35+ # No effect, kept for backwards compatibility.+ timeout: int | None = None+ # Enable environment logger.verbose: bool = False+ # Do not use attempt to use a repository mirror from https://github.com/swe-bench.no_mirror: bool = False+ # Cache task images to speed up task initialization. This means that the environment will be saved as a+ # docker image for every repository and base commit combination. This uses quite a bit of disk space+ # but speeds up task initialization significantly when running over multiple issues from the same repository+ # (or using different models for the same issues).cache_task_images: bool = False# Custom environment setup. Currently only used when data_path points to a single issue.# This needs to be either a string pointing to a yaml file (with yaml, yml file extension)@@ -78,6 +89,10 @@ class EnvironmentArguments(FrozenSerializable):# Only used when running on single issue. Path to local repository or github repository.repo_path: str = ""+ def __post_init__(self):+ if self.timeout is not None:+ logger.warning("The 'timeout' argument is deprecated and has no effect.")+class EnvHook:def on_init(self): ...@@ -137,8 +152,6 @@ class SWEEnv(gym.Env):self.image_name = args.image_nameself._reset_container()- # Set timeout- self.timeout = self.args.timeoutself.idx = 0self.clean_multi_line_functions = lambda x: xself.hooks = []