intellif-aihub 0.1.19__py3-none-any.whl → 0.1.21__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of intellif-aihub might be problematic. Click here for more details.
- aihub/__init__.py +1 -1
- aihub/models/eval.py +62 -7
- aihub/services/eval.py +101 -4
- {intellif_aihub-0.1.19.dist-info → intellif_aihub-0.1.21.dist-info}/METADATA +1 -1
- {intellif_aihub-0.1.19.dist-info → intellif_aihub-0.1.21.dist-info}/RECORD +8 -8
- {intellif_aihub-0.1.19.dist-info → intellif_aihub-0.1.21.dist-info}/WHEEL +0 -0
- {intellif_aihub-0.1.19.dist-info → intellif_aihub-0.1.21.dist-info}/licenses/LICENSE +0 -0
- {intellif_aihub-0.1.19.dist-info → intellif_aihub-0.1.21.dist-info}/top_level.txt +0 -0
aihub/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.21"
|
aihub/models/eval.py
CHANGED
|
@@ -1,26 +1,81 @@
|
|
|
1
1
|
# !/usr/bin/env python
|
|
2
2
|
# -*-coding:utf-8 -*-
|
|
3
|
-
from typing import Dict
|
|
3
|
+
from typing import Dict, List, Optional
|
|
4
4
|
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class
|
|
9
|
-
"""
|
|
8
|
+
class BaseEvalReq(BaseModel):
|
|
9
|
+
"""评测任务基础请求模型"""
|
|
10
|
+
run_id: str = Field(description="运行ID")
|
|
11
|
+
type: str = Field(description="评测类型,支持 'llm' 和 'cv'")
|
|
12
|
+
prediction_artifact_path: str = Field(description="推理产物的路径")
|
|
13
|
+
user_id: int = Field(0, description="用户ID,默认0")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CreateLLMEvalReq(BaseEvalReq):
|
|
17
|
+
"""创建LLM类型评测任务请求"""
|
|
18
|
+
type: str = Field(default="llm", description="评测类型,固定为 'llm'")
|
|
10
19
|
dataset_id: int = Field(description="数据集ID")
|
|
11
20
|
dataset_version_id: int = Field(description="数据集版本ID")
|
|
12
|
-
prediction_artifact_path: str = Field(description="推理产物的路径")
|
|
13
21
|
evaled_artifact_path: str = Field(description="评测结果产物的路径")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
report: Dict = Field(description="评测报告")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CreateCVEvalReq(BaseEvalReq):
|
|
26
|
+
"""创建CV类型评测任务请求"""
|
|
27
|
+
type: str = Field(default="cv", description="评测类型,固定为 'cv'")
|
|
28
|
+
metrics_artifact_path: str = Field(description="指标产物的路径")
|
|
29
|
+
ground_truth_artifact_path: str = Field(description="真实标签产物的路径")
|
|
17
30
|
|
|
18
31
|
|
|
19
32
|
class EvalRun(BaseModel):
|
|
20
33
|
"""评测任务的运行实体"""
|
|
21
34
|
id: int = Field(description="评测的运行ID")
|
|
35
|
+
name: str = Field(description="评测名称")
|
|
36
|
+
description: str = Field(description="评测描述")
|
|
37
|
+
user_id: int = Field(description="用户ID")
|
|
38
|
+
model_id: int = Field(description="模型ID")
|
|
39
|
+
model_name: str = Field(description="模型名称")
|
|
40
|
+
dataset_id: int = Field(description="数据集ID")
|
|
41
|
+
dataset_version_id: int = Field(description="数据集版本ID")
|
|
42
|
+
dataset_name: str = Field(description="数据集名称")
|
|
43
|
+
status: str = Field(description="状态")
|
|
44
|
+
prediction_artifact_path: str = Field(description="推理产物路径")
|
|
45
|
+
evaled_artifact_path: str = Field(description="评测结果产物路径")
|
|
46
|
+
run_id: str = Field(description="运行ID")
|
|
47
|
+
dataset_summary: Dict = Field(default_factory=dict, description="数据集摘要")
|
|
48
|
+
metrics_summary: Dict = Field(default_factory=dict, description="指标摘要")
|
|
49
|
+
viz_summary: Dict = Field(default_factory=dict, description="可视化摘要")
|
|
50
|
+
eval_config: Optional[Dict] = Field(default=None, description="评测配置")
|
|
51
|
+
created_at: int = Field(description="创建时间")
|
|
52
|
+
updated_at: int = Field(description="更新时间")
|
|
22
53
|
|
|
23
54
|
|
|
24
55
|
class CreateEvalResp(BaseModel):
|
|
25
56
|
"""创建评测任务的返回结果"""
|
|
26
57
|
eval_run: EvalRun = Field(alias="eval_run", description="评测运行信息")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ListEvalReq(BaseModel):
|
|
61
|
+
"""列出评测任务请求"""
|
|
62
|
+
page_size: int = Field(20, description="页面大小")
|
|
63
|
+
page_num: int = Field(1, description="页码")
|
|
64
|
+
status: Optional[str] = Field(None, description="状态过滤")
|
|
65
|
+
name: Optional[str] = Field(None, description="名称过滤")
|
|
66
|
+
model_id: Optional[int] = Field(None, description="模型ID过滤")
|
|
67
|
+
dataset_id: Optional[int] = Field(None, description="数据集ID过滤")
|
|
68
|
+
dataset_version_id: Optional[int] = Field(None, description="数据集版本ID过滤")
|
|
69
|
+
run_id: Optional[str] = Field(None, description="运行ID过滤")
|
|
70
|
+
user_id: Optional[int] = Field(None, description="用户ID过滤")
|
|
71
|
+
model_ids: Optional[str] = Field(None, description="模型ID列表过滤")
|
|
72
|
+
dataset_ids: Optional[str] = Field(None, description="数据集ID列表过滤")
|
|
73
|
+
dataset_version_ids: Optional[str] = Field(None, description="数据集版本ID列表过滤")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class ListEvalResp(BaseModel):
|
|
77
|
+
"""列出评测任务响应"""
|
|
78
|
+
total: int = Field(description="总数")
|
|
79
|
+
page_size: int = Field(description="页面大小")
|
|
80
|
+
page_num: int = Field(description="页码")
|
|
81
|
+
data: List[EvalRun] = Field(description="评测运行列表")
|
aihub/services/eval.py
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
本模块围绕 **“模型评测(Run → Report)”** 提供能力:
|
|
6
6
|
|
|
7
7
|
- **创建评测任务 / 评测报告**
|
|
8
|
+
- **获取评测任务列表**
|
|
8
9
|
"""
|
|
9
10
|
|
|
10
11
|
import httpx
|
|
11
12
|
|
|
12
13
|
from ..exceptions import APIError
|
|
13
14
|
from ..models.common import APIWrapper
|
|
14
|
-
from ..models.eval import
|
|
15
|
+
from ..models.eval import CreateLLMEvalReq, CreateCVEvalReq, CreateEvalResp, ListEvalReq, ListEvalResp
|
|
15
16
|
|
|
16
17
|
_BASE = "/eval-platform/api/v1"
|
|
17
18
|
|
|
@@ -30,6 +31,7 @@ class EvalService:
|
|
|
30
31
|
evaled_artifact_path: str,
|
|
31
32
|
report_json: dict,
|
|
32
33
|
run_id,
|
|
34
|
+
user_id: int = 0,
|
|
33
35
|
) -> int:
|
|
34
36
|
"""创建评测报告
|
|
35
37
|
|
|
@@ -39,7 +41,7 @@ class EvalService:
|
|
|
39
41
|
evaled_artifact_path: 评测结果制品路径
|
|
40
42
|
prediction_artifact_path: 推理结果制品路径
|
|
41
43
|
dataset_version_name (str): 数据集名称
|
|
42
|
-
|
|
44
|
+
user_id (int, optional): 用户ID,默认为0
|
|
43
45
|
|
|
44
46
|
Returns:
|
|
45
47
|
id (int): 评测报告id
|
|
@@ -51,25 +53,120 @@ class EvalService:
|
|
|
51
53
|
dataset_version = dataset_service.get_dataset_version_by_name(
|
|
52
54
|
dataset_version_name
|
|
53
55
|
)
|
|
54
|
-
payload =
|
|
56
|
+
payload = CreateLLMEvalReq(
|
|
55
57
|
dataset_id=dataset_version.dataset_id,
|
|
56
58
|
dataset_version_id=dataset_version.id,
|
|
57
59
|
evaled_artifact_path=evaled_artifact_path,
|
|
58
60
|
prediction_artifact_path=prediction_artifact_path,
|
|
59
61
|
report=report_json,
|
|
60
62
|
run_id=run_id,
|
|
63
|
+
user_id=user_id,
|
|
61
64
|
)
|
|
62
65
|
|
|
63
66
|
return self._eval.create(payload)
|
|
64
67
|
|
|
68
|
+
def create_cv_run(
|
|
69
|
+
self,
|
|
70
|
+
run_id: str,
|
|
71
|
+
prediction_artifact_path: str,
|
|
72
|
+
metrics_artifact_path: str,
|
|
73
|
+
ground_truth_artifact_path: str,
|
|
74
|
+
user_id: int = 0,
|
|
75
|
+
) -> int:
|
|
76
|
+
"""创建 CV 类型评测运行
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
run_id (str): 运行ID
|
|
80
|
+
prediction_artifact_path (str): 推理产物的路径
|
|
81
|
+
metrics_artifact_path (str): 指标产物的路径
|
|
82
|
+
ground_truth_artifact_path (str): 真实标签产物的路径
|
|
83
|
+
user_id (int, optional): 用户ID,默认为0
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
id (int): 评测运行id
|
|
87
|
+
"""
|
|
88
|
+
payload = CreateCVEvalReq(
|
|
89
|
+
run_id=run_id,
|
|
90
|
+
prediction_artifact_path=prediction_artifact_path,
|
|
91
|
+
metrics_artifact_path=metrics_artifact_path,
|
|
92
|
+
ground_truth_artifact_path=ground_truth_artifact_path,
|
|
93
|
+
user_id=user_id,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
return self._eval.create(payload)
|
|
97
|
+
|
|
98
|
+
def list(
|
|
99
|
+
self,
|
|
100
|
+
page_size: int = 20,
|
|
101
|
+
page_num: int = 1,
|
|
102
|
+
status: str = None,
|
|
103
|
+
name: str = None,
|
|
104
|
+
model_id: int = None,
|
|
105
|
+
dataset_id: int = None,
|
|
106
|
+
dataset_version_id: int = None,
|
|
107
|
+
run_id: str = None,
|
|
108
|
+
user_id: int = None,
|
|
109
|
+
model_ids: str = None,
|
|
110
|
+
dataset_ids: str = None,
|
|
111
|
+
dataset_version_ids: str = None,
|
|
112
|
+
) -> ListEvalResp:
|
|
113
|
+
"""列出评测结果
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
page_size (int): 页面大小,默认为20
|
|
117
|
+
page_num (int): 页码,默认为1
|
|
118
|
+
status (str, optional): 状态过滤
|
|
119
|
+
name (str, optional): 名称过滤
|
|
120
|
+
model_id (int, optional): 模型ID过滤
|
|
121
|
+
dataset_id (int, optional): 数据集ID过滤
|
|
122
|
+
dataset_version_id (int, optional): 数据集版本ID过滤
|
|
123
|
+
run_id (str, optional): 运行ID过滤
|
|
124
|
+
user_id (int, optional): 用户ID过滤
|
|
125
|
+
model_ids (str, optional): 模型ID列表过滤(逗号分隔)
|
|
126
|
+
dataset_ids (str, optional): 数据集ID列表过滤(逗号分隔)
|
|
127
|
+
dataset_version_ids (str, optional): 数据集版本ID列表过滤(逗号分隔)
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
ListEvalResp: 评测结果列表响应
|
|
131
|
+
"""
|
|
132
|
+
payload = ListEvalReq(
|
|
133
|
+
page_size=page_size,
|
|
134
|
+
page_num=page_num,
|
|
135
|
+
status=status,
|
|
136
|
+
name=name,
|
|
137
|
+
model_id=model_id,
|
|
138
|
+
dataset_id=dataset_id,
|
|
139
|
+
dataset_version_id=dataset_version_id,
|
|
140
|
+
run_id=run_id,
|
|
141
|
+
user_id=user_id,
|
|
142
|
+
model_ids=model_ids,
|
|
143
|
+
dataset_ids=dataset_ids,
|
|
144
|
+
dataset_version_ids=dataset_version_ids,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
return self._eval.list(payload)
|
|
148
|
+
|
|
65
149
|
|
|
66
150
|
class _Eval:
|
|
67
151
|
def __init__(self, http: httpx.Client):
|
|
68
152
|
self._http = http
|
|
69
153
|
|
|
70
|
-
def create(self, payload
|
|
154
|
+
def create(self, payload) -> int:
|
|
71
155
|
resp = self._http.post(f"{_BASE}/run/", json=payload.model_dump())
|
|
72
156
|
wrapper = APIWrapper[CreateEvalResp].model_validate(resp.json())
|
|
73
157
|
if wrapper.code != 0:
|
|
74
158
|
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
75
159
|
return wrapper.data.eval_run.id
|
|
160
|
+
|
|
161
|
+
def list(self, payload: ListEvalReq) -> ListEvalResp:
|
|
162
|
+
# Build query parameters, excluding None values
|
|
163
|
+
params = {}
|
|
164
|
+
for field, value in payload.model_dump().items():
|
|
165
|
+
if value is not None:
|
|
166
|
+
params[field] = value
|
|
167
|
+
|
|
168
|
+
resp = self._http.get(f"{_BASE}/run/", params=params)
|
|
169
|
+
wrapper = APIWrapper[ListEvalResp].model_validate(resp.json())
|
|
170
|
+
if wrapper.code != 0:
|
|
171
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
172
|
+
return wrapper.data
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
aihub/__init__.py,sha256=
|
|
1
|
+
aihub/__init__.py,sha256=qEmNtjnOwhDYQ0cHPPtUkUaghzD2xl0thJEznl4giYw,23
|
|
2
2
|
aihub/client.py,sha256=Fu3jlEy21T4nJDV5EXTDujy1_B3Pf6CSTyPwkj3PPuE,5574
|
|
3
3
|
aihub/exceptions.py,sha256=l2cMAvipTqQOio3o11fXsCCSCevbuK4PTsxofkobFjk,500
|
|
4
4
|
aihub/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -7,7 +7,7 @@ aihub/models/common.py,sha256=qmabc2LkAdQJXIcpT1P35zxd0Lc8yDYdD4ame1iF4Bs,241
|
|
|
7
7
|
aihub/models/data_warehouse.py,sha256=zXvWwg7ySoFJMdqQ_1UMTNEKDMhu1hDHlWdBAXdizBk,3905
|
|
8
8
|
aihub/models/dataset_management.py,sha256=4DuQ0zM7jv73SJiqvieHLtn2Y-T6FIFV9r7bgzyCtDo,10790
|
|
9
9
|
aihub/models/document_center.py,sha256=od9bzx6krAS6ktIA-ChxeqGcch0v2wsS1flY2vuHXBc,1340
|
|
10
|
-
aihub/models/eval.py,sha256=
|
|
10
|
+
aihub/models/eval.py,sha256=fcCoCFiDdZksJnbf7IsVPuwPwYMnGbSiVR8U4gN-3OM,3867
|
|
11
11
|
aihub/models/labelfree.py,sha256=YUnUv0tjYSFAFzYtmbnLOha8rnDe32sb50HkPOclAzU,2016
|
|
12
12
|
aihub/models/model_center.py,sha256=DNMchrN0pYDcTMHApWNNVMrARF_i9Ng5xlAwHX5isYw,5935
|
|
13
13
|
aihub/models/model_training_platform.py,sha256=2zir5i-XvuxKKVYr4wuNYUC7nwMzetdtCRoysZ1W_Tc,11725
|
|
@@ -21,7 +21,7 @@ aihub/services/artifact.py,sha256=lfOrgOT2AlH1w-75NLcQGOhVWdhmJcWD1gESPpUzqUw,11
|
|
|
21
21
|
aihub/services/data_warehouse.py,sha256=awvlJdggo8ph6sXweXXVp4GLRuUSD46LoD0QQksXRts,2964
|
|
22
22
|
aihub/services/dataset_management.py,sha256=R7mFsJ1dNOI_p5yNj_rQdLolRC0UKEN4WejE7uOjVlE,21379
|
|
23
23
|
aihub/services/document_center.py,sha256=dG67Ji-DOnzL2t-4x4gVfMt9fbSj_IjVHCLw5R-VTkQ,1813
|
|
24
|
-
aihub/services/eval.py,sha256=
|
|
24
|
+
aihub/services/eval.py,sha256=CweTUkWSECqAEbccUCl2YlF7ZQsfuZKOWg3UFDaZv10,5619
|
|
25
25
|
aihub/services/labelfree.py,sha256=xua62UWhVXTxJjHRyy86waaormnJjmpQwepcARBy_h0,1450
|
|
26
26
|
aihub/services/model_center.py,sha256=QZXlldPZrbC6YkVG3eGw5_53qvFAim2QlXg3DflByTA,6215
|
|
27
27
|
aihub/services/model_training_platform.py,sha256=38o6HJnyi3htFzpX7qj6UhzdqTchcXLRTYU0nM7ffJg,10176
|
|
@@ -36,8 +36,8 @@ aihub/utils/di.py,sha256=vFUzno5WbRKu6-pj8Hnz9IqT7xb9UDZQ4qpOFH1YAtM,11812
|
|
|
36
36
|
aihub/utils/download.py,sha256=ZZVbcC-PnN3PumV7ZiJ_-srkt4HPPovu2F6Faa2RrPE,1830
|
|
37
37
|
aihub/utils/http.py,sha256=AmfHHNjptuuSFx2T1twWCnerR_hLN_gd0lUs8z36ERA,547
|
|
38
38
|
aihub/utils/s3.py,sha256=ISIBP-XdBPkURpXnN56ZnIWokOOg2SRUh_qvxJk-G1Q,2187
|
|
39
|
-
intellif_aihub-0.1.
|
|
40
|
-
intellif_aihub-0.1.
|
|
41
|
-
intellif_aihub-0.1.
|
|
42
|
-
intellif_aihub-0.1.
|
|
43
|
-
intellif_aihub-0.1.
|
|
39
|
+
intellif_aihub-0.1.21.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
40
|
+
intellif_aihub-0.1.21.dist-info/METADATA,sha256=3E24k8VYdgjj3EyXtxZHC4NMpYtMAD_hmPu2aX5MJ4o,2949
|
|
41
|
+
intellif_aihub-0.1.21.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
42
|
+
intellif_aihub-0.1.21.dist-info/top_level.txt,sha256=vIvTtSIN73xv46BpYM-ctVGnyOiUQ9EWP_6ngvdIlvw,6
|
|
43
|
+
intellif_aihub-0.1.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|