aiauto-client 0.1.4__py3-none-any.whl → 0.1.5__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.
- aiauto/__init__.py +0 -2
- aiauto/core.py +41 -1
- {aiauto_client-0.1.4.dist-info → aiauto_client-0.1.5.dist-info}/METADATA +1 -1
- aiauto_client-0.1.5.dist-info/RECORD +10 -0
- aiauto/api.py +0 -46
- aiauto_client-0.1.4.dist-info/RECORD +0 -11
- {aiauto_client-0.1.4.dist-info → aiauto_client-0.1.5.dist-info}/WHEEL +0 -0
- {aiauto_client-0.1.4.dist-info → aiauto_client-0.1.5.dist-info}/top_level.txt +0 -0
aiauto/__init__.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
from .core import AIAutoController, TrialController, CallbackTopNArtifact, StudyWrapper
|
2
|
-
from .api import create_study
|
3
2
|
from ._config import AIAUTO_API_TARGET
|
4
3
|
from .constants import RUNTIME_IMAGES
|
5
4
|
|
@@ -10,7 +9,6 @@ __all__ = [
|
|
10
9
|
'TrialController',
|
11
10
|
'CallbackTopNArtifact',
|
12
11
|
'StudyWrapper',
|
13
|
-
'create_study',
|
14
12
|
'AIAUTO_API_TARGET',
|
15
13
|
'RUNTIME_IMAGES',
|
16
14
|
]
|
aiauto/core.py
CHANGED
@@ -3,7 +3,7 @@ import tempfile
|
|
3
3
|
from typing import Union, Optional, List, Dict, Callable
|
4
4
|
import optuna
|
5
5
|
from .http_client import ConnectRPCClient
|
6
|
-
from .serializer import serialize, build_requirements
|
6
|
+
from .serializer import serialize, build_requirements, object_to_json
|
7
7
|
from ._config import AIAUTO_API_TARGET
|
8
8
|
|
9
9
|
|
@@ -62,6 +62,46 @@ class AIAutoController:
|
|
62
62
|
def get_artifact_tmp_dir(self):
|
63
63
|
return self.tmp_dir
|
64
64
|
|
65
|
+
def create_study(
|
66
|
+
self,
|
67
|
+
study_name: str,
|
68
|
+
direction: Optional[str] = None,
|
69
|
+
directions: Optional[List[str]] = None,
|
70
|
+
sampler: Union[object, dict, None] = None,
|
71
|
+
pruner: Union[object, dict, None] = None
|
72
|
+
) -> 'StudyWrapper':
|
73
|
+
"""Create a new study using the controller's token."""
|
74
|
+
if not direction and not directions:
|
75
|
+
raise ValueError("Either 'direction' or 'directions' must be specified")
|
76
|
+
|
77
|
+
if direction and directions:
|
78
|
+
raise ValueError("Cannot specify both 'direction' and 'directions'")
|
79
|
+
|
80
|
+
try:
|
81
|
+
# Prepare request data for CreateStudy
|
82
|
+
request_data = {
|
83
|
+
"spec": {
|
84
|
+
"studyName": study_name,
|
85
|
+
"direction": direction or "",
|
86
|
+
"directions": directions or [],
|
87
|
+
"samplerJson": object_to_json(sampler),
|
88
|
+
"prunerJson": object_to_json(pruner)
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
# Call CreateStudy RPC
|
93
|
+
response = self.client.call_rpc("CreateStudy", request_data)
|
94
|
+
|
95
|
+
# Return StudyWrapper
|
96
|
+
return StudyWrapper(
|
97
|
+
study_name=response.get("studyName", study_name),
|
98
|
+
storage=self.storage,
|
99
|
+
controller=self
|
100
|
+
)
|
101
|
+
|
102
|
+
except Exception as e:
|
103
|
+
raise RuntimeError(f"Failed to create study: {e}") from e
|
104
|
+
|
65
105
|
|
66
106
|
class TrialController:
|
67
107
|
def __init__(self, trial: optuna.trial.Trial):
|
@@ -0,0 +1,10 @@
|
|
1
|
+
aiauto/__init__.py,sha256=sF7sJaXg7-MqolSYLxsaXAir1dBzARhXLrHo7zLsupg,345
|
2
|
+
aiauto/_config.py,sha256=DaRTIZlph9T3iuW-Cy4fkw8i3bXB--gMtW947SLZZNs,159
|
3
|
+
aiauto/constants.py,sha256=UhDCLFoPE89XrHB3SEnZR3YUuzajgugMGX80KYx_qc0,939
|
4
|
+
aiauto/core.py,sha256=BFKEF2wp3mjMFt5V7oGyZ531j_MIQBJNEiiOVhrKmzc,9549
|
5
|
+
aiauto/http_client.py,sha256=t1gxeM5-d5bsVoFWgaNcTrt_WWUXuMuxge9gDlEqhoA,2086
|
6
|
+
aiauto/serializer.py,sha256=_iPtEoqW8RTKOZ6UrC7CzOqoangpPYzeL7MQfIdmov8,1568
|
7
|
+
aiauto_client-0.1.5.dist-info/METADATA,sha256=_tY0xtaoaz-ZimyBJSavhmApFa8p5oT9WuKDyHH7Hi0,3001
|
8
|
+
aiauto_client-0.1.5.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
9
|
+
aiauto_client-0.1.5.dist-info/top_level.txt,sha256=Sk2ctO9_Bf_tAPwq1x6Vfl6OuL29XzwMTO4F_KG6oJE,7
|
10
|
+
aiauto_client-0.1.5.dist-info/RECORD,,
|
aiauto/api.py
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
from typing import Optional, List, Union
|
2
|
-
from .serializer import object_to_json
|
3
|
-
from .core import StudyWrapper, AIAutoController
|
4
|
-
|
5
|
-
|
6
|
-
def create_study(
|
7
|
-
study_name: str,
|
8
|
-
token: str,
|
9
|
-
direction: Optional[str] = None,
|
10
|
-
directions: Optional[List[str]] = None,
|
11
|
-
sampler: Union[object, dict, None] = None,
|
12
|
-
pruner: Union[object, dict, None] = None
|
13
|
-
) -> StudyWrapper:
|
14
|
-
if not direction and not directions:
|
15
|
-
raise ValueError("Either 'direction' or 'directions' must be specified")
|
16
|
-
|
17
|
-
if direction and directions:
|
18
|
-
raise ValueError("Cannot specify both 'direction' and 'directions'")
|
19
|
-
|
20
|
-
try:
|
21
|
-
# Initialize controller (which ensures workspace)
|
22
|
-
controller = AIAutoController(token)
|
23
|
-
|
24
|
-
# Prepare request data for CreateStudy
|
25
|
-
request_data = {
|
26
|
-
"spec": {
|
27
|
-
"studyName": study_name,
|
28
|
-
"direction": direction or "",
|
29
|
-
"directions": directions or [],
|
30
|
-
"samplerJson": object_to_json(sampler),
|
31
|
-
"prunerJson": object_to_json(pruner)
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
# Call CreateStudy RPC
|
36
|
-
response = controller.client.call_rpc("CreateStudy", request_data)
|
37
|
-
|
38
|
-
# Return StudyWrapper
|
39
|
-
return StudyWrapper(
|
40
|
-
study_name=response.get("studyName", study_name),
|
41
|
-
storage=controller.storage,
|
42
|
-
controller=controller
|
43
|
-
)
|
44
|
-
|
45
|
-
except Exception as e:
|
46
|
-
raise RuntimeError(f"Failed to create study: {e}") from e
|
@@ -1,11 +0,0 @@
|
|
1
|
-
aiauto/__init__.py,sha256=TgD2ZvIHb7oKJb-HjUl3WfXXtuWLien0sybSy9onjL8,395
|
2
|
-
aiauto/_config.py,sha256=DaRTIZlph9T3iuW-Cy4fkw8i3bXB--gMtW947SLZZNs,159
|
3
|
-
aiauto/api.py,sha256=hzoVZMwKtH2EaAM1bY67grp6cenltCl8kdG8YHPegvk,1517
|
4
|
-
aiauto/constants.py,sha256=UhDCLFoPE89XrHB3SEnZR3YUuzajgugMGX80KYx_qc0,939
|
5
|
-
aiauto/core.py,sha256=dF-J8jxRP_FkQtxYYsrgza8OQHNzoPLN1cjYeUaqX1s,8076
|
6
|
-
aiauto/http_client.py,sha256=t1gxeM5-d5bsVoFWgaNcTrt_WWUXuMuxge9gDlEqhoA,2086
|
7
|
-
aiauto/serializer.py,sha256=_iPtEoqW8RTKOZ6UrC7CzOqoangpPYzeL7MQfIdmov8,1568
|
8
|
-
aiauto_client-0.1.4.dist-info/METADATA,sha256=g86ft1ph8ebOUxQRafbgsYvxdlHRygOxvuS3vpSbfgQ,3001
|
9
|
-
aiauto_client-0.1.4.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
10
|
-
aiauto_client-0.1.4.dist-info/top_level.txt,sha256=Sk2ctO9_Bf_tAPwq1x6Vfl6OuL29XzwMTO4F_KG6oJE,7
|
11
|
-
aiauto_client-0.1.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|