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

[Hot Fix] Fix ModelManager not initialize in distributed mode #428

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion src/agentscope/manager/_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""A manager for AgentScope."""
import os
from typing import Union, Any
from copy import deepcopy

from loguru import logger

Expand Down Expand Up @@ -166,7 +167,7 @@ def state_dict(self) -> dict:
serialized_data["studio"] = _studio_client.state_dict()
serialized_data["monitor"] = self.monitor.state_dict()

return serialized_data
return deepcopy(serialized_data)

def load_dict(self, data: dict) -> None:
"""Load the runtime information from a dictionary"""
Expand Down
11 changes: 11 additions & 0 deletions tests/custom/test_model_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"config_name": "qwen",
"model_type": "dashscope_chat",
"model_name": "qwen-max",
"api_key": "xxx",
"generate_args": {
"temperature": 0.5
}
}
]
17 changes: 17 additions & 0 deletions tests/rpc_agent_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ def setUp(self) -> None:
agentscope.init(
project="test",
name="rpc_agent",
model_configs=os.path.abspath(
os.path.join(
os.path.abspath(os.path.dirname(__file__)),
"custom",
"test_model_config.json",
),
),
save_dir="./.unittest_runs",
save_log=True,
)
Expand Down Expand Up @@ -677,6 +684,16 @@ def test_agent_server_management_funcs(self) -> None:
self.assertEqual(remote_content, local_content)
agent_lists = client.get_agent_list()
self.assertEqual(len(agent_lists), 2)
# test existing model config
DialogAgent(
name="dialogue",
sys_prompt="You are a helful assistant.",
model_config_name="qwen",
to_dist={
"host": "localhost",
"port": launcher.port,
},
)
# model not exists error
self.assertRaises(
Exception,
Expand Down