From 7db302b54feb3dddebaab89171a54b2b46005990 Mon Sep 17 00:00:00 2001 From: "panxuchen.pxc" Date: Thu, 25 Jan 2024 15:50:39 +0800 Subject: [PATCH] update distributed examples --- examples/distributed/distributed_debate.py | 52 ++++++++++++---------- examples/distributed/distributed_dialog.py | 4 +- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/examples/distributed/distributed_debate.py b/examples/distributed/distributed_debate.py index 300b2f537..90a0256ac 100644 --- a/examples/distributed/distributed_debate.py +++ b/examples/distributed/distributed_debate.py @@ -57,7 +57,7 @@ def parse_args() -> argparse.Namespace: def setup_server(parsed_args: argparse.Namespace) -> None: """Setup rpc server for participant agent""" agentscope.init( - model_configs="configs/model_configs.json", + model_configs="configs/model_configs_pxc.json", ) with open( "configs/debate_agent_configs.json", @@ -82,29 +82,35 @@ def setup_server(parsed_args: argparse.Namespace) -> None: def run_main_process(parsed_args: argparse.Namespace) -> None: """Setup the main debate competition process""" agentscope.init( - model_configs="configs/model_configs.json", - ) - pro_agent = DialogAgent( - name="Pro", - ).to_dist( - host=parsed_args.pro_host, - port=parsed_args.pro_port, - launch_server=False, - ) - con_agent = DialogAgent( - name="Con", - ).to_dist( - host=parsed_args.con_host, - port=parsed_args.con_port, - launch_server=False, - ) - judge_agent = DialogAgent( - name="Judge", - ).to_dist( - host=parsed_args.judge_host, - port=parsed_args.judge_port, - launch_server=False, + model_configs="configs/model_configs_pxc.json", ) + with open( + "configs/debate_agent_configs.json", + "r", + encoding="utf-8", + ) as f: + configs = json.load(f) + pro_agent = DialogAgent( + **configs["pro"], + ).to_dist( + host=parsed_args.pro_host, + port=parsed_args.pro_port, + launch_server=False, + ) + con_agent = DialogAgent( + **configs["con"], + ).to_dist( + host=parsed_args.con_host, + port=parsed_args.con_port, + launch_server=False, + ) + judge_agent = DialogAgent( + **configs["judge"], + ).to_dist( + host=parsed_args.judge_host, + port=parsed_args.judge_port, + launch_server=False, + ) participants = [pro_agent, con_agent, judge_agent] hint = Msg(name="System", content=ANNOUNCEMENT) x = None diff --git a/examples/distributed/distributed_dialog.py b/examples/distributed/distributed_dialog.py index ce81b67be..d170862ca 100644 --- a/examples/distributed/distributed_dialog.py +++ b/examples/distributed/distributed_dialog.py @@ -43,7 +43,6 @@ def setup_assistant_server(assistant_host: str, assistant_port: int) -> None: "sys_prompt": "You are a helpful assistant.", "model": "gpt-3.5-turbo", "use_memory": True, - "local_mode": False, }, host=assistant_host, port=assistant_port, @@ -60,6 +59,9 @@ def run_main_process(assistant_host: str, assistant_port: int) -> None: ) assistant_agent = DialogAgent( name="Assistant", + sys_prompt="You are a helpful assistant.", + model="gpt-3.5-turbo", + use_memory=True, ).to_dist( host=assistant_host, port=assistant_port,