diff --git a/.gitignore b/.gitignore index 922116d12..9350e0616 100644 --- a/.gitignore +++ b/.gitignore @@ -188,3 +188,4 @@ cov.xml *-structure.json *.dot .python-version +/data/inference diff --git a/data/load_dataset.py b/swe_bench/data/load_dataset.py similarity index 95% rename from data/load_dataset.py rename to swe_bench/data/load_dataset.py index ed871ffab..12f55da5a 100644 --- a/data/load_dataset.py +++ b/swe_bench/data/load_dataset.py @@ -6,7 +6,7 @@ import numpy as np from datasets import load_dataset, load_from_disk -from data.inference.const import SCIKIT_LEARN_IDS +from swe_bench.inference.const import SCIKIT_LEARN_IDS def load_oracle_dataset(dataset_name_or_path: str = "", split: str = "test", existing_ids: list = []): diff --git a/data/inference/const.py b/swe_bench/inference/const.py similarity index 97% rename from data/inference/const.py rename to swe_bench/inference/const.py index 69a274310..84c5b0726 100644 --- a/data/inference/const.py +++ b/swe_bench/inference/const.py @@ -7,7 +7,7 @@ SUBSET_DATASET = METAGPT_ROOT / "sub_swebench_dataset" / "sub_swebench.csv" SUBSET_DATASET_SKLERARN = METAGPT_ROOT / "sub_swebench_dataset" / "scikit-learn-68.csv" -TESTBED = DATA_PATH / "repos" +TESTBED = METAGPT_ROOT / "swe-bench" / "data" / "repos" # SCIKIT_LEARN_IDS: A list of instance identifiers from 'sub_swebench.csv' within SUBSET_DATASET. # This collection represents a subset specifically related to scikit-learn content. diff --git a/swe_bench/inference/run_api.py b/swe_bench/inference/run_api.py index 5fc71f516..2ffe87c5b 100644 --- a/swe_bench/inference/run_api.py +++ b/swe_bench/inference/run_api.py @@ -2,7 +2,7 @@ from pathlib import Path import fire -from data.load_dataset import load_oracle_dataset + from tqdm.auto import tqdm from metagpt.config2 import config @@ -10,6 +10,7 @@ from metagpt.utils import count_string_tokens from swe_bench.inference.run_agent import run_instance from swe_bench.utils.utils import check_existing_ids, extract_diff +from swe_bench.data.load_dataset import load_oracle_dataset # Replace with your own MAX_TOKEN = 128000 @@ -56,7 +57,7 @@ async def openai_inference( logger.info(f"{repo_prefix}_{version}") data.append(f"{repo_prefix}_{version}") - response = await run_instance(instance=datum) + response = await run_instance(instance=datum, use_reflection=use_reflection) if response is None: continue logger.info(f"Final response: {response}") diff --git a/swe_bench/make_datasets/make_dataset.py b/swe_bench/make_datasets/make_dataset.py index ee4fc8c41..c5df53b1d 100644 --- a/swe_bench/make_datasets/make_dataset.py +++ b/swe_bench/make_datasets/make_dataset.py @@ -6,11 +6,11 @@ from tqdm.auto import tqdm -from data.inference.const import TESTBED from metagpt.logs import logger from swe_bench.make_datasets.make_instance import prompt_style_2_edits_only from swe_bench.utils.parse_diff import filter_changed_line from swe_bench.utils.repo_utils import EnvManager +from swe_bench.inference.const import TESTBED def reset_task_env(instance: dict = {}):