oracle-ads 2.13.0__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 +24 -23
- ads/aqua/client/client.py +48 -11
- ads/aqua/common/entities.py +28 -1
- ads/aqua/common/enums.py +13 -7
- ads/aqua/common/utils.py +8 -13
- ads/aqua/config/container_config.py +203 -0
- ads/aqua/config/evaluation/evaluation_service_config.py +5 -181
- ads/aqua/constants.py +0 -1
- ads/aqua/evaluation/evaluation.py +4 -4
- ads/aqua/extension/base_handler.py +4 -0
- ads/aqua/extension/model_handler.py +19 -28
- ads/aqua/finetuning/finetuning.py +2 -3
- ads/aqua/model/entities.py +2 -3
- ads/aqua/model/model.py +25 -30
- ads/aqua/modeldeployment/deployment.py +6 -14
- ads/aqua/modeldeployment/entities.py +2 -2
- 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 +20 -11
- ads/common/utils.py +91 -11
- ads/config.py +3 -0
- ads/llm/__init__.py +1 -0
- ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +32 -23
- ads/model/artifact_downloader.py +4 -1
- ads/model/common/utils.py +15 -3
- ads/model/datascience_model.py +339 -8
- ads/model/model_metadata.py +54 -14
- ads/model/model_version_set.py +5 -3
- ads/model/service/oci_datascience_model.py +477 -5
- ads/opctl/anomaly_detection.py +11 -0
- ads/opctl/forecast.py +11 -0
- ads/opctl/operator/common/utils.py +16 -0
- ads/opctl/operator/lowcode/common/data.py +5 -2
- ads/opctl/operator/lowcode/common/transformations.py +2 -12
- ads/opctl/operator/lowcode/forecast/__main__.py +5 -5
- 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
- {oracle_ads-2.13.0.dist-info → oracle_ads-2.13.1.dist-info}/METADATA +18 -15
- {oracle_ads-2.13.0.dist-info → oracle_ads-2.13.1.dist-info}/RECORD +54 -48
- {oracle_ads-2.13.0.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.13.0.dist-info → oracle_ads-2.13.1.dist-info}/entry_points.txt +0 -0
- {oracle_ads-2.13.0.dist-info → oracle_ads-2.13.1.dist-info/licenses}/LICENSE.txt +0 -0
@@ -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
@@ -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,20 +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
|
-
is_valid_ocid,
|
18
|
-
list_hf_models,
|
19
|
-
)
|
13
|
+
from ads.aqua.common.utils import get_hf_model_info, is_valid_ocid, list_hf_models
|
20
14
|
from ads.aqua.extension.base_handler import AquaAPIhandler
|
21
15
|
from ads.aqua.extension.errors import Errors
|
22
16
|
from ads.aqua.model import AquaModelApp
|
23
17
|
from ads.aqua.model.entities import AquaModelSummary, HFModelSummary
|
24
|
-
from ads.aqua.ui import ModelFormat
|
25
18
|
|
26
19
|
|
27
20
|
class AquaModelHandler(AquaAPIhandler):
|
@@ -44,26 +37,24 @@ class AquaModelHandler(AquaAPIhandler):
|
|
44
37
|
raise HTTPError(
|
45
38
|
400, Errors.MISSING_REQUIRED_PARAMETER.format("model_format")
|
46
39
|
)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
+
)
|
51
51
|
else:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
AquaModelApp.get_hf_model_files(model_name, model_format)
|
59
|
-
)
|
60
|
-
else:
|
61
|
-
raise HTTPError(
|
62
|
-
400,
|
63
|
-
Errors.MISSING_ONEOF_REQUIRED_PARAMETER.format(
|
64
|
-
"os_path", "model_name"
|
65
|
-
),
|
66
|
-
)
|
52
|
+
raise HTTPError(
|
53
|
+
400,
|
54
|
+
Errors.MISSING_ONEOF_REQUIRED_PARAMETER.format(
|
55
|
+
"os_path", "model_name"
|
56
|
+
),
|
57
|
+
)
|
67
58
|
elif not model_id:
|
68
59
|
return self.list()
|
69
60
|
|
@@ -30,7 +30,6 @@ from ads.aqua.constants import (
|
|
30
30
|
DEFAULT_FT_REPLICA,
|
31
31
|
DEFAULT_FT_VALIDATION_SET_SIZE,
|
32
32
|
JOB_INFRASTRUCTURE_TYPE_DEFAULT_NETWORKING,
|
33
|
-
UNKNOWN,
|
34
33
|
UNKNOWN_DICT,
|
35
34
|
)
|
36
35
|
from ads.aqua.data import AquaResourceIdentifier
|
@@ -45,7 +44,7 @@ from ads.aqua.finetuning.entities import (
|
|
45
44
|
)
|
46
45
|
from ads.common.auth import default_signer
|
47
46
|
from ads.common.object_storage_details import ObjectStorageDetails
|
48
|
-
from ads.common.utils import get_console_link
|
47
|
+
from ads.common.utils import UNKNOWN, get_console_link
|
49
48
|
from ads.config import (
|
50
49
|
AQUA_FINETUNING_CONTAINER_OVERRIDE_FLAG_METADATA_NAME,
|
51
50
|
AQUA_JOB_SUBNET_ID,
|
@@ -592,7 +591,7 @@ class AquaFineTuningApp(AquaApp):
|
|
592
591
|
Dict:
|
593
592
|
A dict of allowed finetuning configs.
|
594
593
|
"""
|
595
|
-
config = self.get_config(model_id, AQUA_MODEL_FINETUNING_CONFIG)
|
594
|
+
config = self.get_config(model_id, AQUA_MODEL_FINETUNING_CONFIG).config
|
596
595
|
if not config:
|
597
596
|
logger.debug(
|
598
597
|
f"Fine-tuning config for custom model: {model_id} is not available. Use defaults."
|
ads/aqua/model/entities.py
CHANGED
@@ -23,7 +23,6 @@ from ads.aqua.constants import LIFECYCLE_DETAILS_MISSING_JOBRUN, UNKNOWN_VALUE
|
|
23
23
|
from ads.aqua.data import AquaResourceIdentifier
|
24
24
|
from ads.aqua.model.enums import FineTuningDefinedMetadata
|
25
25
|
from ads.aqua.training.exceptions import exit_code_dict
|
26
|
-
from ads.aqua.ui import ModelFormat
|
27
26
|
from ads.common.serializer import DataClassSerializable
|
28
27
|
from ads.common.utils import get_log_links
|
29
28
|
from ads.model.datascience_model import DataScienceModel
|
@@ -46,7 +45,7 @@ class AquaFineTuneValidation(DataClassSerializable):
|
|
46
45
|
@dataclass(repr=False)
|
47
46
|
class ModelValidationResult:
|
48
47
|
model_file: Optional[str] = None
|
49
|
-
model_formats: List[
|
48
|
+
model_formats: List[str] = field(default_factory=list)
|
50
49
|
telemetry_model_name: str = None
|
51
50
|
tags: Optional[dict] = None
|
52
51
|
|
@@ -89,7 +88,7 @@ class AquaModelSummary(DataClassSerializable):
|
|
89
88
|
nvidia_gpu_supported: bool = False
|
90
89
|
arm_cpu_supported: bool = False
|
91
90
|
model_file: Optional[str] = None
|
92
|
-
model_formats: List[
|
91
|
+
model_formats: List[str] = field(default_factory=list)
|
93
92
|
|
94
93
|
|
95
94
|
@dataclass(repr=False)
|
ads/aqua/model/model.py
CHANGED
@@ -19,6 +19,8 @@ from ads.aqua.common.enums import (
|
|
19
19
|
CustomInferenceContainerTypeFamily,
|
20
20
|
FineTuningContainerTypeFamily,
|
21
21
|
InferenceContainerTypeFamily,
|
22
|
+
ModelFormat,
|
23
|
+
Platform,
|
22
24
|
Tags,
|
23
25
|
)
|
24
26
|
from ads.aqua.common.errors import (
|
@@ -40,6 +42,7 @@ from ads.aqua.common.utils import (
|
|
40
42
|
read_file,
|
41
43
|
upload_folder,
|
42
44
|
)
|
45
|
+
from ads.aqua.config.container_config import AquaContainerConfig
|
43
46
|
from ads.aqua.constants import (
|
44
47
|
AQUA_MODEL_ARTIFACT_CONFIG,
|
45
48
|
AQUA_MODEL_ARTIFACT_CONFIG_MODEL_NAME,
|
@@ -56,7 +59,6 @@ from ads.aqua.constants import (
|
|
56
59
|
READY_TO_IMPORT_STATUS,
|
57
60
|
TRAINING_METRICS_FINAL,
|
58
61
|
TRINING_METRICS,
|
59
|
-
UNKNOWN,
|
60
62
|
VALIDATION_METRICS,
|
61
63
|
VALIDATION_METRICS_FINAL,
|
62
64
|
)
|
@@ -73,13 +75,11 @@ from ads.aqua.model.entities import (
|
|
73
75
|
AquaModelLicense,
|
74
76
|
AquaModelSummary,
|
75
77
|
ImportModelDetails,
|
76
|
-
ModelFormat,
|
77
78
|
ModelValidationResult,
|
78
79
|
)
|
79
|
-
from ads.aqua.ui import AquaContainerConfig, AquaContainerConfigItem
|
80
80
|
from ads.common.auth import default_signer
|
81
81
|
from ads.common.oci_resource import SEARCH_TYPE, OCIResource
|
82
|
-
from ads.common.utils import get_console_link
|
82
|
+
from ads.common.utils import UNKNOWN, get_console_link
|
83
83
|
from ads.config import (
|
84
84
|
AQUA_DEPLOYMENT_CONTAINER_CMD_VAR_METADATA_NAME,
|
85
85
|
AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME,
|
@@ -585,7 +585,7 @@ class AquaModelApp(AquaApp):
|
|
585
585
|
"""
|
586
586
|
config = self.get_config(
|
587
587
|
model_id, AQUA_MODEL_TOKENIZER_CONFIG, ConfigFolder.ARTIFACT
|
588
|
-
)
|
588
|
+
).config
|
589
589
|
if not config:
|
590
590
|
logger.debug(f"Tokenizer config for model: {model_id} is not available.")
|
591
591
|
return config
|
@@ -667,28 +667,24 @@ class AquaModelApp(AquaApp):
|
|
667
667
|
except Exception:
|
668
668
|
model_file = UNKNOWN
|
669
669
|
|
670
|
-
inference_containers = AquaContainerConfig.from_container_index_json(
|
670
|
+
inference_containers = AquaContainerConfig.from_container_index_json(
|
671
|
+
config=get_container_config()
|
672
|
+
).inference
|
671
673
|
|
672
674
|
model_formats_str = freeform_tags.get(
|
673
|
-
Tags.MODEL_FORMAT, ModelFormat.SAFETENSORS
|
675
|
+
Tags.MODEL_FORMAT, ModelFormat.SAFETENSORS
|
674
676
|
).upper()
|
675
|
-
model_formats =
|
676
|
-
ModelFormat[model_format] for model_format in model_formats_str.split(",")
|
677
|
-
]
|
677
|
+
model_formats = model_formats_str.split(",")
|
678
678
|
|
679
|
-
supported_platform: Set[
|
679
|
+
supported_platform: Set[str] = set()
|
680
680
|
|
681
681
|
for container in inference_containers.values():
|
682
682
|
for model_format in model_formats:
|
683
683
|
if model_format in container.model_formats:
|
684
684
|
supported_platform.update(container.platforms)
|
685
685
|
|
686
|
-
nvidia_gpu_supported =
|
687
|
-
|
688
|
-
)
|
689
|
-
arm_cpu_supported = (
|
690
|
-
AquaContainerConfigItem.Platform.ARM_CPU in supported_platform
|
691
|
-
)
|
686
|
+
nvidia_gpu_supported = Platform.NVIDIA_GPU in supported_platform
|
687
|
+
arm_cpu_supported = Platform.ARM_CPU in supported_platform
|
692
688
|
|
693
689
|
return {
|
694
690
|
"compartment_id": model.compartment_id,
|
@@ -898,8 +894,7 @@ class AquaModelApp(AquaApp):
|
|
898
894
|
tags.update(
|
899
895
|
{
|
900
896
|
Tags.MODEL_FORMAT: ",".join(
|
901
|
-
model_format.
|
902
|
-
for model_format in validation_result.model_formats
|
897
|
+
model_format for model_format in validation_result.model_formats
|
903
898
|
)
|
904
899
|
}
|
905
900
|
)
|
@@ -936,9 +931,9 @@ class AquaModelApp(AquaApp):
|
|
936
931
|
category="Other",
|
937
932
|
)
|
938
933
|
|
939
|
-
inference_containers = (
|
940
|
-
|
941
|
-
)
|
934
|
+
inference_containers = AquaContainerConfig.from_container_index_json(
|
935
|
+
config=get_container_config()
|
936
|
+
).inference
|
942
937
|
smc_container_set = {
|
943
938
|
container.family for container in inference_containers.values()
|
944
939
|
}
|
@@ -1013,13 +1008,13 @@ class AquaModelApp(AquaApp):
|
|
1013
1008
|
return model
|
1014
1009
|
|
1015
1010
|
@staticmethod
|
1016
|
-
def get_model_files(os_path: str, model_format:
|
1011
|
+
def get_model_files(os_path: str, model_format: str) -> List[str]:
|
1017
1012
|
"""
|
1018
1013
|
Get a list of model files based on the given OS path and model format.
|
1019
1014
|
|
1020
1015
|
Args:
|
1021
1016
|
os_path (str): The OS path where the model files are located.
|
1022
|
-
model_format (
|
1017
|
+
model_format (str): The format of the model files.
|
1023
1018
|
|
1024
1019
|
Returns:
|
1025
1020
|
List[str]: A list of model file names.
|
@@ -1059,13 +1054,13 @@ class AquaModelApp(AquaApp):
|
|
1059
1054
|
return model_files
|
1060
1055
|
|
1061
1056
|
@staticmethod
|
1062
|
-
def get_hf_model_files(model_name: str, model_format:
|
1057
|
+
def get_hf_model_files(model_name: str, model_format: str) -> List[str]:
|
1063
1058
|
"""
|
1064
1059
|
Get a list of model files based on the given OS path and model format.
|
1065
1060
|
|
1066
1061
|
Args:
|
1067
1062
|
model_name (str): The huggingface model name.
|
1068
|
-
model_format (
|
1063
|
+
model_format (str): The format of the model files.
|
1069
1064
|
|
1070
1065
|
Returns:
|
1071
1066
|
List[str]: A list of model file names.
|
@@ -1097,7 +1092,7 @@ class AquaModelApp(AquaApp):
|
|
1097
1092
|
and model_sibling.rfilename == AQUA_MODEL_ARTIFACT_CONFIG
|
1098
1093
|
):
|
1099
1094
|
model_files.append(model_sibling.rfilename)
|
1100
|
-
if extension == model_format
|
1095
|
+
if extension == model_format:
|
1101
1096
|
model_files.append(model_sibling.rfilename)
|
1102
1097
|
|
1103
1098
|
logger.debug(
|
@@ -1152,8 +1147,8 @@ class AquaModelApp(AquaApp):
|
|
1152
1147
|
|
1153
1148
|
if not (safetensors_model_files or gguf_model_files):
|
1154
1149
|
raise AquaRuntimeError(
|
1155
|
-
f"The model {model_name} does not contain either {ModelFormat.SAFETENSORS
|
1156
|
-
f"or {ModelFormat.GGUF
|
1150
|
+
f"The model {model_name} does not contain either {ModelFormat.SAFETENSORS} "
|
1151
|
+
f"or {ModelFormat.GGUF} files in {import_model_details.os_path} or Hugging Face repository. "
|
1157
1152
|
f"Please check if the path is correct or the model artifacts are available at this location."
|
1158
1153
|
)
|
1159
1154
|
|
@@ -1261,7 +1256,7 @@ class AquaModelApp(AquaApp):
|
|
1261
1256
|
):
|
1262
1257
|
raise AquaRuntimeError(
|
1263
1258
|
f"The model {model_name} does not contain {AQUA_MODEL_ARTIFACT_CONFIG} file as required "
|
1264
|
-
f"by {ModelFormat.SAFETENSORS
|
1259
|
+
f"by {ModelFormat.SAFETENSORS} format model."
|
1265
1260
|
f" Please check if the model name is correct in Hugging Face repository."
|
1266
1261
|
)
|
1267
1262
|
validation_result.telemetry_model_name = model_name
|
@@ -7,10 +7,7 @@ from typing import Dict, List, Optional, Union
|
|
7
7
|
|
8
8
|
from ads.aqua.app import AquaApp, logger
|
9
9
|
from ads.aqua.common.entities import ContainerSpec
|
10
|
-
from ads.aqua.common.enums import
|
11
|
-
InferenceContainerTypeFamily,
|
12
|
-
Tags,
|
13
|
-
)
|
10
|
+
from ads.aqua.common.enums import InferenceContainerTypeFamily, ModelFormat, Tags
|
14
11
|
from ads.aqua.common.errors import AquaRuntimeError, AquaValueError
|
15
12
|
from ads.aqua.common.utils import (
|
16
13
|
get_combined_params,
|
@@ -30,19 +27,14 @@ from ads.aqua.constants import (
|
|
30
27
|
AQUA_MODEL_TYPE_CUSTOM,
|
31
28
|
AQUA_MODEL_TYPE_SERVICE,
|
32
29
|
MODEL_BY_REFERENCE_OSS_PATH_KEY,
|
33
|
-
UNKNOWN,
|
34
30
|
UNKNOWN_DICT,
|
35
31
|
)
|
36
32
|
from ads.aqua.data import AquaResourceIdentifier
|
37
33
|
from ads.aqua.finetuning.finetuning import FineTuneCustomMetadata
|
38
34
|
from ads.aqua.model import AquaModelApp
|
39
|
-
from ads.aqua.modeldeployment.entities import
|
40
|
-
AquaDeployment,
|
41
|
-
AquaDeploymentDetail,
|
42
|
-
)
|
43
|
-
from ads.aqua.ui import ModelFormat
|
35
|
+
from ads.aqua.modeldeployment.entities import AquaDeployment, AquaDeploymentDetail
|
44
36
|
from ads.common.object_storage_details import ObjectStorageDetails
|
45
|
-
from ads.common.utils import get_log_links
|
37
|
+
from ads.common.utils import UNKNOWN, get_log_links
|
46
38
|
from ads.config import (
|
47
39
|
AQUA_DEPLOYMENT_CONTAINER_CMD_VAR_METADATA_NAME,
|
48
40
|
AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME,
|
@@ -293,13 +285,13 @@ class AquaDeploymentApp(AquaApp):
|
|
293
285
|
)
|
294
286
|
|
295
287
|
model_formats_str = aqua_model.freeform_tags.get(
|
296
|
-
Tags.MODEL_FORMAT, ModelFormat.SAFETENSORS
|
288
|
+
Tags.MODEL_FORMAT, ModelFormat.SAFETENSORS
|
297
289
|
).upper()
|
298
290
|
model_format = model_formats_str.split(",")
|
299
291
|
|
300
292
|
# Figure out a better way to handle this in future release
|
301
293
|
if (
|
302
|
-
ModelFormat.GGUF
|
294
|
+
ModelFormat.GGUF in model_format
|
303
295
|
and container_type_key.lower()
|
304
296
|
== InferenceContainerTypeFamily.AQUA_LLAMA_CPP_CONTAINER_FAMILY
|
305
297
|
):
|
@@ -661,7 +653,7 @@ class AquaDeploymentApp(AquaApp):
|
|
661
653
|
Dict:
|
662
654
|
A dict of allowed deployment configs.
|
663
655
|
"""
|
664
|
-
config = self.get_config(model_id, AQUA_MODEL_DEPLOYMENT_CONFIG)
|
656
|
+
config = self.get_config(model_id, AQUA_MODEL_DEPLOYMENT_CONFIG).config
|
665
657
|
if not config:
|
666
658
|
logger.debug(
|
667
659
|
f"Deployment config for custom model: {model_id} is not available. Use defaults."
|
@@ -11,10 +11,10 @@ from oci.data_science.models import (
|
|
11
11
|
)
|
12
12
|
|
13
13
|
from ads.aqua.common.enums import Tags
|
14
|
-
from ads.aqua.constants import
|
14
|
+
from ads.aqua.constants import UNKNOWN_DICT
|
15
15
|
from ads.aqua.data import AquaResourceIdentifier
|
16
16
|
from ads.common.serializer import DataClassSerializable
|
17
|
-
from ads.common.utils import get_console_link
|
17
|
+
from ads.common.utils import UNKNOWN, get_console_link
|
18
18
|
|
19
19
|
|
20
20
|
@dataclass
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
|
3
|
+
# Copyright (c) 2025 Oracle and/or its affiliates.
|
4
|
+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
5
|
+
|
6
|
+
import os
|
7
|
+
from logging import getLogger
|
8
|
+
|
9
|
+
from dotenv import load_dotenv
|
10
|
+
|
11
|
+
from ads.aqua.server.app import start_server
|
12
|
+
|
13
|
+
logger = getLogger(__name__)
|
14
|
+
config_location = os.path.join(os.getcwd(), ".env")
|
15
|
+
if os.path.exists(config_location):
|
16
|
+
logger.info(f"Loading environment variables from {config_location}")
|
17
|
+
load_dotenv(dotenv_path=config_location)
|
18
|
+
logger.info("Environment variables loaded successfully")
|
19
|
+
else:
|
20
|
+
logger.warning(
|
21
|
+
f"{config_location} not found. Consider using `.env` file to setup default environment variables"
|
22
|
+
)
|
23
|
+
|
24
|
+
start_server()
|