Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Eval] initialize llm inside process_instance to circumvent "AttributeError:… #2805

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions evaluation/swe_bench/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,17 @@ def get_test_result(instance, sandbox, workspace_dir_name):


def process_instance(
agent: Agent,
agent_class: str,
llm_config: dict,
instance: Any,
metadata: dict,
skip_workspace_mount: bool,
eval_output_dir: str,
reset_logger: bool = True,
):
# Create the agent
agent = Agent.get_cls(agent_class)(llm=LLM(llm_config))

workspace_mount_path = os.path.join(config.workspace_mount_path, '_eval_workspace')
# create process-specific workspace dir
# if `not skip_workspace_mount` - we will create a workspace directory for EACH process
Expand Down Expand Up @@ -496,17 +500,15 @@ def update_progress(future):
skip_workspace_mount = agent_class == 'CodeActAgent'
logger.info(f'Skipping workspace mount: {skip_workspace_mount}')

# Create the agent
agent = Agent.get_cls(agent_class)(llm=LLM(config.llm))

try:
with ProcessPoolExecutor(num_workers) as executor:
futures = []
# This is how we perform multi-processing
for row_idx, instance in swe_bench_tests.iterrows():
future = executor.submit(
process_instance,
agent,
agent_class,
config.llm,
instance,
metadata,
skip_workspace_mount,
Expand Down