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]
Compatibility with SWE-bench 2.0 (#671)
Kilian Lieretb3e4c218436f
diff --git a/docs/usage/benchmarking.md b/docs/usage/benchmarking.mdindex 70074cdf..405abe24 100644--- a/docs/usage/benchmarking.md+++ b/docs/usage/benchmarking.md@@ -28,89 +28,22 @@ You can change that by supplying the `--split` argument to the above commands (o## π§ͺ Evaluation <a name="evaluation"></a>-The `evaluation/` folder provides SWE-agent compatible scripts for running [SWE-bench style evaluation](https://github.com/princeton-nlp/SWE-bench/) on model patch predictions. In addition, we also include additional scripts to quantify model performance on "subtasks" within the SWE-bench task, such as identifying the right file(s) to edit.+!!! note "Previous `evaluation/` scripts"-### π Quick Start <a name="quick"></a>-You can run evaluations on SWE-bench by passing in the predictions generated by SWE-agent (usually named `all_preds.jsonl`). Simply run the following script:+ We have removed the scripts that were previously in the `evaluation/` subfolder.+ They were relatively thin wrappers around `swe-bench`. After the `swe-bench` 2.0 update, we recommend to use `swe-bench` directly.-```bash-./run_eval.sh <path to predictions>-```--The `<predictions_path>` arguments should look like--```-../trajectories/<username>/<model>-<dataset>-<hyperparams>/all_preds.jsonl-```+You can directly run SWE-bench to evaluate the SWE-agent results.-Depending on the number of task instances and how long setting up the execution environment takes, the evaluation could take a couple minutes or to 7 hours for the entirety of the SWE-bench test split.+After installing SWE-bench, you can run `run_evaluation` as such:-When evaluation finishes, you should see an output similar to the following:```bash-2024-03-31 16:47:00,263 - taskenv_context_manager - INFO - [pvlib__pvlib-python__0.8] [pvlib__pvlib-python-1395] Installing with command: . /n/fs/p-swe-bench/testbed/ba397fe0d6/pvlib__pvlib-python/0.8/tmpom22t9na/miniconda3/bin/activate pvlib__pvlib-python__0.8 && echo 'activate successful' && pip install -e .[all]-2024-03-31 16:47:10,602 - taskenv_context_manager - INFO - [pvlib__pvlib-python__0.8] [pvlib__pvlib-python-1395] Installation successful-2024-03-31 16:47:10,619 - taskenv_context_manager - INFO - [pvlib__pvlib-python__0.8] [pvlib__pvlib-python-1395] Apply patch successful (test)-2024-03-31 16:47:10,635 - taskenv_context_manager - INFO - [pvlib__pvlib-python__0.8] [pvlib__pvlib-python-1395] Apply patch successful (pred)-2024-03-31 16:47:13,453 - taskenv_context_manager - INFO - [pvlib__pvlib-python__0.8] [pvlib__pvlib-python-1395] Test script run successful-==================================-Log directory for evaluation run: /n/fs/p-swe-bench/results/gpt-4-1106-preview__swe-bench-dev-40-seed24__default_sys-env_window100-detailed_cmd_format-full_history-1_demos__t-0.20__p-0.95__c-4.00__install-1__sweep-01-run-4-== Evaluation Report ==-{'# Not Generated': 1, '# Generated': 36, '# Applied': 34, '# Resolved': 5}-- Wrote per-instance scorecards to /<path to SWE-agent>/trajectories/carlosejimenez/gpt-4-1106-preview__swe-bench-dev-40-seed24__default_sys-env_window100-detailed_cmd_format-full_history-1_demos__t-0.20__p-0.95__c-4.00__install-1__sweep-01-run-4/scorecards.json-- Wrote summary of run to /<path to SWE-agent>/trajectories/carlosejimenez/gpt-4-1106-preview__swe-bench-dev-40-seed24__default_sys-env_window100-detailed_cmd_format-full_history-1_demos__t-0.20__p-0.95__c-4.00__install-1__sweep-01-run-4/results.json-Reference Report:-{'# Not Generated': 1, '# Generated': 36, '# Applied': 34, '# Resolved': 5}-```--### πͺ SWE-bench Evaluation <a name="eval"></a>--`evaluation.py`: This script contains the logic for SWE-bench evaluation adapted for the SWE-agent setting. Given a set of predictions (e.g. `trajectories/<user>/<experiment>/all_preds.jsonl`), we...--1. Filter + analyze predictions.-2. Run SWE-bench style execution based evaluation.-3. Save outcomes to `results.json` and `scorecards.json` files with info about task-specific and overall performance.--!!! tip "Examples"- `run_eval.sh` (see above) is provided as an example of how to run `evaluation.py`--Arguments:--* `--predictions_path (required)`: The path to the file containing predictions (.jsonl format). This file includes the predictions that need to be evaluated against the benchmark tasks.-* `--log_dir (required)`: The directory path where log files related to the evaluation process will be stored. It's used for saving logs that are generated during the evaluation.-* `--swe_bench_tasks (required)`: The path to the file containing the SWE-bench task instances. This file includes the details of the tasks against which the predictions will be evaluated.-* `--testbed (required)`: The directory path for the testbed, which is likely used for setting up the environment or context for the evaluations.-* `--skip_existing (optional)`: If specified, the script will skip over log files that already exist, preventing re-evaluation of those tasks.-* `--timeout (optional)`: Specifies the timeout in seconds for the evaluation process (default is 900 seconds). This helps in controlling the duration of each evaluation task to avoid excessively long running times.-* `--verbose (optional)`: Enables verbose mode, which will provide more detailed output during the script execution. This is useful for debugging or getting more insight into the process.-* `--conda_link (optional)`: Allows specifying a URL to a Conda installation that should be used for the evaluation environment. This can be necessary if the evaluation requires a specific software environment.-* `--log_suffix (optional)`: An additional parameter to specify a suffix for log files. This can be used for organizing logs more effectively, especially when running multiple evaluations in parallel or under different configurations.--### π Viewing Results <a name="viewer"></a>--`aggregate_results.py`: This script aggregates and displays experiment results from the `trajectories/` folder.--* Experiments are grouped by `(Model, Dataset, Config File, Temp., Top P, Cost, Install)`.-* The following statistics for each experiment run are shown:- * `Not Generated`: # of task instances with no patch generated- * `Generated`: # of task instances with patch- * `Applied`: # of patches that applied successfully- * `Resolved`: # of task instances resolved- * `Costs [Success|Failed|Overall]`: Cost of [successful|failed|any] run-* If there are multiple runs of an experiment (distinguished by `--suffix run<i>`), the above statistics are aggregate as totals or means.--Usage:-+python -m swebench.harness.run_evaluation \+ --predictions_path /path/to/all_preds.jsonl \+ --max_workers 1+ --run_id test```-python aggregate_results.py-```--Arguments:-* `--folder (type: str, default: ../trajectories)`: Specifies the folder containing the experiment * results. This is where the script will look to gather data.-* `--model (type: str, nargs: '+')`: Filters the results by model(s). Only results corresponding to the * specified model(s) will be included.-* `--dataset (type: str, nargs: '+')`: Filters the results by dataset(s). Only results for the specified * dataset(s) will be analyzed.-* `--setup (type: str, nargs: '+')`: Filters the results by setup(s). This allows focusing on specific * experiment configurations.-* `--runs_min (type: int)`: The minimum number of runs an experiment should have to be included in the * analysis. Helps exclude experiments with insufficient data.-* `--runs_max (type: int)`: The maximum number of runs to consider for each experiment. This can limit the data to the most relevant runs.+Head over to [SWE-bench](https://github.com/princeton-nlp/SWE-bench/) for details.-{% include-markdown "../_footer.md" %}+{% include-markdown "../_footer.md" %}\ No newline at end of filediff --git a/evaluation/README.md b/evaluation/README.mddeleted file mode 100644index 28ed6683..00000000--- a/evaluation/README.md+++ /dev/null@@ -1,6 +0,0 @@-π For more information on the trajectory inspector, visit [our documentation website][docs].--You can also find the corresponding markdown files in the [`docs/` folder][source].--[docs]: https://princeton-nlp.github.io/SWE-agent/usage/benchmarking/-[source]: https://github.com/princeton-nlp/SWE-agent/tree/main/docsdiff --git a/evaluation/aggregate_results.py b/evaluation/aggregate_results.pydeleted file mode 100644index 5fc20fb4..00000000--- a/evaluation/aggregate_results.py+++ /dev/null@@ -1,222 +0,0 @@-from __future__ import annotations--import argparse-import glob-import json-import os-import warnings--import numpy as np-import pandas as pd--warnings.filterwarnings("ignore")--from pathlib import Path--from rich import print--COLUMNS = [- "Model",- "Dataset",- "Setup",- "Temp.",- "Top P",- "Cost",- "Install",- "Run",- "Not Generated",- "Generated",- "Applied",- "Resolved",- "Resolved IDs",- "Costs Success",- "Costs Failure",- "Costs Overall",-]---def get_folders(path):- return [entry for entry in Path(path).iterdir() if entry.is_dir()]---def parse_folder_name(folder_name):- """- Parse the folder name to get the different parts- """- parsed_folder = folder_name.split("__")- if len(parsed_folder) == 7:- parsed_folder.append("")- return parsed_folder---def convert_experiments_to_rows(folder_name, runs_max):- """- Convert each experiment to a row in the csv- """- rows = []- directories = get_folders(folder_name)- for directory in directories:- folders = get_folders(directory)- for folder in folders:- # Skip debug folders- if "debug" in folder.name:- continue-- # Skip fine tuned models- if "ft_gpt-3.5" in folder.name:- continue-- # Skip folders without a results.json file- json_file = folder / "results.json"- if not json_file.exists():- # print(f"No json file in {folder}")- continue-- # Extract run attributes- folder_data = parse_folder_name(folder.name)- model = folder_data[0]- dataset = folder_data[1]- if dataset.startswith("swe-bench-dev-easy-"):- dataset = dataset[len("swe-bench-dev-easy-") :]- elif dataset.startswith("swe-bench-dev-"):- dataset = dataset[len("swe-bench-dev-") :]- setup = folder_data[2]- if len(folder_data) != 8:- # TODO: This might be too strict?- continue- temperature = float(folder_data[3][len("t-") :].strip())- top_p = float(folder_data[4][len("p-") :].strip())- cost = float(folder_data[5][len("c-") :].strip())- install = "Y" if folder_data[6].strip() == "install-1" else "N"-- # Parse out run number- run = folder_data[-1]- if "run" not in run:- continue-- try:- if "run-" in run:- run = int(run.split("run-")[-1].split("-")[0].replace("_", "").strip())- else:- run = int(run.split("run")[-1].split("-")[0].replace("_", "").strip())- except Exception as e:- print(run)- raise e-- if runs_max is not None and run > runs_max:- continue-- # Load results.json file- with json_file.open() as file:- results_data = json.load(file)- report = results_data.get("report", {})-- # Extract resolved ids (to calculate pass@k)- resolved_ids = []- if "resolved" in results_data and isinstance(results_data["resolved"], list):- resolved_ids = results_data["resolved"]- elif "counts" in results_data and isinstance(results_data["counts"]["resolved"], list):- resolved_ids = results_data["counts"]["resolved"]-- # Extract instance costs from trajectories- costs_overall = []- costs_success = []- costs_failure = []- for x in glob.glob(os.path.join(str(folder), "*.traj")):- with open(x) as file:- traj_data = json.load(file)- if "model_stats" not in traj_data["info"]:- continue- run_cost = traj_data["info"]["model_stats"]["instance_cost"]- inst_id = x.split("/")[-1].split(".")[0]- costs_overall.append(run_cost)- if inst_id in resolved_ids:- costs_success.append(run_cost)- else:- costs_failure.append(run_cost)-- # Create run row, write to csv- rows.append(- [- model,- dataset,- setup,- temperature,- top_p,- cost,- install,- run,- report.get("# Not Generated", 0),- report.get("# Generated", 0),- report.get("# Applied", 0),- report.get("# Resolved", 0),- resolved_ids,- costs_success,- costs_failure,- costs_overall,- ],- )-- return rows---def get_results_df(folder_name, runs_max):- rows = convert_experiments_to_rows(folder_name, runs_max)- return pd.DataFrame(rows, columns=COLUMNS).sort_values(by=COLUMNS[:8])---def get_results_csv(folder_name):- get_results_df(folder_name).to_csv("results.csv")- print("Experiment results written to results.csv")---if __name__ == "__main__":- parser = argparse.ArgumentParser(description="Aggregate results from experiments")- parser.add_argument("--folder", type=str, help="Folder containing experiment results", default="../trajectories")- parser.add_argument("--model", nargs="+", type=str, help="Model(s) to filter results by.")- parser.add_argument("--dataset", nargs="+", type=str, help="Dataset to filter results by.")- parser.add_argument("--setup", nargs="+", type=str, help="Setup to filter results by.")- parser.add_argument("--runs_min", type=int, help="Minimum number of runs that experiment should have been run for.")- parser.add_argument("--runs_max", type=int, help="Maximum number of runs taken into account")- args = parser.parse_args()-- df = get_results_df(args.folder, args.runs_max)-- grouped_data = (- df.groupby(COLUMNS[:7])- .agg(- {- "Run": "count", # Count the number of runs- "Not Generated": "mean",- "Generated": "mean",- "Applied": "mean",- "Resolved": "mean",- "Resolved IDs": lambda x: len({item for sublist in x for item in sublist}),- "Costs Success": lambda x: np.mean([item for sublist in x for item in sublist]),- "Costs Failure": lambda x: np.mean([item for sublist in x for item in sublist]),- "Costs Overall": lambda x: np.mean([item for sublist in x for item in sublist]),- },- )- .round(2)- .reset_index()- .rename(columns={"Resolved IDs": "Pass@K", "Run": "Runs"})- )-- # Filtering- if args.model:- grouped_data = grouped_data[grouped_data["Model"].isin(args.model)]- if args.dataset:- grouped_data = grouped_data[grouped_data["Dataset"].isin(args.dataset)]- if args.setup:- grouped_data = grouped_data[grouped_data["Setup"].isin(args.setup)]- if args.runs_min:- grouped_data = grouped_data[grouped_data["Run"] >= args.runs_min]-- print(f"Total experiments run: {grouped_data.shape[0]}")- grouped_data_sorted = grouped_data.sort_values(by=["Dataset", "Resolved"], ascending=[True, False])- pd.set_option("display.max_rows", None)- grouped = grouped_data_sorted.groupby("Dataset")-- for name, group in grouped:- print(f"\n-----------------\nDataset: {name}\n-----------------")- print(group.to_string(index=False))diff --git a/evaluation/evaluation.py b/evaluation/evaluation.pydeleted file mode 100644index cb52d6a5..00000000--- a/evaluation/evaluation.py+++ /dev/null@@ -1,223 +0,0 @@-from __future__ import annotations--import argparse-import json-import os-import traceback-from collections import Counter-from pathlib import Path--from rich import print-from swebench import (- KEY_INSTANCE_ID,- KEY_MODEL,- KEY_PREDICTION,- get_eval_refs,- get_eval_report,- get_logs_eval,- get_model_report,- get_resolution_status,- run_evaluation,-)-from swebench.harness.constants import (- INSTALL_FAIL,-)-from unidiff import PatchSet---def main(- predictions_path,- log_dir,- swe_bench_tasks,- testbed,- skip_existing,- timeout,- verbose,- conda_link,- log_suffix,- num_processes,-):- # Check if paths exist- if not os.path.exists(predictions_path):- msg = f"Predictions path {predictions_path} does not exist"- raise FileNotFoundError(msg)- eval_refs = get_eval_refs(swe_bench_tasks)- for k, v in eval_refs.items():- eval_refs[k] = {key: v[key] for key in [KEY_INSTANCE_ID, "FAIL_TO_PASS", "PASS_TO_PASS"]}-- # Change model_name_or_patch field to directory name for all predictions- directory = os.path.dirname(predictions_path)- directory_name = directory.rsplit("/", 1)[-1]- pred_path_orig = predictions_path- pred_path_temp = predictions_path.replace(".jsonl", "_filtered.jsonl")-- pred_total, pred_will_eval = 0, 0- with open(pred_path_temp, "w") as f:- for l in Path(pred_path_orig).read_text().splitlines(keepends=True):- pred_total += 1- p = json.loads(l)- # Exclude predictions w/ empty strings- if p[KEY_PREDICTION] is not None and p[KEY_PREDICTION].strip() != "":- p[KEY_MODEL] = directory_name- json.dump(p, f)- f.write("\n")- pred_will_eval += 1- print(- f"Found {pred_total} total predictions, will evaluate {pred_will_eval} ({pred_total-pred_will_eval} are empty)",- )-- # Run evaluation- predictions_path = pred_path_temp- try:- print("π Beginning evaluation...")- run_evaluation(- predictions_path=predictions_path,- log_dir=log_dir,- swe_bench_tasks=swe_bench_tasks,- testbed=testbed,- skip_existing=skip_existing,- timeout=timeout,- verbose=verbose,- conda_link=conda_link,- log_suffix=log_suffix,- num_processes=num_processes,- )- print("β Finished evaluation")- except Exception as e:- print(f"β Evaluation failed: {e}\n{traceback.format_exc()}")- print("==================================")- os.remove(pred_path_temp)-- # Get predictions, define log_dir- predictions = [json.loads(l) for l in Path(pred_path_orig).read_text().splitlines()]- log_dir = os.path.join(log_dir, directory_name)- print(f"Log directory for evaluation run: {log_dir}")-- # Iterate through predictions- scorecards = []- for p in predictions:- scorecard = {KEY_INSTANCE_ID: p[KEY_INSTANCE_ID], "statuses": [], "stats": {}}-- # Add trajectory statistics if traj_path exists- traj_path = os.path.join(directory, f"{p[KEY_INSTANCE_ID]}.traj")- if os.path.exists(traj_path):- with open(traj_path) as f:- traj_data = json.load(f)- scorecard["stats"]["traj_num_steps"] = len(traj_data["trajectory"])- scorecard["stats"]["traj_action_dist"] = dict(- Counter(- [- entry["action"].strip().split()[0]- if entry["role"] == "assistant" and "action" in entry and len(entry["action"]) > 0- else None- for entry in traj_data["history"]- ],- ),- )- scorecard["exit_status"] = traj_data["info"]["exit_status"] if "exit_status" in traj_data["info"] else "n/a"-- # Check that a prediction was generated- if p[KEY_PREDICTION] is None or p[KEY_PREDICTION].strip() == "":- scorecard["statuses"].append("not_generated")- scorecards.append(scorecard)- continue- scorecard["statuses"].append("generated")-- # Get log file- log_path = os.path.join(log_dir, f"{p[KEY_INSTANCE_ID]}.{directory_name}.eval.log")- if not os.path.exists(log_path):- scorecard["statuses"].append("build_failure")- scorecards.append(scorecard)- continue-- # Get evaluation logs- eval_sm, found = get_logs_eval(log_path)-- # Check that the prediction generated- if not found:- scorecards.append(scorecard)- continue- scorecard["statuses"].append("applied")-- with open(log_path) as f:- log_contents = f.read()- if INSTALL_FAIL in log_contents:- scorecard["statuses"].append("install_fail")-- # Get resolution status- report = get_eval_report(eval_sm, eval_refs[p[KEY_INSTANCE_ID]])- scorecard["test_results"] = {- "failure": {- "FAIL_TO_PASS": report["FAIL_TO_PASS"]["failure"],- "PASS_TO_PASS": report["PASS_TO_PASS"]["failure"],- },- "success": {- "FAIL_TO_PASS": report["FAIL_TO_PASS"]["success"],- "PASS_TO_PASS": report["PASS_TO_PASS"]["success"],- },- }- resolution_status = get_resolution_status(report)- scorecard["statuses"].append(resolution_status)-- try:- diff_obj = PatchSet(p[KEY_PREDICTION])- scorecard["patch_files"] = [- x.path for x in diff_obj.modified_files + diff_obj.added_files + diff_obj.removed_files- ]- scorecard["patch_lines_add"] = sum(f.added for f in diff_obj)- scorecard["patch_lines_del"] = sum(f.removed for f in diff_obj)- except Exception as e:- print(f"[{p[KEY_INSTANCE_ID]}] Error parsing prediction diff: {e}")- scorecard["patch_files"] = []- scorecard["patch_lines_add"] = 0- scorecard["patch_lines_del"] = 0- scorecards.append(scorecard)-- # Save to summary, scorecard json- path_scorecards = os.path.join(directory, "scorecards.json")- with open(path_scorecards, "w") as f:- json.dump(scorecards, fp=f, indent=2)- print(f"- Wrote per-instance scorecards to {path_scorecards}")-- # Get results and write to file- print("Reference Report:")- report = get_model_report(directory_name, pred_path_orig, swe_bench_tasks, log_dir)- for k, v in report.items():- print(f"- {k}: {len(v)}")-- path_results = os.path.join(directory, "results.json")- with open(path_results, "w") as f:- json.dump(report, f, indent=2)- print(f"- Wrote summary of run to {path_results}")---if __name__ == "__main__":- # Parse arguments- parser = argparse.ArgumentParser()- parser.add_argument(- "--predictions_path",- type=str,- help="Path to predictions file (.jsonl)",- required=True,- )- parser.add_argument("--log_dir", type=str, help="Path to log directory", required=True)- parser.add_argument(- "--swe_bench_tasks",- type=str,- help="Path to SWE-bench task instances file",- required=True,- )- parser.add_argument("--testbed", type=str, help="Path to testbed directory", required=True)- parser.add_argument("--skip_existing", action="store_true", help="(Optional) Skip existing logs")- parser.add_argument(- "--timeout",- type=int,- help="(Optional) Timeout in seconds (default: 900)",- default=900,- )- parser.add_argument("--verbose", action="store_true", help="(Optional) Verbose mode")- parser.add_argument("--conda_link", default=None, type=str, help="(Optional) URL to conda installation to use")- parser.add_argument("--log_suffix", default=None, type=str, help="(Optional) Log suffix")- parser.add_argument("--num_processes", default=-1, type=int, help="Num processes")- args = parser.parse_args()- main(**vars(args))diff --git a/evaluation/run_eval.sh b/evaluation/run_eval.shdeleted file mode 100755index c22c1094..00000000--- a/evaluation/run_eval.sh+++ /dev/null@@ -1,36 +0,0 @@-#!/bin/bash--# The first positional argument-predictions_path=$1--# Check if predictions_path is not provided-if [ -z "$predictions_path" ]; then- echo "Usage: $0 <predictions_path> [dataset_name_or_path] [results_dir] [testbed_dir]"- exit 1-fi--# Default values for the optional arguments-dataset_name_or_path="${2:-princeton-nlp/SWE-bench}"-results_dir="${3:-results}"-testbed_dir="${4:-testbed}"--# If results or testbed directories do not exist, create them-if [ ! -d "$results_dir" ]; then- mkdir -p "$results_dir"- echo "Created results directory at $results_dir"-fi--if [ ! -d "$testbed_dir" ]; then- mkdir -p "$testbed_dir"- echo "Created testbed directory at $testbed_dir"-fi--# Run the Python script with the specified arguments-python evaluation.py \- --predictions_path "$predictions_path" \- --swe_bench_tasks "$dataset_name_or_path" \- --log_dir "$results_dir" \- --testbed "$testbed_dir" \- --skip_existing \- --timeout 900 \- --verbosediff --git a/requirements.txt b/requirements.txtindex da52573f..93e97280 100644--- a/requirements.txt+++ b/requirements.txt@@ -8,7 +8,7 @@ openai>=1.0pandasrichruamel.yaml-swebench>=1.0.1,<2.0.0+swebench>=2.0.0tenacityunidiffsimple-parsingdiff --git a/run.py b/run.pyindex df2c05cb..29a1b64e 100644--- a/run.py+++ b/run.py@@ -38,7 +38,7 @@ from rich.markdown import Markdownfrom simple_parsing import parsefrom simple_parsing.helpers.flatten import FlattenedAccessfrom simple_parsing.helpers.serialization.serializable import FrozenSerializable-from swebench import KEY_INSTANCE_ID, KEY_MODEL, KEY_PREDICTION+from swebench.harness.constants import KEY_INSTANCE_ID, KEY_MODEL, KEY_PREDICTIONfrom unidiff import PatchSetfrom sweagent.agent.agents import Agent, AgentArgumentsdiff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.pyindex 0fbed9f7..01810a86 100644--- a/sweagent/environment/swe_env.py+++ b/sweagent/environment/swe_env.py@@ -20,7 +20,8 @@ import yamlfrom ghapi.all import GhApifrom git import Repofrom simple_parsing.helpers.serialization.serializable import FrozenSerializable-from swebench import MAP_VERSION_TO_INSTALL, get_environment_yml, get_requirements+from swebench.harness.constants import MAP_REPO_VERSION_TO_SPECS+from swebench.harness.utils import get_environment_yml, get_requirementsimport dockerimport docker.errors@@ -892,7 +893,7 @@ class SWEEnv(gym.Env):raise ValueError(msg)else:try:- return MAP_VERSION_TO_INSTALL[self.record["repo"]][str(self.record["version"])]+ return MAP_REPO_VERSION_TO_SPECS[self.record["repo"]][str(self.record["version"])]except KeyError as e:msg = ("Tried to look up install configs in swe-bench, but failed. "