-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Labels
🐛 bugSomething isn't workingSomething isn't working
Description
🐛 Bug description [Please make everyone to understand it]
在我使用 SwanLab 的 OpenAPI,尝试将其改写成 MCP Server tools 时,发现经常遇到 get_metric
函数报错 list index out of range
的错误
🧑💻 Step to reproduce
- 获取 SwanLab API
- 在 terminal 中,执行:
python
>>> from swanlab import OpenApi
>>> api = OpenApi(api_key=<your-swanlab-api-key>)
>>> api.get_summary("BBHCholesky", "55wttnbmav7q1qy9wcoff", "TeaLab") # parameters description see https://docs.swanlab.cn/api/py-openapi.html#get-summary
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[3], line 1
----> 1 api.get_summary("BBHCholesky", "55wttnbmav7q1qy9wcoff", "TeaLab")
File ~/SwanLab/swanlab/api/main.py:210, in OpenApi.get_summary(self, project, exp_id, username)
208 project_cuid = self.service.get_project_info(username=username, projname=project).data.get("cuid", "")
209 exp = self.service.get_exp_info(username=username, project=project, exp_id=exp_id)
--> 210 return self.experiment.get_summary(
211 exp_id=exp_id,
212 pro_id=project_cuid,
213 root_exp_id=exp.data.get("rootProId", ""),
214 root_pro_id=exp.data.get("rootExpId", "")
215 )
File ~/SwanLab/swanlab/api/experiment.py:135, in ExperimentAPI.get_summary(self, exp_id, pro_id, root_exp_id, root_pro_id)
132 if resp.errmsg:
133 return resp
--> 135 resp.data = list(resp.data.values())[0]
136 resp.data = {
137 k: {
138 "step": v.get("step"),
(...)
149 for k, v in resp.data.items()
150 }
151 return resp
IndexError: list index out of range
Metadata
Metadata
Assignees
Labels
🐛 bugSomething isn't workingSomething isn't working