oracle-ads 2.12.11__py3-none-any.whl → 2.13.1__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.
- ads/aqua/__init__.py +7 -1
- ads/aqua/app.py +41 -27
- ads/aqua/client/client.py +48 -11
- ads/aqua/common/entities.py +28 -1
- ads/aqua/common/enums.py +32 -21
- ads/aqua/common/errors.py +3 -4
- ads/aqua/common/utils.py +10 -15
- ads/aqua/config/container_config.py +203 -0
- ads/aqua/config/evaluation/evaluation_service_config.py +5 -181
- ads/aqua/constants.py +1 -1
- ads/aqua/evaluation/constants.py +7 -7
- ads/aqua/evaluation/errors.py +3 -4
- ads/aqua/evaluation/evaluation.py +4 -4
- ads/aqua/extension/base_handler.py +4 -0
- ads/aqua/extension/model_handler.py +41 -27
- ads/aqua/extension/models/ws_models.py +5 -6
- ads/aqua/finetuning/constants.py +3 -3
- ads/aqua/finetuning/finetuning.py +2 -3
- ads/aqua/model/constants.py +7 -7
- ads/aqua/model/entities.py +2 -3
- ads/aqua/model/enums.py +4 -5
- ads/aqua/model/model.py +46 -29
- ads/aqua/modeldeployment/deployment.py +6 -14
- ads/aqua/modeldeployment/entities.py +5 -3
- ads/aqua/server/__init__.py +4 -0
- ads/aqua/server/__main__.py +24 -0
- ads/aqua/server/app.py +47 -0
- ads/aqua/server/aqua_spec.yml +1291 -0
- ads/aqua/ui.py +5 -199
- ads/common/auth.py +50 -28
- ads/common/extended_enum.py +52 -44
- ads/common/utils.py +91 -11
- ads/config.py +3 -0
- ads/llm/__init__.py +12 -8
- ads/llm/langchain/plugins/embeddings/__init__.py +4 -0
- ads/llm/langchain/plugins/embeddings/oci_data_science_model_deployment_endpoint.py +184 -0
- ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +32 -23
- ads/model/artifact_downloader.py +6 -4
- ads/model/common/utils.py +15 -3
- ads/model/datascience_model.py +422 -71
- ads/model/generic_model.py +3 -3
- ads/model/model_metadata.py +70 -24
- ads/model/model_version_set.py +5 -3
- ads/model/service/oci_datascience_model.py +487 -17
- ads/opctl/anomaly_detection.py +11 -0
- ads/opctl/backend/marketplace/helm_helper.py +13 -14
- ads/opctl/cli.py +4 -5
- ads/opctl/cmds.py +28 -32
- ads/opctl/config/merger.py +8 -11
- ads/opctl/config/resolver.py +25 -30
- ads/opctl/forecast.py +11 -0
- ads/opctl/operator/cli.py +9 -9
- ads/opctl/operator/common/backend_factory.py +56 -60
- ads/opctl/operator/common/const.py +5 -5
- ads/opctl/operator/common/utils.py +16 -0
- ads/opctl/operator/lowcode/anomaly/const.py +8 -9
- ads/opctl/operator/lowcode/common/data.py +5 -2
- ads/opctl/operator/lowcode/common/transformations.py +2 -12
- ads/opctl/operator/lowcode/feature_store_marketplace/operator_utils.py +43 -48
- ads/opctl/operator/lowcode/forecast/__main__.py +5 -5
- ads/opctl/operator/lowcode/forecast/const.py +6 -6
- ads/opctl/operator/lowcode/forecast/model/arima.py +6 -3
- ads/opctl/operator/lowcode/forecast/model/automlx.py +61 -31
- ads/opctl/operator/lowcode/forecast/model/base_model.py +66 -40
- ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +79 -13
- ads/opctl/operator/lowcode/forecast/model/neuralprophet.py +5 -2
- ads/opctl/operator/lowcode/forecast/model/prophet.py +28 -15
- ads/opctl/operator/lowcode/forecast/model_evaluator.py +13 -15
- ads/opctl/operator/lowcode/forecast/schema.yaml +1 -1
- ads/opctl/operator/lowcode/forecast/whatifserve/deployment_manager.py +7 -0
- ads/opctl/operator/lowcode/forecast/whatifserve/score.py +19 -11
- ads/opctl/operator/lowcode/pii/constant.py +6 -7
- ads/opctl/operator/lowcode/recommender/constant.py +12 -7
- ads/opctl/operator/runtime/marketplace_runtime.py +4 -10
- ads/opctl/operator/runtime/runtime.py +4 -6
- ads/pipeline/ads_pipeline_run.py +13 -25
- ads/pipeline/visualizer/graph_renderer.py +3 -4
- {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info}/METADATA +18 -15
- {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info}/RECORD +82 -74
- {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info}/WHEEL +1 -1
- ads/aqua/config/evaluation/evaluation_service_model_config.py +0 -8
- {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info}/entry_points.txt +0 -0
- {oracle_ads-2.12.11.dist-info → oracle_ads-2.13.1.dist-info/licenses}/LICENSE.txt +0 -0
@@ -0,0 +1,203 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# Copyright (c) 2025 Oracle and/or its affiliates.
|
3
|
+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
4
|
+
|
5
|
+
from typing import Dict, List, Optional
|
6
|
+
|
7
|
+
from pydantic import Field
|
8
|
+
|
9
|
+
from ads.aqua.common.entities import ContainerSpec
|
10
|
+
from ads.aqua.config.utils.serializer import Serializable
|
11
|
+
|
12
|
+
|
13
|
+
class AquaContainerConfigSpec(Serializable):
|
14
|
+
"""
|
15
|
+
Represents container specification details.
|
16
|
+
|
17
|
+
Attributes
|
18
|
+
----------
|
19
|
+
cli_param (Optional[str]): CLI parameter for container configuration.
|
20
|
+
server_port (Optional[str]): The server port for the container.
|
21
|
+
health_check_port (Optional[str]): The health check port for the container.
|
22
|
+
env_vars (Optional[List[Dict]]): Environment variables for the container.
|
23
|
+
restricted_params (Optional[List[str]]): Restricted parameters for container configuration.
|
24
|
+
"""
|
25
|
+
|
26
|
+
cli_param: Optional[str] = Field(
|
27
|
+
default=None, description="CLI parameter for container configuration."
|
28
|
+
)
|
29
|
+
server_port: Optional[str] = Field(
|
30
|
+
default=None, description="Server port for the container."
|
31
|
+
)
|
32
|
+
health_check_port: Optional[str] = Field(
|
33
|
+
default=None, description="Health check port for the container."
|
34
|
+
)
|
35
|
+
env_vars: Optional[List[Dict]] = Field(
|
36
|
+
default_factory=list, description="List of environment variables."
|
37
|
+
)
|
38
|
+
restricted_params: Optional[List[str]] = Field(
|
39
|
+
default_factory=list, description="List of restricted parameters."
|
40
|
+
)
|
41
|
+
|
42
|
+
class Config:
|
43
|
+
extra = "allow"
|
44
|
+
|
45
|
+
|
46
|
+
class AquaContainerConfigItem(Serializable):
|
47
|
+
"""
|
48
|
+
Represents an item of the AQUA container configuration.
|
49
|
+
|
50
|
+
Attributes
|
51
|
+
----------
|
52
|
+
name (Optional[str]): Name of the container configuration item.
|
53
|
+
version (Optional[str]): Version of the container.
|
54
|
+
display_name (Optional[str]): Display name for UI.
|
55
|
+
family (Optional[str]): Container family or category.
|
56
|
+
platforms (Optional[List[str]]): Supported platforms.
|
57
|
+
model_formats (Optional[List[str]]): Supported model formats.
|
58
|
+
spec (Optional[AquaContainerConfigSpec]): Container specification details.
|
59
|
+
"""
|
60
|
+
|
61
|
+
name: Optional[str] = Field(
|
62
|
+
default=None, description="Name of the container configuration item."
|
63
|
+
)
|
64
|
+
version: Optional[str] = Field(
|
65
|
+
default=None, description="Version of the container."
|
66
|
+
)
|
67
|
+
display_name: Optional[str] = Field(
|
68
|
+
default=None, description="Display name of the container."
|
69
|
+
)
|
70
|
+
family: Optional[str] = Field(
|
71
|
+
default=None, description="Container family or category."
|
72
|
+
)
|
73
|
+
platforms: Optional[List[str]] = Field(
|
74
|
+
default_factory=list, description="Supported platforms."
|
75
|
+
)
|
76
|
+
model_formats: Optional[List[str]] = Field(
|
77
|
+
default_factory=list, description="Supported model formats."
|
78
|
+
)
|
79
|
+
spec: Optional[AquaContainerConfigSpec] = Field(
|
80
|
+
default_factory=AquaContainerConfigSpec,
|
81
|
+
description="Detailed container specification.",
|
82
|
+
)
|
83
|
+
usages: Optional[List[str]] = Field(
|
84
|
+
default_factory=list, description="Supported usages."
|
85
|
+
)
|
86
|
+
|
87
|
+
class Config:
|
88
|
+
extra = "allow"
|
89
|
+
|
90
|
+
|
91
|
+
class AquaContainerConfig(Serializable):
|
92
|
+
"""
|
93
|
+
Represents a configuration of AQUA containers to be returned to the client.
|
94
|
+
|
95
|
+
Attributes
|
96
|
+
----------
|
97
|
+
inference (Dict[str, AquaContainerConfigItem]): Inference container configuration items.
|
98
|
+
finetune (Dict[str, AquaContainerConfigItem]): Fine-tuning container configuration items.
|
99
|
+
evaluate (Dict[str, AquaContainerConfigItem]): Evaluation container configuration items.
|
100
|
+
"""
|
101
|
+
|
102
|
+
inference: Dict[str, AquaContainerConfigItem] = Field(
|
103
|
+
default_factory=dict, description="Inference container configuration items."
|
104
|
+
)
|
105
|
+
finetune: Dict[str, AquaContainerConfigItem] = Field(
|
106
|
+
default_factory=dict, description="Fine-tuning container configuration items."
|
107
|
+
)
|
108
|
+
evaluate: Dict[str, AquaContainerConfigItem] = Field(
|
109
|
+
default_factory=dict, description="Evaluation container configuration items."
|
110
|
+
)
|
111
|
+
|
112
|
+
def to_dict(self):
|
113
|
+
return {
|
114
|
+
"inference": list(self.inference.values()),
|
115
|
+
"finetune": list(self.finetune.values()),
|
116
|
+
"evaluate": list(self.evaluate.values()),
|
117
|
+
}
|
118
|
+
|
119
|
+
@classmethod
|
120
|
+
def from_container_index_json(
|
121
|
+
cls,
|
122
|
+
config: Dict,
|
123
|
+
enable_spec: Optional[bool] = False,
|
124
|
+
) -> "AquaContainerConfig":
|
125
|
+
"""
|
126
|
+
Creates an AquaContainerConfig instance from a container index JSON.
|
127
|
+
|
128
|
+
Parameters
|
129
|
+
----------
|
130
|
+
config (Optional[Dict]): The container index JSON.
|
131
|
+
enable_spec (Optional[bool]): If True, fetch container specification details.
|
132
|
+
|
133
|
+
Returns
|
134
|
+
-------
|
135
|
+
AquaContainerConfig: The constructed container configuration.
|
136
|
+
"""
|
137
|
+
# TODO: Return this logic back if necessary in the next iteraion.
|
138
|
+
# if not config:
|
139
|
+
# config = get_container_config()
|
140
|
+
|
141
|
+
inference_items: Dict[str, AquaContainerConfigItem] = {}
|
142
|
+
finetune_items: Dict[str, AquaContainerConfigItem] = {}
|
143
|
+
evaluate_items: Dict[str, AquaContainerConfigItem] = {}
|
144
|
+
|
145
|
+
for container_type, containers in config.items():
|
146
|
+
if isinstance(containers, list):
|
147
|
+
for container in containers:
|
148
|
+
platforms = container.get("platforms", [])
|
149
|
+
model_formats = container.get("modelFormats", [])
|
150
|
+
usages = container.get("usages", [])
|
151
|
+
container_spec = (
|
152
|
+
config.get(ContainerSpec.CONTAINER_SPEC, {}).get(
|
153
|
+
container_type, {}
|
154
|
+
)
|
155
|
+
if enable_spec
|
156
|
+
else None
|
157
|
+
)
|
158
|
+
container_item = AquaContainerConfigItem(
|
159
|
+
name=container.get("name", ""),
|
160
|
+
version=container.get("version", ""),
|
161
|
+
display_name=container.get(
|
162
|
+
"displayName", container.get("version", "")
|
163
|
+
),
|
164
|
+
family=container_type,
|
165
|
+
platforms=platforms,
|
166
|
+
model_formats=model_formats,
|
167
|
+
usages=usages,
|
168
|
+
spec=(
|
169
|
+
AquaContainerConfigSpec(
|
170
|
+
cli_param=container_spec.get(
|
171
|
+
ContainerSpec.CLI_PARM, ""
|
172
|
+
),
|
173
|
+
server_port=container_spec.get(
|
174
|
+
ContainerSpec.SERVER_PORT, ""
|
175
|
+
),
|
176
|
+
health_check_port=container_spec.get(
|
177
|
+
ContainerSpec.HEALTH_CHECK_PORT, ""
|
178
|
+
),
|
179
|
+
env_vars=container_spec.get(ContainerSpec.ENV_VARS, []),
|
180
|
+
restricted_params=container_spec.get(
|
181
|
+
ContainerSpec.RESTRICTED_PARAMS, []
|
182
|
+
),
|
183
|
+
)
|
184
|
+
if container_spec
|
185
|
+
else None
|
186
|
+
),
|
187
|
+
)
|
188
|
+
if container.get("type") == "inference":
|
189
|
+
inference_items[container_type] = container_item
|
190
|
+
elif (
|
191
|
+
container.get("type") == "fine-tune"
|
192
|
+
or container_type == "odsc-llm-fine-tuning"
|
193
|
+
):
|
194
|
+
finetune_items[container_type] = container_item
|
195
|
+
elif (
|
196
|
+
container.get("type") == "evaluate"
|
197
|
+
or container_type == "odsc-llm-evaluate"
|
198
|
+
):
|
199
|
+
evaluate_items[container_type] = container_item
|
200
|
+
|
201
|
+
return cls(
|
202
|
+
inference=inference_items, finetune=finetune_items, evaluate=evaluate_items
|
203
|
+
)
|
@@ -1,9 +1,8 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
2
|
|
3
|
-
# Copyright (c) 2024 Oracle and/or its affiliates.
|
3
|
+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
|
4
4
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
5
5
|
|
6
|
-
from copy import deepcopy
|
7
6
|
from typing import Any, Dict, List, Optional
|
8
7
|
|
9
8
|
from pydantic import Field
|
@@ -11,139 +10,6 @@ from pydantic import Field
|
|
11
10
|
from ads.aqua.config.utils.serializer import Serializable
|
12
11
|
|
13
12
|
|
14
|
-
class ModelParamsOverrides(Serializable):
|
15
|
-
"""Defines overrides for model parameters, including exclusions and additional inclusions."""
|
16
|
-
|
17
|
-
exclude: Optional[List[str]] = Field(default_factory=list)
|
18
|
-
include: Optional[Dict[str, Any]] = Field(default_factory=dict)
|
19
|
-
|
20
|
-
class Config:
|
21
|
-
extra = "ignore"
|
22
|
-
|
23
|
-
|
24
|
-
class ModelParamsVersion(Serializable):
|
25
|
-
"""Handles version-specific model parameter overrides."""
|
26
|
-
|
27
|
-
overrides: Optional[ModelParamsOverrides] = Field(
|
28
|
-
default_factory=ModelParamsOverrides
|
29
|
-
)
|
30
|
-
|
31
|
-
class Config:
|
32
|
-
extra = "ignore"
|
33
|
-
|
34
|
-
|
35
|
-
class ModelParamsContainer(Serializable):
|
36
|
-
"""Represents a container's model configuration, including tasks, defaults, and versions."""
|
37
|
-
|
38
|
-
name: Optional[str] = None
|
39
|
-
default: Optional[Dict[str, Any]] = Field(default_factory=dict)
|
40
|
-
versions: Optional[Dict[str, ModelParamsVersion]] = Field(default_factory=dict)
|
41
|
-
|
42
|
-
class Config:
|
43
|
-
extra = "ignore"
|
44
|
-
|
45
|
-
|
46
|
-
class InferenceParams(Serializable):
|
47
|
-
"""Contains inference-related parameters with defaults."""
|
48
|
-
|
49
|
-
class Config:
|
50
|
-
extra = "allow"
|
51
|
-
|
52
|
-
|
53
|
-
class InferenceContainer(Serializable):
|
54
|
-
"""Represents the inference parameters specific to a container."""
|
55
|
-
|
56
|
-
name: Optional[str] = None
|
57
|
-
params: Optional[Dict[str, Any]] = Field(default_factory=dict)
|
58
|
-
|
59
|
-
class Config:
|
60
|
-
extra = "ignore"
|
61
|
-
|
62
|
-
|
63
|
-
class ReportParams(Serializable):
|
64
|
-
"""Handles the report-related parameters."""
|
65
|
-
|
66
|
-
default: Optional[Dict[str, Any]] = Field(default_factory=dict)
|
67
|
-
|
68
|
-
class Config:
|
69
|
-
extra = "ignore"
|
70
|
-
|
71
|
-
|
72
|
-
class InferenceParamsConfig(Serializable):
|
73
|
-
"""Combines default inference parameters with container-specific configurations."""
|
74
|
-
|
75
|
-
default: Optional[InferenceParams] = Field(default_factory=InferenceParams)
|
76
|
-
containers: Optional[List[InferenceContainer]] = Field(default_factory=list)
|
77
|
-
|
78
|
-
def get_merged_params(self, container_name: str) -> InferenceParams:
|
79
|
-
"""
|
80
|
-
Merges default inference params with those specific to the given container.
|
81
|
-
|
82
|
-
Parameters
|
83
|
-
----------
|
84
|
-
container_name (str): The name of the container.
|
85
|
-
|
86
|
-
Returns
|
87
|
-
-------
|
88
|
-
InferenceParams: The merged inference parameters.
|
89
|
-
"""
|
90
|
-
merged_params = self.default.to_dict()
|
91
|
-
for containers in self.containers:
|
92
|
-
if containers.name.lower() == container_name.lower():
|
93
|
-
merged_params.update(containers.params or {})
|
94
|
-
break
|
95
|
-
return InferenceParams(**merged_params)
|
96
|
-
|
97
|
-
class Config:
|
98
|
-
extra = "ignore"
|
99
|
-
|
100
|
-
|
101
|
-
class InferenceModelParamsConfig(Serializable):
|
102
|
-
"""Encapsulates the model parameters for different containers."""
|
103
|
-
|
104
|
-
default: Optional[Dict[str, Any]] = Field(default_factory=dict)
|
105
|
-
containers: Optional[List[ModelParamsContainer]] = Field(default_factory=list)
|
106
|
-
|
107
|
-
def get_merged_model_params(
|
108
|
-
self,
|
109
|
-
container_name: str,
|
110
|
-
version: Optional[str] = None,
|
111
|
-
) -> Dict[str, Any]:
|
112
|
-
"""
|
113
|
-
Gets the model parameters for a given container, version,
|
114
|
-
merged with the defaults.
|
115
|
-
|
116
|
-
Parameters
|
117
|
-
----------
|
118
|
-
container_name (str): The name of the container.
|
119
|
-
version (Optional[str]): The specific version of the container.
|
120
|
-
|
121
|
-
Returns
|
122
|
-
-------
|
123
|
-
Dict[str, Any]: The merged model parameters.
|
124
|
-
"""
|
125
|
-
params = deepcopy(self.default)
|
126
|
-
|
127
|
-
for container in self.containers:
|
128
|
-
if container.name.lower() == container_name.lower():
|
129
|
-
params.update(container.default)
|
130
|
-
|
131
|
-
if version and version in container.versions:
|
132
|
-
version_overrides = container.versions[version].overrides
|
133
|
-
if version_overrides:
|
134
|
-
if version_overrides.include:
|
135
|
-
params.update(version_overrides.include)
|
136
|
-
if version_overrides.exclude:
|
137
|
-
for key in version_overrides.exclude:
|
138
|
-
params.pop(key, None)
|
139
|
-
break
|
140
|
-
|
141
|
-
return params
|
142
|
-
|
143
|
-
class Config:
|
144
|
-
extra = "ignore"
|
145
|
-
|
146
|
-
|
147
13
|
class ShapeFilterConfig(Serializable):
|
148
14
|
"""Represents the filtering options for a specific shape."""
|
149
15
|
|
@@ -151,7 +17,7 @@ class ShapeFilterConfig(Serializable):
|
|
151
17
|
evaluation_target: Optional[List[str]] = Field(default_factory=list)
|
152
18
|
|
153
19
|
class Config:
|
154
|
-
extra = "
|
20
|
+
extra = "allow"
|
155
21
|
|
156
22
|
|
157
23
|
class ShapeConfig(Serializable):
|
@@ -178,7 +44,7 @@ class MetricConfig(Serializable):
|
|
178
44
|
tags: Optional[List[str]] = Field(default_factory=list)
|
179
45
|
|
180
46
|
class Config:
|
181
|
-
extra = "
|
47
|
+
extra = "allow"
|
182
48
|
|
183
49
|
|
184
50
|
class ModelParamsConfig(Serializable):
|
@@ -223,7 +89,7 @@ class UIConfig(Serializable):
|
|
223
89
|
]
|
224
90
|
|
225
91
|
class Config:
|
226
|
-
extra = "
|
92
|
+
extra = "allow"
|
227
93
|
protected_namespaces = ()
|
228
94
|
|
229
95
|
|
@@ -235,49 +101,7 @@ class EvaluationServiceConfig(Serializable):
|
|
235
101
|
|
236
102
|
version: Optional[str] = "1.0"
|
237
103
|
kind: Optional[str] = "evaluation_service_config"
|
238
|
-
report_params: Optional[ReportParams] = Field(default_factory=ReportParams)
|
239
|
-
inference_params: Optional[InferenceParamsConfig] = Field(
|
240
|
-
default_factory=InferenceParamsConfig
|
241
|
-
)
|
242
|
-
inference_model_params: Optional[InferenceModelParamsConfig] = Field(
|
243
|
-
default_factory=InferenceModelParamsConfig
|
244
|
-
)
|
245
104
|
ui_config: Optional[UIConfig] = Field(default_factory=UIConfig)
|
246
105
|
|
247
|
-
def get_merged_inference_params(self, container_name: str) -> InferenceParams:
|
248
|
-
"""
|
249
|
-
Merges default inference params with those specific to the given container.
|
250
|
-
|
251
|
-
Params
|
252
|
-
------
|
253
|
-
container_name (str): The name of the container.
|
254
|
-
|
255
|
-
Returns
|
256
|
-
-------
|
257
|
-
InferenceParams: The merged inference parameters.
|
258
|
-
"""
|
259
|
-
return self.inference_params.get_merged_params(container_name=container_name)
|
260
|
-
|
261
|
-
def get_merged_inference_model_params(
|
262
|
-
self,
|
263
|
-
container_name: str,
|
264
|
-
version: Optional[str] = None,
|
265
|
-
) -> Dict[str, Any]:
|
266
|
-
"""
|
267
|
-
Gets the model parameters for a given container, version, and task, merged with the defaults.
|
268
|
-
|
269
|
-
Parameters
|
270
|
-
----------
|
271
|
-
container_name (str): The name of the container.
|
272
|
-
version (Optional[str]): The specific version of the container.
|
273
|
-
|
274
|
-
Returns
|
275
|
-
-------
|
276
|
-
Dict[str, Any]: The merged model parameters.
|
277
|
-
"""
|
278
|
-
return self.inference_model_params.get_merged_model_params(
|
279
|
-
container_name=container_name, version=version
|
280
|
-
)
|
281
|
-
|
282
106
|
class Config:
|
283
|
-
extra = "
|
107
|
+
extra = "allow"
|
ads/aqua/constants.py
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
4
4
|
"""This module defines constants used in ads.aqua module."""
|
5
5
|
|
6
|
-
UNKNOWN = ""
|
7
6
|
UNKNOWN_VALUE = ""
|
8
7
|
READY_TO_IMPORT_STATUS = "TRUE"
|
9
8
|
UNKNOWN_DICT = {}
|
10
9
|
README = "README.md"
|
11
10
|
LICENSE_TXT = "config/LICENSE.txt"
|
12
11
|
DEPLOYMENT_CONFIG = "deployment_config.json"
|
12
|
+
AQUA_MODEL_TOKENIZER_CONFIG = "tokenizer_config.json"
|
13
13
|
COMPARTMENT_MAPPING_KEY = "service-model-compartment"
|
14
14
|
CONTAINER_INDEX = "container_index.json"
|
15
15
|
EVALUATION_REPORT_JSON = "report.json"
|
ads/aqua/evaluation/constants.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
|
-
#
|
3
|
-
# Copyright (c) 2024 Oracle and/or its affiliates.
|
2
|
+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
|
4
3
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
5
4
|
|
6
5
|
"""
|
@@ -9,9 +8,10 @@ aqua.evaluation.const
|
|
9
8
|
|
10
9
|
This module contains constants/enums used in Aqua Evaluation.
|
11
10
|
"""
|
11
|
+
|
12
12
|
from oci.data_science.models import JobRun
|
13
13
|
|
14
|
-
from ads.common.extended_enum import
|
14
|
+
from ads.common.extended_enum import ExtendedEnum
|
15
15
|
|
16
16
|
EVAL_TERMINATION_STATE = [
|
17
17
|
JobRun.LIFECYCLE_STATE_SUCCEEDED,
|
@@ -19,7 +19,7 @@ EVAL_TERMINATION_STATE = [
|
|
19
19
|
]
|
20
20
|
|
21
21
|
|
22
|
-
class EvaluationCustomMetadata(
|
22
|
+
class EvaluationCustomMetadata(ExtendedEnum):
|
23
23
|
EVALUATION_SOURCE = "evaluation_source"
|
24
24
|
EVALUATION_JOB_ID = "evaluation_job_id"
|
25
25
|
EVALUATION_JOB_RUN_ID = "evaluation_job_run_id"
|
@@ -28,11 +28,11 @@ class EvaluationCustomMetadata(str, metaclass=ExtendedEnumMeta):
|
|
28
28
|
EVALUATION_ERROR = "aqua_evaluate_error"
|
29
29
|
|
30
30
|
|
31
|
-
class EvaluationConfig(
|
31
|
+
class EvaluationConfig(ExtendedEnum):
|
32
32
|
PARAMS = "model_params"
|
33
33
|
|
34
34
|
|
35
|
-
class EvaluationReportJson(
|
35
|
+
class EvaluationReportJson(ExtendedEnum):
|
36
36
|
"""Contains evaluation report.json fields name."""
|
37
37
|
|
38
38
|
METRIC_SUMMARY_RESULT = "metric_summary_result"
|
@@ -43,7 +43,7 @@ class EvaluationReportJson(str, metaclass=ExtendedEnumMeta):
|
|
43
43
|
DATASET = "dataset"
|
44
44
|
|
45
45
|
|
46
|
-
class EvaluationMetricResult(
|
46
|
+
class EvaluationMetricResult(ExtendedEnum):
|
47
47
|
"""Contains metric result's fields name in report.json."""
|
48
48
|
|
49
49
|
SHORT_NAME = "key"
|
ads/aqua/evaluation/errors.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
|
-
#
|
3
|
-
# Copyright (c) 2024 Oracle and/or its affiliates.
|
2
|
+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
|
4
3
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
5
4
|
"""
|
6
5
|
aqua.evaluation.errors
|
@@ -9,10 +8,10 @@ aqua.evaluation.errors
|
|
9
8
|
This module contains errors in Aqua Evaluation.
|
10
9
|
"""
|
11
10
|
|
12
|
-
from ads.common.extended_enum import
|
11
|
+
from ads.common.extended_enum import ExtendedEnum
|
13
12
|
|
14
13
|
|
15
|
-
class EvaluationJobExitCode(
|
14
|
+
class EvaluationJobExitCode(ExtendedEnum):
|
16
15
|
SUCCESS = 0
|
17
16
|
COMMON_ERROR = 1
|
18
17
|
|
@@ -40,11 +40,13 @@ from ads.aqua.common.errors import (
|
|
40
40
|
from ads.aqua.common.utils import (
|
41
41
|
extract_id_and_name_from_tag,
|
42
42
|
fire_and_forget,
|
43
|
+
get_container_config,
|
43
44
|
get_container_image,
|
44
45
|
is_valid_ocid,
|
45
46
|
upload_local_to_os,
|
46
47
|
)
|
47
48
|
from ads.aqua.config.config import get_evaluation_service_config
|
49
|
+
from ads.aqua.config.container_config import AquaContainerConfig
|
48
50
|
from ads.aqua.constants import (
|
49
51
|
CONSOLE_LINK_RESOURCE_TYPE_MAPPING,
|
50
52
|
EVALUATION_REPORT,
|
@@ -53,7 +55,6 @@ from ads.aqua.constants import (
|
|
53
55
|
JOB_INFRASTRUCTURE_TYPE_DEFAULT_NETWORKING,
|
54
56
|
LIFECYCLE_DETAILS_MISSING_JOBRUN,
|
55
57
|
NB_SESSION_IDENTIFIER,
|
56
|
-
UNKNOWN,
|
57
58
|
)
|
58
59
|
from ads.aqua.evaluation.constants import (
|
59
60
|
EVAL_TERMINATION_STATE,
|
@@ -75,10 +76,9 @@ from ads.aqua.evaluation.entities import (
|
|
75
76
|
CreateAquaEvaluationDetails,
|
76
77
|
)
|
77
78
|
from ads.aqua.evaluation.errors import EVALUATION_JOB_EXIT_CODE_MESSAGE
|
78
|
-
from ads.aqua.ui import AquaContainerConfig
|
79
79
|
from ads.common.auth import default_signer
|
80
80
|
from ads.common.object_storage_details import ObjectStorageDetails
|
81
|
-
from ads.common.utils import get_console_link, get_files, get_log_links
|
81
|
+
from ads.common.utils import UNKNOWN, get_console_link, get_files, get_log_links
|
82
82
|
from ads.config import (
|
83
83
|
AQUA_JOB_SUBNET_ID,
|
84
84
|
COMPARTMENT_OCID,
|
@@ -192,7 +192,7 @@ class AquaEvaluationApp(AquaApp):
|
|
192
192
|
evaluation_source.runtime.to_dict()
|
193
193
|
)
|
194
194
|
inference_config = AquaContainerConfig.from_container_index_json(
|
195
|
-
enable_spec=True
|
195
|
+
config=get_container_config(), enable_spec=True
|
196
196
|
).inference
|
197
197
|
for container in inference_config.values():
|
198
198
|
if container.name == runtime.image[: runtime.image.rfind(":")]:
|
@@ -8,19 +8,13 @@ from urllib.parse import urlparse
|
|
8
8
|
from tornado.web import HTTPError
|
9
9
|
|
10
10
|
from ads.aqua.common.decorator import handle_exceptions
|
11
|
-
from ads.aqua.common.enums import
|
12
|
-
CustomInferenceContainerTypeFamily,
|
13
|
-
)
|
11
|
+
from ads.aqua.common.enums import CustomInferenceContainerTypeFamily
|
14
12
|
from ads.aqua.common.errors import AquaRuntimeError, AquaValueError
|
15
|
-
from ads.aqua.common.utils import
|
16
|
-
get_hf_model_info,
|
17
|
-
list_hf_models,
|
18
|
-
)
|
13
|
+
from ads.aqua.common.utils import get_hf_model_info, is_valid_ocid, list_hf_models
|
19
14
|
from ads.aqua.extension.base_handler import AquaAPIhandler
|
20
15
|
from ads.aqua.extension.errors import Errors
|
21
16
|
from ads.aqua.model import AquaModelApp
|
22
17
|
from ads.aqua.model.entities import AquaModelSummary, HFModelSummary
|
23
|
-
from ads.aqua.ui import ModelFormat
|
24
18
|
|
25
19
|
|
26
20
|
class AquaModelHandler(AquaAPIhandler):
|
@@ -43,26 +37,24 @@ class AquaModelHandler(AquaAPIhandler):
|
|
43
37
|
raise HTTPError(
|
44
38
|
400, Errors.MISSING_REQUIRED_PARAMETER.format("model_format")
|
45
39
|
)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
40
|
+
|
41
|
+
model_format = model_format.upper()
|
42
|
+
|
43
|
+
if os_path:
|
44
|
+
return self.finish(
|
45
|
+
AquaModelApp.get_model_files(os_path, model_format)
|
46
|
+
)
|
47
|
+
elif model_name:
|
48
|
+
return self.finish(
|
49
|
+
AquaModelApp.get_hf_model_files(model_name, model_format)
|
50
|
+
)
|
50
51
|
else:
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
AquaModelApp.get_hf_model_files(model_name, model_format)
|
58
|
-
)
|
59
|
-
else:
|
60
|
-
raise HTTPError(
|
61
|
-
400,
|
62
|
-
Errors.MISSING_ONEOF_REQUIRED_PARAMETER.format(
|
63
|
-
"os_path", "model_name"
|
64
|
-
),
|
65
|
-
)
|
52
|
+
raise HTTPError(
|
53
|
+
400,
|
54
|
+
Errors.MISSING_ONEOF_REQUIRED_PARAMETER.format(
|
55
|
+
"os_path", "model_name"
|
56
|
+
),
|
57
|
+
)
|
66
58
|
elif not model_id:
|
67
59
|
return self.list()
|
68
60
|
|
@@ -316,8 +308,30 @@ class AquaHuggingFaceHandler(AquaAPIhandler):
|
|
316
308
|
)
|
317
309
|
|
318
310
|
|
311
|
+
class AquaModelTokenizerConfigHandler(AquaAPIhandler):
|
312
|
+
def get(self, model_id):
|
313
|
+
"""
|
314
|
+
Handles requests for retrieving the Hugging Face tokenizer configuration of a specified model.
|
315
|
+
Expected request format: GET /aqua/models/<model-ocid>/tokenizer
|
316
|
+
|
317
|
+
"""
|
318
|
+
|
319
|
+
path_list = urlparse(self.request.path).path.strip("/").split("/")
|
320
|
+
# Path should be /aqua/models/ocid1.iad.ahdxxx/tokenizer
|
321
|
+
# path_list=['aqua','models','<model-ocid>','tokenizer']
|
322
|
+
if (
|
323
|
+
len(path_list) == 4
|
324
|
+
and is_valid_ocid(path_list[2])
|
325
|
+
and path_list[3] == "tokenizer"
|
326
|
+
):
|
327
|
+
return self.finish(AquaModelApp().get_hf_tokenizer_config(model_id))
|
328
|
+
|
329
|
+
raise HTTPError(400, f"The request {self.request.path} is invalid.")
|
330
|
+
|
331
|
+
|
319
332
|
__handlers__ = [
|
320
333
|
("model/?([^/]*)", AquaModelHandler),
|
321
334
|
("model/?([^/]*)/license", AquaModelLicenseHandler),
|
335
|
+
("model/?([^/]*)/tokenizer", AquaModelTokenizerConfigHandler),
|
322
336
|
("model/hf/search/?([^/]*)", AquaHuggingFaceHandler),
|
323
337
|
]
|