SWE-bench
minisweagent.run.extra.swebench
Run mini-SWE-agent on SWE-bench instances in batch mode.
app
module-attribute
app = Typer(rich_markup_mode='rich', add_completion=False)
DATASET_MAPPING
module-attribute
DATASET_MAPPING = {
"full": "princeton-nlp/SWE-Bench",
"verified": "princeton-nlp/SWE-Bench_Verified",
"lite": "princeton-nlp/SWE-Bench_Lite",
"multimodal": "princeton-nlp/SWE-Bench_Multimodal",
"multilingual": "swe-bench/SWE-Bench_Multilingual",
"smith": "SWE-bench/SWE-smith",
"_test": "klieret/swe-bench-dummy-test-dataset",
}
ProgressTrackingAgent
ProgressTrackingAgent(
*args,
progress_manager: RunBatchProgressManager,
instance_id: str = "",
**kwargs,
)
Bases: DefaultAgent
Simple wrapper around DefaultAgent that provides progress updates.
Source code in src/minisweagent/run/extra/swebench.py
56 57 58 59 |
|
progress_manager
instance-attribute
progress_manager: RunBatchProgressManager = progress_manager
instance_id
instance-attribute
instance_id = instance_id
step
step() -> dict
Override step to provide progress updates.
Source code in src/minisweagent/run/extra/swebench.py
61 62 63 64 65 66 |
|
get_swebench_docker_image_name
get_swebench_docker_image_name(instance: dict) -> str
Get the image name for a SWEBench instance.
Source code in src/minisweagent/run/extra/swebench.py
69 70 71 72 73 74 75 76 77 |
|
get_sb_environment
get_sb_environment(
config: dict, instance: dict
) -> Environment
Source code in src/minisweagent/run/extra/swebench.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
update_preds_file
update_preds_file(
output_path: Path,
instance_id: str,
model_name: str,
result: str,
)
Update the output JSON file with results from a single instance.
Source code in src/minisweagent/run/extra/swebench.py
97 98 99 100 101 102 103 104 105 106 107 108 |
|
remove_from_preds_file
remove_from_preds_file(output_path: Path, instance_id: str)
Remove an instance from the predictions file.
Source code in src/minisweagent/run/extra/swebench.py
111 112 113 114 115 116 117 118 119 |
|
process_instance
process_instance(
instance: dict,
output_dir: Path,
config: dict,
progress_manager: RunBatchProgressManager,
) -> None
Process a single SWEBench instance.
Source code in src/minisweagent/run/extra/swebench.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
filter_instances
filter_instances(
instances: list[dict],
*,
filter_spec: str,
slice_spec: str = "",
shuffle: bool = False,
) -> list[dict]
Filter and slice a list of SWEBench instances.
Source code in src/minisweagent/run/extra/swebench.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
main
main(
subset: str = Option(
"lite",
"--subset",
help="SWEBench subset to use or path to a dataset",
rich_help_panel="Data selection",
),
split: str = Option(
"dev",
"--split",
help="Dataset split",
rich_help_panel="Data selection",
),
slice_spec: str = Option(
"",
"--slice",
help="Slice specification (e.g., '0:5' for first 5 instances)",
rich_help_panel="Data selection",
),
filter_spec: str = Option(
"",
"--filter",
help="Filter instance IDs by regex",
rich_help_panel="Data selection",
),
shuffle: bool = Option(
False,
"--shuffle",
help="Shuffle instances",
rich_help_panel="Data selection",
),
output: str = Option(
"",
"-o",
"--output",
help="Output directory",
rich_help_panel="Basic",
),
workers: int = Option(
1,
"-w",
"--workers",
help="Number of worker threads for parallel processing",
rich_help_panel="Basic",
),
model: str | None = Option(
None,
"-m",
"--model",
help="Model to use",
rich_help_panel="Basic",
),
model_class: str | None = Option(
None,
"-c",
"--model-class",
help="Model class to use (e.g., 'anthropic' or 'minisweagent.models.anthropic.AnthropicModel')",
rich_help_panel="Advanced",
),
redo_existing: bool = Option(
False,
"--redo-existing",
help="Redo existing instances",
rich_help_panel="Data selection",
),
config_spec: Path = Option(
builtin_config_dir / "extra" / "swebench.yaml",
"-c",
"--config",
help="Path to a config file",
rich_help_panel="Basic",
),
environment_class: str | None = Option(
None,
"--environment-class",
help="Environment type to use. Recommended are docker or singularity",
rich_help_panel="Advanced",
),
) -> None
Source code in src/minisweagent/run/extra/swebench.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|