oracle-ads 2.11.14__py3-none-any.whl → 2.11.16__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/common/entities.py +17 -0
- ads/aqua/common/enums.py +5 -1
- ads/aqua/common/utils.py +109 -22
- ads/aqua/config/config.py +1 -1
- ads/aqua/config/deployment_config_defaults.json +29 -1
- ads/aqua/config/resource_limit_names.json +1 -0
- ads/aqua/constants.py +35 -18
- ads/aqua/evaluation/entities.py +0 -1
- ads/aqua/evaluation/evaluation.py +165 -121
- ads/aqua/extension/common_ws_msg_handler.py +57 -0
- ads/aqua/extension/deployment_handler.py +14 -13
- ads/aqua/extension/deployment_ws_msg_handler.py +54 -0
- ads/aqua/extension/errors.py +1 -1
- ads/aqua/extension/evaluation_handler.py +4 -7
- ads/aqua/extension/evaluation_ws_msg_handler.py +28 -10
- ads/aqua/extension/model_handler.py +31 -6
- ads/aqua/extension/models/ws_models.py +78 -3
- ads/aqua/extension/models_ws_msg_handler.py +49 -0
- ads/aqua/extension/ui_websocket_handler.py +7 -1
- ads/aqua/model/entities.py +17 -9
- ads/aqua/model/model.py +260 -90
- ads/aqua/modeldeployment/constants.py +0 -16
- ads/aqua/modeldeployment/deployment.py +97 -74
- ads/aqua/modeldeployment/entities.py +9 -20
- ads/aqua/ui.py +152 -28
- ads/common/object_storage_details.py +2 -5
- ads/common/serializer.py +2 -3
- ads/jobs/builders/infrastructure/dsc_job.py +29 -3
- ads/jobs/builders/infrastructure/dsc_job_runtime.py +74 -27
- ads/jobs/builders/runtimes/container_runtime.py +83 -4
- ads/opctl/operator/common/operator_config.py +1 -0
- ads/opctl/operator/lowcode/anomaly/README.md +3 -3
- ads/opctl/operator/lowcode/anomaly/__main__.py +5 -6
- ads/opctl/operator/lowcode/anomaly/const.py +9 -0
- ads/opctl/operator/lowcode/anomaly/model/anomaly_dataset.py +6 -2
- ads/opctl/operator/lowcode/anomaly/model/base_model.py +51 -26
- ads/opctl/operator/lowcode/anomaly/model/factory.py +41 -13
- ads/opctl/operator/lowcode/anomaly/model/isolationforest.py +79 -0
- ads/opctl/operator/lowcode/anomaly/model/oneclasssvm.py +79 -0
- ads/opctl/operator/lowcode/anomaly/operator_config.py +1 -0
- ads/opctl/operator/lowcode/anomaly/schema.yaml +16 -2
- ads/opctl/operator/lowcode/anomaly/utils.py +16 -13
- ads/opctl/operator/lowcode/common/data.py +2 -1
- ads/opctl/operator/lowcode/common/errors.py +6 -0
- ads/opctl/operator/lowcode/common/transformations.py +37 -9
- ads/opctl/operator/lowcode/common/utils.py +32 -10
- ads/opctl/operator/lowcode/forecast/model/base_model.py +21 -13
- ads/opctl/operator/lowcode/forecast/model/ml_forecast.py +14 -18
- ads/opctl/operator/lowcode/forecast/model_evaluator.py +15 -4
- ads/opctl/operator/lowcode/forecast/schema.yaml +9 -0
- ads/opctl/operator/lowcode/recommender/MLoperator +16 -0
- ads/opctl/operator/lowcode/recommender/README.md +206 -0
- ads/opctl/operator/lowcode/recommender/__init__.py +5 -0
- ads/opctl/operator/lowcode/recommender/__main__.py +82 -0
- ads/opctl/operator/lowcode/recommender/cmd.py +33 -0
- ads/opctl/operator/lowcode/recommender/constant.py +25 -0
- ads/opctl/operator/lowcode/recommender/environment.yaml +11 -0
- ads/opctl/operator/lowcode/recommender/model/base_model.py +198 -0
- ads/opctl/operator/lowcode/recommender/model/factory.py +58 -0
- ads/opctl/operator/lowcode/recommender/model/recommender_dataset.py +25 -0
- ads/opctl/operator/lowcode/recommender/model/svd.py +88 -0
- ads/opctl/operator/lowcode/recommender/operator_config.py +81 -0
- ads/opctl/operator/lowcode/recommender/schema.yaml +265 -0
- ads/opctl/operator/lowcode/recommender/utils.py +13 -0
- ads/pipeline/ads_pipeline_run.py +13 -2
- {oracle_ads-2.11.14.dist-info → oracle_ads-2.11.16.dist-info}/METADATA +6 -1
- {oracle_ads-2.11.14.dist-info → oracle_ads-2.11.16.dist-info}/RECORD +70 -50
- {oracle_ads-2.11.14.dist-info → oracle_ads-2.11.16.dist-info}/LICENSE.txt +0 -0
- {oracle_ads-2.11.14.dist-info → oracle_ads-2.11.16.dist-info}/WHEEL +0 -0
- {oracle_ads-2.11.14.dist-info → oracle_ads-2.11.16.dist-info}/entry_points.txt +0 -0
@@ -1,34 +1,32 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
2
|
# Copyright (c) 2024 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
|
-
import json
|
7
5
|
import logging
|
8
|
-
from typing import Dict, List, Union
|
9
|
-
|
10
|
-
from oci.data_science.models import ModelDeployment
|
6
|
+
from typing import Dict, List, Optional, Union
|
11
7
|
|
12
8
|
from ads.aqua.app import AquaApp, logger
|
9
|
+
from ads.aqua.common.entities import ContainerSpec
|
13
10
|
from ads.aqua.common.enums import (
|
14
|
-
Tags,
|
15
|
-
InferenceContainerParamType,
|
16
|
-
InferenceContainerType,
|
17
11
|
InferenceContainerTypeFamily,
|
12
|
+
Tags,
|
18
13
|
)
|
19
14
|
from ads.aqua.common.errors import AquaRuntimeError, AquaValueError
|
20
15
|
from ads.aqua.common.utils import (
|
16
|
+
get_combined_params,
|
21
17
|
get_container_config,
|
22
18
|
get_container_image,
|
19
|
+
get_container_params_type,
|
23
20
|
get_model_by_reference_paths,
|
24
21
|
get_ocid_substring,
|
25
|
-
get_combined_params,
|
26
22
|
get_params_dict,
|
27
23
|
get_params_list,
|
28
24
|
get_resource_name,
|
25
|
+
get_restricted_params_by_container,
|
29
26
|
load_config,
|
30
27
|
)
|
31
28
|
from ads.aqua.constants import (
|
29
|
+
AQUA_MODEL_ARTIFACT_FILE,
|
32
30
|
AQUA_MODEL_TYPE_CUSTOM,
|
33
31
|
AQUA_MODEL_TYPE_SERVICE,
|
34
32
|
MODEL_BY_REFERENCE_OSS_PATH_KEY,
|
@@ -41,12 +39,8 @@ from ads.aqua.model import AquaModelApp
|
|
41
39
|
from ads.aqua.modeldeployment.entities import (
|
42
40
|
AquaDeployment,
|
43
41
|
AquaDeploymentDetail,
|
44
|
-
ContainerSpec,
|
45
|
-
)
|
46
|
-
from ads.aqua.modeldeployment.constants import (
|
47
|
-
VLLMInferenceRestrictedParams,
|
48
|
-
TGIInferenceRestrictedParams,
|
49
42
|
)
|
43
|
+
from ads.aqua.ui import ModelFormat
|
50
44
|
from ads.common.object_storage_details import ObjectStorageDetails
|
51
45
|
from ads.common.utils import get_log_links
|
52
46
|
from ads.config import (
|
@@ -110,6 +104,8 @@ class AquaDeploymentApp(AquaApp):
|
|
110
104
|
health_check_port: int = None,
|
111
105
|
env_var: Dict = None,
|
112
106
|
container_family: str = None,
|
107
|
+
memory_in_gbs: Optional[float] = None,
|
108
|
+
ocpus: Optional[float] = None,
|
113
109
|
) -> "AquaDeployment":
|
114
110
|
"""
|
115
111
|
Creates a new Aqua deployment
|
@@ -150,6 +146,10 @@ class AquaDeploymentApp(AquaApp):
|
|
150
146
|
Environment variable for the deployment, by default None.
|
151
147
|
container_family: str
|
152
148
|
The image family of model deployment container runtime. Required for unverified Aqua models.
|
149
|
+
memory_in_gbs: float
|
150
|
+
The memory in gbs for the shape selected.
|
151
|
+
ocpus: float
|
152
|
+
The ocpu count for the shape selected.
|
153
153
|
Returns
|
154
154
|
-------
|
155
155
|
AquaDeployment
|
@@ -187,24 +187,24 @@ class AquaDeploymentApp(AquaApp):
|
|
187
187
|
model_name = aqua_model.custom_metadata_list.get(
|
188
188
|
FineTuneCustomMetadata.FINE_TUNE_SOURCE_NAME
|
189
189
|
).value
|
190
|
-
except:
|
190
|
+
except ValueError as err:
|
191
191
|
raise AquaValueError(
|
192
192
|
f"Either {FineTuneCustomMetadata.FINE_TUNE_SOURCE} or {FineTuneCustomMetadata.FINE_TUNE_SOURCE_NAME} is missing "
|
193
193
|
f"from custom metadata for the model {config_source_id}"
|
194
|
-
)
|
194
|
+
) from err
|
195
195
|
|
196
196
|
# set up env vars
|
197
197
|
if not env_var:
|
198
|
-
env_var =
|
198
|
+
env_var = {}
|
199
199
|
|
200
200
|
try:
|
201
201
|
model_path_prefix = aqua_model.custom_metadata_list.get(
|
202
202
|
MODEL_BY_REFERENCE_OSS_PATH_KEY
|
203
203
|
).value.rstrip("/")
|
204
|
-
except ValueError:
|
204
|
+
except ValueError as err:
|
205
205
|
raise AquaValueError(
|
206
206
|
f"{MODEL_BY_REFERENCE_OSS_PATH_KEY} key is not available in the custom metadata field."
|
207
|
-
)
|
207
|
+
) from err
|
208
208
|
|
209
209
|
if ObjectStorageDetails.is_oci_path(model_path_prefix):
|
210
210
|
os_path = ObjectStorageDetails.from_path(model_path_prefix)
|
@@ -212,6 +212,21 @@ class AquaDeploymentApp(AquaApp):
|
|
212
212
|
|
213
213
|
env_var.update({"BASE_MODEL": f"{model_path_prefix}"})
|
214
214
|
|
215
|
+
model_format = aqua_model.freeform_tags.get(
|
216
|
+
Tags.MODEL_FORMAT, ModelFormat.SAFETENSORS.value
|
217
|
+
).upper()
|
218
|
+
if model_format == ModelFormat.GGUF.value:
|
219
|
+
try:
|
220
|
+
model_file = aqua_model.custom_metadata_list.get(
|
221
|
+
AQUA_MODEL_ARTIFACT_FILE
|
222
|
+
).value
|
223
|
+
except ValueError as err:
|
224
|
+
raise AquaValueError(
|
225
|
+
f"{AQUA_MODEL_ARTIFACT_FILE} key is not available in the custom metadata field "
|
226
|
+
f"for model {aqua_model.id}."
|
227
|
+
) from err
|
228
|
+
env_var.update({"BASE_MODEL_FILE": f"{model_file}"})
|
229
|
+
|
215
230
|
if is_fine_tuned_model:
|
216
231
|
_, fine_tune_output_path = get_model_by_reference_paths(
|
217
232
|
aqua_model.model_file_description
|
@@ -219,7 +234,7 @@ class AquaDeploymentApp(AquaApp):
|
|
219
234
|
|
220
235
|
if not fine_tune_output_path:
|
221
236
|
raise AquaValueError(
|
222
|
-
|
237
|
+
"Fine tuned output path is not available in the model artifact."
|
223
238
|
)
|
224
239
|
|
225
240
|
os_path = ObjectStorageDetails.from_path(fine_tune_output_path)
|
@@ -232,7 +247,7 @@ class AquaDeploymentApp(AquaApp):
|
|
232
247
|
container_type_key = aqua_model.custom_metadata_list.get(
|
233
248
|
AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME
|
234
249
|
).value
|
235
|
-
except ValueError:
|
250
|
+
except ValueError as err:
|
236
251
|
message = (
|
237
252
|
f"{AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME} key is not available in the custom metadata field "
|
238
253
|
f"for model {aqua_model.id}."
|
@@ -242,7 +257,7 @@ class AquaDeploymentApp(AquaApp):
|
|
242
257
|
raise AquaValueError(
|
243
258
|
f"{message}. For unverified Aqua models, container_family parameter should be "
|
244
259
|
f"set and value can be one of {', '.join(InferenceContainerTypeFamily.values())}."
|
245
|
-
)
|
260
|
+
) from err
|
246
261
|
container_type_key = container_family
|
247
262
|
try:
|
248
263
|
# Check if the container override flag is set. If set, then the user has chosen custom image
|
@@ -266,8 +281,10 @@ class AquaDeploymentApp(AquaApp):
|
|
266
281
|
f"Aqua Image used for deploying {aqua_model.id} : {container_image}"
|
267
282
|
)
|
268
283
|
|
284
|
+
# todo: use AquaContainerConfig.from_container_index_json instead.
|
269
285
|
# Fetch the startup cli command for the container
|
270
|
-
# container_index.json will have "containerSpec" section which will provide the cli params for
|
286
|
+
# container_index.json will have "containerSpec" section which will provide the cli params for
|
287
|
+
# a given container family
|
271
288
|
container_config = get_container_config()
|
272
289
|
container_spec = container_config.get(ContainerSpec.CONTAINER_SPEC, {}).get(
|
273
290
|
container_type_key, {}
|
@@ -282,16 +299,29 @@ class AquaDeploymentApp(AquaApp):
|
|
282
299
|
) # Give precendece to the input parameter
|
283
300
|
|
284
301
|
deployment_config = self.get_deployment_config(config_source_id)
|
285
|
-
|
302
|
+
|
303
|
+
config_params = (
|
286
304
|
deployment_config.get("configuration", UNKNOWN_DICT)
|
287
305
|
.get(instance_shape, UNKNOWN_DICT)
|
288
306
|
.get("parameters", UNKNOWN_DICT)
|
289
|
-
.get(
|
307
|
+
.get(get_container_params_type(container_type_key), UNKNOWN)
|
290
308
|
)
|
291
309
|
|
292
310
|
# validate user provided params
|
293
311
|
user_params = env_var.get("PARAMS", UNKNOWN)
|
294
312
|
if user_params:
|
313
|
+
# todo: remove this check in the future version, logic to be moved to container_index
|
314
|
+
if (
|
315
|
+
container_type_key.lower()
|
316
|
+
== InferenceContainerTypeFamily.AQUA_LLAMA_CPP_CONTAINER_FAMILY
|
317
|
+
):
|
318
|
+
# AQUA_LLAMA_CPP_CONTAINER_FAMILY container uses uvicorn that required model/server params
|
319
|
+
# to be set as env vars
|
320
|
+
raise AquaValueError(
|
321
|
+
f"Currently, parameters cannot be overridden for the container: {container_image}. Please proceed "
|
322
|
+
f"with deployment without parameter overrides."
|
323
|
+
)
|
324
|
+
|
295
325
|
restricted_params = self._find_restricted_params(
|
296
326
|
params, user_params, container_type_key
|
297
327
|
)
|
@@ -301,15 +331,17 @@ class AquaDeploymentApp(AquaApp):
|
|
301
331
|
f"and cannot be overridden or are invalid."
|
302
332
|
)
|
303
333
|
|
304
|
-
deployment_params = get_combined_params(
|
334
|
+
deployment_params = get_combined_params(config_params, user_params)
|
305
335
|
|
306
|
-
|
307
|
-
|
336
|
+
params = f"{params} {deployment_params}".strip()
|
337
|
+
if params:
|
338
|
+
env_var.update({"PARAMS": params})
|
308
339
|
|
309
|
-
env_var.update({"PARAMS": params})
|
310
340
|
for env in container_spec.get(ContainerSpec.ENV_VARS, []):
|
311
341
|
if isinstance(env, dict):
|
312
|
-
|
342
|
+
for key, _items in env.items():
|
343
|
+
if key not in env_var:
|
344
|
+
env_var.update(env)
|
313
345
|
|
314
346
|
logging.info(f"Env vars used for deploying {aqua_model.id} :{env_var}")
|
315
347
|
|
@@ -332,6 +364,11 @@ class AquaDeploymentApp(AquaApp):
|
|
332
364
|
log_id=predict_log_id,
|
333
365
|
)
|
334
366
|
)
|
367
|
+
if memory_in_gbs and ocpus and infrastructure.shape_name.endswith("Flex"):
|
368
|
+
infrastructure.with_shape_config_details(
|
369
|
+
ocpus=ocpus,
|
370
|
+
memory_in_gbs=memory_in_gbs,
|
371
|
+
)
|
335
372
|
# configure model deployment runtime
|
336
373
|
container_runtime = (
|
337
374
|
ModelDeploymentContainerRuntime()
|
@@ -345,6 +382,7 @@ class AquaDeploymentApp(AquaApp):
|
|
345
382
|
.with_overwrite_existing_artifact(True)
|
346
383
|
.with_remove_existing_artifact(True)
|
347
384
|
)
|
385
|
+
|
348
386
|
# configure model deployment and deploy model on container runtime
|
349
387
|
deployment = (
|
350
388
|
ModelDeployment()
|
@@ -429,7 +467,7 @@ class AquaDeploymentApp(AquaApp):
|
|
429
467
|
# tracks unique deployments that were listed in the user compartment
|
430
468
|
# we arbitrarily choose last 8 characters of OCID to identify MD in telemetry
|
431
469
|
self.telemetry.record_event_async(
|
432
|
-
category=
|
470
|
+
category="aqua/deployment",
|
433
471
|
action="list",
|
434
472
|
detail=get_ocid_substring(deployment_id, key_len=8),
|
435
473
|
value=state,
|
@@ -570,32 +608,27 @@ class AquaDeploymentApp(AquaApp):
|
|
570
608
|
f"{AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME} key is not available in the custom metadata field for model {model_id}."
|
571
609
|
)
|
572
610
|
|
573
|
-
if
|
574
|
-
container_type_key
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
611
|
+
if (
|
612
|
+
container_type_key
|
613
|
+
and container_type_key in InferenceContainerTypeFamily.values()
|
614
|
+
):
|
615
|
+
deployment_config = self.get_deployment_config(model_id)
|
616
|
+
config_params = (
|
617
|
+
deployment_config.get("configuration", UNKNOWN_DICT)
|
618
|
+
.get(instance_shape, UNKNOWN_DICT)
|
619
|
+
.get("parameters", UNKNOWN_DICT)
|
620
|
+
.get(get_container_params_type(container_type_key), UNKNOWN)
|
621
|
+
)
|
622
|
+
if config_params:
|
623
|
+
params_list = get_params_list(config_params)
|
624
|
+
restricted_params_set = get_restricted_params_by_container(
|
625
|
+
container_type_key
|
581
626
|
)
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
)
|
586
|
-
|
587
|
-
params = config_parameters.get(
|
588
|
-
InferenceContainerParamType.PARAM_TYPE_TGI, UNKNOWN
|
589
|
-
)
|
590
|
-
else:
|
591
|
-
params = UNKNOWN
|
592
|
-
logger.debug(
|
593
|
-
f"Default inference parameters are not available for the model {model_id} and "
|
594
|
-
f"instance {instance_shape}."
|
595
|
-
)
|
596
|
-
if params:
|
597
|
-
# account for param that can have --arg but no values, e.g. --trust-remote-code
|
598
|
-
default_params.extend(get_params_list(params))
|
627
|
+
|
628
|
+
# remove restricted params from the list as user cannot override them during deployment
|
629
|
+
for params in params_list:
|
630
|
+
if params.split()[0] not in restricted_params_set:
|
631
|
+
default_params.append(params)
|
599
632
|
|
600
633
|
return default_params
|
601
634
|
|
@@ -629,7 +662,7 @@ class AquaDeploymentApp(AquaApp):
|
|
629
662
|
container_type_key = model.custom_metadata_list.get(
|
630
663
|
AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME
|
631
664
|
).value
|
632
|
-
except ValueError:
|
665
|
+
except ValueError as err:
|
633
666
|
message = (
|
634
667
|
f"{AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME} key is not available in the custom metadata field "
|
635
668
|
f"for model {model_id}."
|
@@ -640,7 +673,7 @@ class AquaDeploymentApp(AquaApp):
|
|
640
673
|
raise AquaValueError(
|
641
674
|
f"{message}. For unverified Aqua models, container_family parameter should be "
|
642
675
|
f"set and value can be one of {', '.join(InferenceContainerTypeFamily.values())}."
|
643
|
-
)
|
676
|
+
) from err
|
644
677
|
container_type_key = container_family
|
645
678
|
|
646
679
|
container_config = get_container_config()
|
@@ -658,7 +691,7 @@ class AquaDeploymentApp(AquaApp):
|
|
658
691
|
f"Parameters {restricted_params} are set by Aqua "
|
659
692
|
f"and cannot be overridden or are invalid."
|
660
693
|
)
|
661
|
-
return
|
694
|
+
return {"valid": True}
|
662
695
|
|
663
696
|
@staticmethod
|
664
697
|
def _find_restricted_params(
|
@@ -667,8 +700,7 @@ class AquaDeploymentApp(AquaApp):
|
|
667
700
|
container_family: str,
|
668
701
|
) -> List[str]:
|
669
702
|
"""Returns a list of restricted params that user chooses to override when creating an Aqua deployment.
|
670
|
-
The default parameters coming from the container index json file cannot be overridden.
|
671
|
-
a set of parameters maintained in
|
703
|
+
The default parameters coming from the container index json file cannot be overridden.
|
672
704
|
|
673
705
|
Parameters
|
674
706
|
----------
|
@@ -689,18 +721,9 @@ class AquaDeploymentApp(AquaApp):
|
|
689
721
|
default_params_dict = get_params_dict(default_params)
|
690
722
|
user_params_dict = get_params_dict(user_params)
|
691
723
|
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
InferenceContainerType.CONTAINER_TYPE_VLLM in container_family
|
697
|
-
and key in VLLMInferenceRestrictedParams
|
698
|
-
)
|
699
|
-
or (
|
700
|
-
InferenceContainerType.CONTAINER_TYPE_TGI in container_family
|
701
|
-
and key in TGIInferenceRestrictedParams
|
702
|
-
)
|
703
|
-
):
|
704
|
-
restricted_params.append(key.lstrip("--"))
|
724
|
+
restricted_params_set = get_restricted_params_by_container(container_family)
|
725
|
+
for key, _items in user_params_dict.items():
|
726
|
+
if key in default_params_dict or key in restricted_params_set:
|
727
|
+
restricted_params.append(key.lstrip("-"))
|
705
728
|
|
706
729
|
return restricted_params
|
@@ -1,12 +1,14 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
2
|
# Copyright (c) 2024 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
|
from dataclasses import dataclass, field
|
7
6
|
from typing import Union
|
8
7
|
|
9
|
-
from oci.data_science.models import
|
8
|
+
from oci.data_science.models import (
|
9
|
+
ModelDeployment,
|
10
|
+
ModelDeploymentSummary,
|
11
|
+
)
|
10
12
|
|
11
13
|
from ads.aqua.common.enums import Tags
|
12
14
|
from ads.aqua.constants import UNKNOWN, UNKNOWN_DICT
|
@@ -24,18 +26,6 @@ class ModelParams:
|
|
24
26
|
model: str = None
|
25
27
|
|
26
28
|
|
27
|
-
class ContainerSpec:
|
28
|
-
"""
|
29
|
-
Class to hold to hold keys within the container spec.
|
30
|
-
"""
|
31
|
-
|
32
|
-
CONTAINER_SPEC = "containerSpec"
|
33
|
-
CLI_PARM = "cliParam"
|
34
|
-
SERVER_PORT = "serverPort"
|
35
|
-
HEALTH_CHECK_PORT = "healthCheckPort"
|
36
|
-
ENV_VARS = "envVars"
|
37
|
-
|
38
|
-
|
39
29
|
@dataclass
|
40
30
|
class ShapeInfo:
|
41
31
|
instance_shape: str = None
|
@@ -61,6 +51,7 @@ class AquaDeployment(DataClassSerializable):
|
|
61
51
|
lifecycle_details: str = None
|
62
52
|
shape_info: field(default_factory=ShapeInfo) = None
|
63
53
|
tags: dict = None
|
54
|
+
environment_variables: dict = None
|
64
55
|
|
65
56
|
@classmethod
|
66
57
|
def from_oci_model_deployment(
|
@@ -83,15 +74,12 @@ class AquaDeployment(DataClassSerializable):
|
|
83
74
|
AquaDeployment:
|
84
75
|
The instance of the Aqua model deployment.
|
85
76
|
"""
|
86
|
-
instance_configuration =
|
87
|
-
oci_model_deployment.model_deployment_configuration_details.model_configuration_details.instance_configuration
|
88
|
-
)
|
77
|
+
instance_configuration = oci_model_deployment.model_deployment_configuration_details.model_configuration_details.instance_configuration
|
89
78
|
instance_shape_config_details = (
|
90
79
|
instance_configuration.model_deployment_instance_shape_config_details
|
91
80
|
)
|
92
|
-
instance_count =
|
93
|
-
|
94
|
-
)
|
81
|
+
instance_count = oci_model_deployment.model_deployment_configuration_details.model_configuration_details.scaling_policy.instance_count
|
82
|
+
environment_variables = oci_model_deployment.model_deployment_configuration_details.environment_configuration_details.environment_variables
|
95
83
|
shape_info = ShapeInfo(
|
96
84
|
instance_shape=instance_configuration.instance_shape_name,
|
97
85
|
instance_count=instance_count,
|
@@ -131,6 +119,7 @@ class AquaDeployment(DataClassSerializable):
|
|
131
119
|
region=region,
|
132
120
|
),
|
133
121
|
tags=freeform_tags,
|
122
|
+
environment_variables=environment_variables,
|
134
123
|
)
|
135
124
|
|
136
125
|
|