mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-28 18:36:22 +02:00
update: swe
This commit is contained in:
parent
96602292b7
commit
92f94862cb
7 changed files with 57 additions and 373 deletions
|
|
@ -7,6 +7,7 @@ from metagpt.config2 import config
|
|||
from metagpt.const import DEFAULT_WORKSPACE_ROOT, METAGPT_ROOT
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles.di.swe import SWE
|
||||
from metagpt.tools.libs.terminal import Terminal
|
||||
from metagpt.tools.swe_agent_commands.swe_agent_utils import load_hf_dataset
|
||||
|
||||
# Specify by yourself
|
||||
|
|
@ -25,8 +26,9 @@ We're currently solving the following issue within our repository. You can use a
|
|||
hints text is the comment under issue:
|
||||
{hints_text}
|
||||
|
||||
The repo may already exist at the path `{repo_path}` (if not, please download the repo to this path).
|
||||
This issue occurred in version {version}, with the corresponding base commit being {base_commit}, you need to switch to the code version corresponding to this commit.
|
||||
The repository may already exist at the path `{repo_path}`. If it doesn't, please download the repository to this path.
|
||||
All your subsequent actions should use the project path as your root directory, and you should never leave that directory to execute any actions.
|
||||
This issue occurred in version {version}, with the corresponding base commit being {base_commit}. You need to switch to the code version associated with this commit.
|
||||
|
||||
# INSTRUCTIONS:
|
||||
Now, you're going to solve this issue on your own from the perspective of a programmer. Your terminal session has started and you're in the repository's root directory. You can use any bash commands or the special interface to help you. Edit all the files you need.
|
||||
|
|
@ -86,7 +88,11 @@ async def run(instance, swe_result_dir):
|
|||
return
|
||||
|
||||
repo_path = TEST_REPO_DIR / (instance["repo"].replace("-", "_").replace("/", "__") + "_" + instance["version"])
|
||||
|
||||
"""
|
||||
All your subsequent actions should use the project path as your root directory, and you should never leave that directory to execute any actions.
|
||||
"""
|
||||
terminal = Terminal()
|
||||
terminal.run_command(f"cd {repo_path} && git checkout . && git clean -n -d && git clean -f -d")
|
||||
user_requirement_and_issue = INSTANCE_TEMPLATE.format(
|
||||
issue=instance["problem_statement"],
|
||||
hints_text=instance["hints_text"],
|
||||
|
|
@ -122,10 +128,10 @@ async def async_main():
|
|||
dataset = load_hf_dataset(dataset_name_or_path=dataset_path, cache_dir=DATA_DIR, split="test")
|
||||
sample_datasets = split_dataset_equally(dataset)
|
||||
date_time = datetime.now().strftime("%m-%d")
|
||||
round_ = "first"
|
||||
round_ = "third"
|
||||
|
||||
for idx, sub_dataset in enumerate(sample_datasets):
|
||||
exp_name = f"Nano-test-{date_time}-{round_}-part-{idx}"
|
||||
exp_name = f"nano_mgx_{date_time}_{round_}_part_{idx}"
|
||||
swe_result_dir = DEFAULT_WORKSPACE_ROOT / f"result_{config.llm.model}" / exp_name
|
||||
swe_result_dir.mkdir(parents=True, exist_ok=True)
|
||||
for instance in sub_dataset:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue