From 50f4953ea7d2d9f69a17ef7c6fa11a1b8a432507 Mon Sep 17 00:00:00 2001 From: stellahsr Date: Tue, 26 Mar 2024 15:28:37 +0800 Subject: [PATCH] update path --- {swe_bench => benchmark/swe_bench}/__init__.py | 0 {swe_bench => benchmark/swe_bench}/data/load_dataset.py | 2 +- .../swe_bench/data/repos}/__init__.py | 0 {swe_bench => benchmark/swe_bench}/gitagent.py | 0 .../swe_bench/inference}/__init__.py | 0 {swe_bench => benchmark/swe_bench}/inference/const.py | 2 +- {swe_bench => benchmark/swe_bench}/inference/run.py | 0 {swe_bench => benchmark/swe_bench}/inference/run_agent.py | 6 +++--- {swe_bench => benchmark/swe_bench}/inference/run_api.py | 6 +++--- .../swe_bench/make_datasets}/__init__.py | 0 .../swe_bench}/make_datasets/make_dataset.py | 8 ++++---- .../swe_bench}/make_datasets/make_instance.py | 0 benchmark/swe_bench/utils/__init__.py | 3 +++ {swe_bench => benchmark/swe_bench}/utils/enums.py | 0 {swe_bench => benchmark/swe_bench}/utils/parse_diff.py | 3 ++- {swe_bench => benchmark/swe_bench}/utils/repo_utils.py | 0 {swe_bench => benchmark/swe_bench}/utils/utils.py | 0 17 files changed, 17 insertions(+), 13 deletions(-) rename {swe_bench => benchmark/swe_bench}/__init__.py (100%) rename {swe_bench => benchmark/swe_bench}/data/load_dataset.py (94%) rename {swe_bench/inference => benchmark/swe_bench/data/repos}/__init__.py (100%) rename {swe_bench => benchmark/swe_bench}/gitagent.py (100%) rename {swe_bench/make_datasets => benchmark/swe_bench/inference}/__init__.py (100%) rename {swe_bench => benchmark/swe_bench}/inference/const.py (96%) rename {swe_bench => benchmark/swe_bench}/inference/run.py (100%) rename {swe_bench => benchmark/swe_bench}/inference/run_agent.py (93%) rename {swe_bench => benchmark/swe_bench}/inference/run_api.py (94%) rename {swe_bench/utils => benchmark/swe_bench/make_datasets}/__init__.py (100%) rename {swe_bench => benchmark/swe_bench}/make_datasets/make_dataset.py (86%) rename {swe_bench => benchmark/swe_bench}/make_datasets/make_instance.py (100%) create mode 100644 benchmark/swe_bench/utils/__init__.py rename {swe_bench => benchmark/swe_bench}/utils/enums.py (100%) rename {swe_bench => benchmark/swe_bench}/utils/parse_diff.py (99%) rename {swe_bench => benchmark/swe_bench}/utils/repo_utils.py (100%) rename {swe_bench => benchmark/swe_bench}/utils/utils.py (100%) diff --git a/swe_bench/__init__.py b/benchmark/swe_bench/__init__.py similarity index 100% rename from swe_bench/__init__.py rename to benchmark/swe_bench/__init__.py diff --git a/swe_bench/data/load_dataset.py b/benchmark/swe_bench/data/load_dataset.py similarity index 94% rename from swe_bench/data/load_dataset.py rename to benchmark/swe_bench/data/load_dataset.py index 12f55da5a..03a4b7df7 100644 --- a/swe_bench/data/load_dataset.py +++ b/benchmark/swe_bench/data/load_dataset.py @@ -6,7 +6,7 @@ from pathlib import Path import numpy as np from datasets import load_dataset, load_from_disk -from swe_bench.inference.const import SCIKIT_LEARN_IDS +from benchmark.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/swe_bench/inference/__init__.py b/benchmark/swe_bench/data/repos/__init__.py similarity index 100% rename from swe_bench/inference/__init__.py rename to benchmark/swe_bench/data/repos/__init__.py diff --git a/swe_bench/gitagent.py b/benchmark/swe_bench/gitagent.py similarity index 100% rename from swe_bench/gitagent.py rename to benchmark/swe_bench/gitagent.py diff --git a/swe_bench/make_datasets/__init__.py b/benchmark/swe_bench/inference/__init__.py similarity index 100% rename from swe_bench/make_datasets/__init__.py rename to benchmark/swe_bench/inference/__init__.py diff --git a/swe_bench/inference/const.py b/benchmark/swe_bench/inference/const.py similarity index 96% rename from swe_bench/inference/const.py rename to benchmark/swe_bench/inference/const.py index 9611a209c..4d616c5f3 100644 --- a/swe_bench/inference/const.py +++ b/benchmark/swe_bench/inference/const.py @@ -7,7 +7,7 @@ from metagpt.const import METAGPT_ROOT SUBSET_DATASET = METAGPT_ROOT / "sub_swebench_dataset" / "sub_swebench.csv" SUBSET_DATASET_SKLERARN = METAGPT_ROOT / "sub_swebench_dataset" / "scikit-learn-68.csv" -TESTBED = METAGPT_ROOT / "swe-bench" / "data" / "repos" +TESTBED = METAGPT_ROOT / "benchmark" / "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.py b/benchmark/swe_bench/inference/run.py similarity index 100% rename from swe_bench/inference/run.py rename to benchmark/swe_bench/inference/run.py diff --git a/swe_bench/inference/run_agent.py b/benchmark/swe_bench/inference/run_agent.py similarity index 93% rename from swe_bench/inference/run_agent.py rename to benchmark/swe_bench/inference/run_agent.py index 2e8c381ab..bdcad0bd9 100644 --- a/swe_bench/inference/run_agent.py +++ b/benchmark/swe_bench/inference/run_agent.py @@ -5,12 +5,12 @@ import re from tenacity import retry, stop_after_attempt, wait_random_exponential +from benchmark.swe_bench.gitagent import GitAgent +from benchmark.swe_bench.make_datasets.make_dataset import reset_task_env +from benchmark.swe_bench.utils.utils import extract_scripts_from_codetext from metagpt.logs import logger from metagpt.utils.exceptions import handle_exception from metagpt.utils.recovery_util import save_history -from swe_bench.gitagent import GitAgent -from swe_bench.make_datasets.make_dataset import reset_task_env -from swe_bench.utils.utils import extract_scripts_from_codetext PATCH_FORMAT = """ ```diff diff --git a/swe_bench/inference/run_api.py b/benchmark/swe_bench/inference/run_api.py similarity index 94% rename from swe_bench/inference/run_api.py rename to benchmark/swe_bench/inference/run_api.py index 37d87d6ce..e9d57f1a5 100644 --- a/swe_bench/inference/run_api.py +++ b/benchmark/swe_bench/inference/run_api.py @@ -4,12 +4,12 @@ from pathlib import Path import fire from tqdm.auto import tqdm +from benchmark.swe_bench.data.load_dataset import load_oracle_dataset +from benchmark.swe_bench.inference.run_agent import run_instance +from benchmark.swe_bench.utils.utils import check_existing_ids, extract_diff from metagpt.config2 import config from metagpt.logs import logger from metagpt.utils import count_string_tokens -from swe_bench.data.load_dataset import load_oracle_dataset -from swe_bench.inference.run_agent import run_instance -from swe_bench.utils.utils import check_existing_ids, extract_diff # Replace with your own MAX_TOKEN = 128000 diff --git a/swe_bench/utils/__init__.py b/benchmark/swe_bench/make_datasets/__init__.py similarity index 100% rename from swe_bench/utils/__init__.py rename to benchmark/swe_bench/make_datasets/__init__.py diff --git a/swe_bench/make_datasets/make_dataset.py b/benchmark/swe_bench/make_datasets/make_dataset.py similarity index 86% rename from swe_bench/make_datasets/make_dataset.py rename to benchmark/swe_bench/make_datasets/make_dataset.py index 233f6b01c..60c54181b 100644 --- a/swe_bench/make_datasets/make_dataset.py +++ b/benchmark/swe_bench/make_datasets/make_dataset.py @@ -6,11 +6,11 @@ from pathlib import Path from tqdm.auto import tqdm +from benchmark.swe_bench.inference.const import TESTBED +from benchmark.swe_bench.make_datasets.make_instance import prompt_style_2_edits_only +from benchmark.swe_bench.utils.parse_diff import filter_changed_line +from benchmark.swe_bench.utils.repo_utils import EnvManager from metagpt.logs import logger -from swe_bench.inference.const import TESTBED -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 def reset_task_env(instance: dict = {}): diff --git a/swe_bench/make_datasets/make_instance.py b/benchmark/swe_bench/make_datasets/make_instance.py similarity index 100% rename from swe_bench/make_datasets/make_instance.py rename to benchmark/swe_bench/make_datasets/make_instance.py diff --git a/benchmark/swe_bench/utils/__init__.py b/benchmark/swe_bench/utils/__init__.py new file mode 100644 index 000000000..f12b94354 --- /dev/null +++ b/benchmark/swe_bench/utils/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# @Author : stellahong (stellahong@fuzhi.ai) +# @Desc : diff --git a/swe_bench/utils/enums.py b/benchmark/swe_bench/utils/enums.py similarity index 100% rename from swe_bench/utils/enums.py rename to benchmark/swe_bench/utils/enums.py diff --git a/swe_bench/utils/parse_diff.py b/benchmark/swe_bench/utils/parse_diff.py similarity index 99% rename from swe_bench/utils/parse_diff.py rename to benchmark/swe_bench/utils/parse_diff.py index d2b32d2a1..6b0190e34 100644 --- a/swe_bench/utils/parse_diff.py +++ b/benchmark/swe_bench/utils/parse_diff.py @@ -1,9 +1,10 @@ import re from typing import Dict, List -from metagpt.logs import logger from swe_bench.utils.enums import FileChangeMode, LineChangeType +from metagpt.logs import logger + def extract_changes_from_patch(diff: str) -> List[Dict[str, any]]: """Parses the patch text through the standard syntax of git diff, outputs the information of added and deleted lines. diff --git a/swe_bench/utils/repo_utils.py b/benchmark/swe_bench/utils/repo_utils.py similarity index 100% rename from swe_bench/utils/repo_utils.py rename to benchmark/swe_bench/utils/repo_utils.py diff --git a/swe_bench/utils/utils.py b/benchmark/swe_bench/utils/utils.py similarity index 100% rename from swe_bench/utils/utils.py rename to benchmark/swe_bench/utils/utils.py