oracle-ads 2.12.2__py3-none-any.whl → 2.12.3__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/enums.py +9 -0
- ads/aqua/common/utils.py +83 -6
- ads/aqua/config/config.py +0 -16
- ads/aqua/constants.py +2 -0
- ads/aqua/extension/deployment_handler.py +2 -0
- ads/aqua/extension/finetune_handler.py +1 -2
- ads/aqua/extension/ui_handler.py +22 -3
- ads/aqua/finetuning/entities.py +5 -4
- ads/aqua/finetuning/finetuning.py +13 -8
- ads/aqua/model/constants.py +1 -0
- ads/aqua/model/entities.py +2 -0
- ads/aqua/model/model.py +223 -138
- ads/aqua/modeldeployment/deployment.py +106 -62
- ads/aqua/modeldeployment/entities.py +10 -2
- ads/aqua/ui.py +29 -16
- ads/config.py +3 -8
- ads/llm/deploy.py +6 -0
- ads/llm/guardrails/base.py +0 -1
- ads/llm/langchain/plugins/chat_models/oci_data_science.py +118 -41
- ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +18 -14
- ads/llm/templates/score_chain.jinja2 +0 -1
- ads/model/datascience_model.py +519 -16
- ads/model/deployment/model_deployment.py +13 -0
- ads/model/deployment/model_deployment_infrastructure.py +34 -0
- ads/model/generic_model.py +10 -0
- ads/model/model_properties.py +1 -0
- ads/model/service/oci_datascience_model.py +28 -0
- ads/opctl/operator/lowcode/anomaly/const.py +66 -1
- ads/opctl/operator/lowcode/anomaly/model/anomaly_merlion.py +161 -0
- ads/opctl/operator/lowcode/anomaly/model/autots.py +30 -15
- ads/opctl/operator/lowcode/anomaly/model/factory.py +15 -3
- ads/opctl/operator/lowcode/anomaly/model/randomcutforest.py +1 -1
- ads/opctl/operator/lowcode/anomaly/schema.yaml +10 -0
- ads/opctl/operator/lowcode/anomaly/utils.py +3 -0
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.3.dist-info}/METADATA +2 -1
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.3.dist-info}/RECORD +39 -40
- ads/aqua/config/deployment_config_defaults.json +0 -38
- ads/aqua/config/resource_limit_names.json +0 -9
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.3.dist-info}/LICENSE.txt +0 -0
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.3.dist-info}/WHEEL +0 -0
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.3.dist-info}/entry_points.txt +0 -0
@@ -3,6 +3,7 @@
|
|
3
3
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
4
4
|
|
5
5
|
import logging
|
6
|
+
import shlex
|
6
7
|
from typing import Dict, List, Optional, Union
|
7
8
|
|
8
9
|
from ads.aqua.app import AquaApp, logger
|
@@ -23,7 +24,7 @@ from ads.aqua.common.utils import (
|
|
23
24
|
get_params_list,
|
24
25
|
get_resource_name,
|
25
26
|
get_restricted_params_by_container,
|
26
|
-
|
27
|
+
validate_cmd_var,
|
27
28
|
)
|
28
29
|
from ads.aqua.constants import (
|
29
30
|
AQUA_MODEL_ARTIFACT_FILE,
|
@@ -44,11 +45,10 @@ from ads.aqua.ui import ModelFormat
|
|
44
45
|
from ads.common.object_storage_details import ObjectStorageDetails
|
45
46
|
from ads.common.utils import get_log_links
|
46
47
|
from ads.config import (
|
47
|
-
|
48
|
+
AQUA_DEPLOYMENT_CONTAINER_CMD_VAR_METADATA_NAME,
|
48
49
|
AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME,
|
49
|
-
|
50
|
+
AQUA_DEPLOYMENT_CONTAINER_URI_METADATA_NAME,
|
50
51
|
AQUA_MODEL_DEPLOYMENT_CONFIG,
|
51
|
-
AQUA_MODEL_DEPLOYMENT_CONFIG_DEFAULTS,
|
52
52
|
COMPARTMENT_OCID,
|
53
53
|
)
|
54
54
|
from ads.model.datascience_model import DataScienceModel
|
@@ -87,26 +87,29 @@ class AquaDeploymentApp(AquaApp):
|
|
87
87
|
|
88
88
|
@telemetry(entry_point="plugin=deployment&action=create", name="aqua")
|
89
89
|
def create(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
90
|
+
self,
|
91
|
+
model_id: str,
|
92
|
+
instance_shape: str,
|
93
|
+
display_name: str,
|
94
|
+
instance_count: int = None,
|
95
|
+
log_group_id: str = None,
|
96
|
+
access_log_id: str = None,
|
97
|
+
predict_log_id: str = None,
|
98
|
+
compartment_id: str = None,
|
99
|
+
project_id: str = None,
|
100
|
+
description: str = None,
|
101
|
+
bandwidth_mbps: int = None,
|
102
|
+
web_concurrency: int = None,
|
103
|
+
server_port: int = None,
|
104
|
+
health_check_port: int = None,
|
105
|
+
env_var: Dict = None,
|
106
|
+
container_family: str = None,
|
107
|
+
memory_in_gbs: Optional[float] = None,
|
108
|
+
ocpus: Optional[float] = None,
|
109
|
+
model_file: Optional[str] = None,
|
110
|
+
private_endpoint_id: Optional[str] = None,
|
111
|
+
container_image_uri: Optional[None] = None,
|
112
|
+
cmd_var: List[str] = None,
|
110
113
|
) -> "AquaDeployment":
|
111
114
|
"""
|
112
115
|
Creates a new Aqua deployment
|
@@ -153,6 +156,13 @@ class AquaDeploymentApp(AquaApp):
|
|
153
156
|
The ocpu count for the shape selected.
|
154
157
|
model_file: str
|
155
158
|
The file used for model deployment.
|
159
|
+
private_endpoint_id: str
|
160
|
+
The private endpoint id of model deployment.
|
161
|
+
container_image_uri: str
|
162
|
+
The image of model deployment container runtime, ignored for service managed containers.
|
163
|
+
Required parameter for BYOC based deployments if this parameter was not set during model registration.
|
164
|
+
cmd_var: List[str]
|
165
|
+
The cmd of model deployment container runtime.
|
156
166
|
Returns
|
157
167
|
-------
|
158
168
|
AquaDeployment
|
@@ -175,6 +185,7 @@ class AquaDeploymentApp(AquaApp):
|
|
175
185
|
tags[tag] = aqua_model.freeform_tags[tag]
|
176
186
|
|
177
187
|
tags.update({Tags.AQUA_MODEL_NAME_TAG: aqua_model.display_name})
|
188
|
+
tags.update({Tags.TASK: aqua_model.freeform_tags.get(Tags.TASK, None)})
|
178
189
|
|
179
190
|
# Set up info to get deployment config
|
180
191
|
config_source_id = model_id
|
@@ -196,9 +207,11 @@ class AquaDeploymentApp(AquaApp):
|
|
196
207
|
f"from custom metadata for the model {config_source_id}"
|
197
208
|
) from err
|
198
209
|
|
199
|
-
# set up env
|
210
|
+
# set up env and cmd var
|
200
211
|
if not env_var:
|
201
212
|
env_var = {}
|
213
|
+
if not cmd_var:
|
214
|
+
cmd_var = []
|
202
215
|
|
203
216
|
try:
|
204
217
|
model_path_prefix = aqua_model.custom_metadata_list.get(
|
@@ -231,24 +244,56 @@ class AquaDeploymentApp(AquaApp):
|
|
231
244
|
env_var.update({"FT_MODEL": f"{fine_tune_output_path}"})
|
232
245
|
|
233
246
|
container_type_key = self._get_container_type_key(
|
234
|
-
model=aqua_model,
|
235
|
-
container_family=container_family
|
247
|
+
model=aqua_model, container_family=container_family
|
236
248
|
)
|
237
249
|
|
238
|
-
|
239
|
-
|
240
|
-
|
250
|
+
container_image_uri = container_image_uri or get_container_image(
|
251
|
+
container_type=container_type_key
|
252
|
+
)
|
253
|
+
if not container_image_uri:
|
254
|
+
try:
|
255
|
+
container_image_uri = aqua_model.custom_metadata_list.get(
|
256
|
+
AQUA_DEPLOYMENT_CONTAINER_URI_METADATA_NAME
|
257
|
+
).value
|
258
|
+
except ValueError as err:
|
259
|
+
raise AquaValueError(
|
260
|
+
f"{AQUA_DEPLOYMENT_CONTAINER_URI_METADATA_NAME} key is not available in the custom metadata "
|
261
|
+
f"field. Either re-register the model with custom container URI, or set container_image_uri "
|
262
|
+
f"parameter when creating this deployment."
|
263
|
+
) from err
|
241
264
|
logging.info(
|
242
|
-
f"Aqua Image used for deploying {aqua_model.id} : {
|
265
|
+
f"Aqua Image used for deploying {aqua_model.id} : {container_image_uri}"
|
243
266
|
)
|
244
267
|
|
268
|
+
try:
|
269
|
+
cmd_var_string = aqua_model.custom_metadata_list.get(
|
270
|
+
AQUA_DEPLOYMENT_CONTAINER_CMD_VAR_METADATA_NAME
|
271
|
+
).value
|
272
|
+
default_cmd_var = shlex.split(cmd_var_string)
|
273
|
+
if default_cmd_var:
|
274
|
+
cmd_var = validate_cmd_var(default_cmd_var, cmd_var)
|
275
|
+
logging.info(f"CMD used for deploying {aqua_model.id} :{cmd_var}")
|
276
|
+
except ValueError:
|
277
|
+
logging.debug(
|
278
|
+
f"CMD will be ignored for this deployment as {AQUA_DEPLOYMENT_CONTAINER_CMD_VAR_METADATA_NAME} "
|
279
|
+
f"key is not available in the custom metadata field for this model."
|
280
|
+
)
|
281
|
+
except Exception as e:
|
282
|
+
logging.error(
|
283
|
+
f"There was an issue processing CMD arguments. Error: {str(e)}"
|
284
|
+
)
|
285
|
+
|
245
286
|
model_formats_str = aqua_model.freeform_tags.get(
|
246
287
|
Tags.MODEL_FORMAT, ModelFormat.SAFETENSORS.value
|
247
288
|
).upper()
|
248
289
|
model_format = model_formats_str.split(",")
|
249
290
|
|
250
291
|
# Figure out a better way to handle this in future release
|
251
|
-
if
|
292
|
+
if (
|
293
|
+
ModelFormat.GGUF.value in model_format
|
294
|
+
and container_type_key.lower()
|
295
|
+
== InferenceContainerTypeFamily.AQUA_LLAMA_CPP_CONTAINER_FAMILY
|
296
|
+
):
|
252
297
|
if model_file is not None:
|
253
298
|
logger.info(
|
254
299
|
f"Overriding {model_file} as model_file for model {aqua_model.id}."
|
@@ -299,13 +344,13 @@ class AquaDeploymentApp(AquaApp):
|
|
299
344
|
if user_params:
|
300
345
|
# todo: remove this check in the future version, logic to be moved to container_index
|
301
346
|
if (
|
302
|
-
|
303
|
-
|
347
|
+
container_type_key.lower()
|
348
|
+
== InferenceContainerTypeFamily.AQUA_LLAMA_CPP_CONTAINER_FAMILY
|
304
349
|
):
|
305
350
|
# AQUA_LLAMA_CPP_CONTAINER_FAMILY container uses uvicorn that required model/server params
|
306
351
|
# to be set as env vars
|
307
352
|
raise AquaValueError(
|
308
|
-
f"Currently, parameters cannot be overridden for the container: {
|
353
|
+
f"Currently, parameters cannot be overridden for the container: {container_image_uri}. Please proceed "
|
309
354
|
f"with deployment without parameter overrides."
|
310
355
|
)
|
311
356
|
|
@@ -342,6 +387,7 @@ class AquaDeploymentApp(AquaApp):
|
|
342
387
|
.with_bandwidth_mbps(bandwidth_mbps)
|
343
388
|
.with_replica(instance_count)
|
344
389
|
.with_web_concurrency(web_concurrency)
|
390
|
+
.with_private_endpoint_id(private_endpoint_id)
|
345
391
|
.with_access_log(
|
346
392
|
log_group_id=log_group_id,
|
347
393
|
log_id=access_log_id,
|
@@ -359,7 +405,7 @@ class AquaDeploymentApp(AquaApp):
|
|
359
405
|
# configure model deployment runtime
|
360
406
|
container_runtime = (
|
361
407
|
ModelDeploymentContainerRuntime()
|
362
|
-
.with_image(
|
408
|
+
.with_image(container_image_uri)
|
363
409
|
.with_server_port(server_port)
|
364
410
|
.with_health_check_port(health_check_port)
|
365
411
|
.with_env(env_var)
|
@@ -369,6 +415,8 @@ class AquaDeploymentApp(AquaApp):
|
|
369
415
|
.with_overwrite_existing_artifact(True)
|
370
416
|
.with_remove_existing_artifact(True)
|
371
417
|
)
|
418
|
+
if cmd_var:
|
419
|
+
container_runtime.with_cmd(cmd_var)
|
372
420
|
|
373
421
|
# configure model deployment and deploy model on container runtime
|
374
422
|
deployment = (
|
@@ -422,9 +470,8 @@ class AquaDeploymentApp(AquaApp):
|
|
422
470
|
f"for model {model.id}. For unverified Aqua models, {AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME} should be"
|
423
471
|
f"set and value can be one of {', '.join(InferenceContainerTypeFamily.values())}."
|
424
472
|
) from err
|
425
|
-
|
473
|
+
|
426
474
|
return container_type_key
|
427
|
-
|
428
475
|
|
429
476
|
@telemetry(entry_point="plugin=deployment&action=list", name="aqua")
|
430
477
|
def list(self, **kwargs) -> List["AquaDeployment"]:
|
@@ -453,8 +500,8 @@ class AquaDeploymentApp(AquaApp):
|
|
453
500
|
for model_deployment in model_deployments:
|
454
501
|
oci_aqua = (
|
455
502
|
(
|
456
|
-
|
457
|
-
|
503
|
+
Tags.AQUA_TAG in model_deployment.freeform_tags
|
504
|
+
or Tags.AQUA_TAG.lower() in model_deployment.freeform_tags
|
458
505
|
)
|
459
506
|
if model_deployment.freeform_tags
|
460
507
|
else False
|
@@ -508,8 +555,8 @@ class AquaDeploymentApp(AquaApp):
|
|
508
555
|
|
509
556
|
oci_aqua = (
|
510
557
|
(
|
511
|
-
|
512
|
-
|
558
|
+
Tags.AQUA_TAG in model_deployment.freeform_tags
|
559
|
+
or Tags.AQUA_TAG.lower() in model_deployment.freeform_tags
|
513
560
|
)
|
514
561
|
if model_deployment.freeform_tags
|
515
562
|
else False
|
@@ -526,8 +573,8 @@ class AquaDeploymentApp(AquaApp):
|
|
526
573
|
log_group_name = ""
|
527
574
|
|
528
575
|
logs = (
|
529
|
-
|
530
|
-
|
576
|
+
model_deployment.category_log_details.access
|
577
|
+
or model_deployment.category_log_details.predict
|
531
578
|
)
|
532
579
|
if logs:
|
533
580
|
log_id = logs.log_id
|
@@ -574,17 +621,15 @@ class AquaDeploymentApp(AquaApp):
|
|
574
621
|
"""
|
575
622
|
config = self.get_config(model_id, AQUA_MODEL_DEPLOYMENT_CONFIG)
|
576
623
|
if not config:
|
577
|
-
logger.
|
578
|
-
|
579
|
-
AQUA_CONFIG_FOLDER,
|
580
|
-
config_file_name=AQUA_MODEL_DEPLOYMENT_CONFIG_DEFAULTS,
|
624
|
+
logger.debug(
|
625
|
+
f"Deployment config for custom model: {model_id} is not available."
|
581
626
|
)
|
582
627
|
return config
|
583
628
|
|
584
629
|
def get_deployment_default_params(
|
585
|
-
|
586
|
-
|
587
|
-
|
630
|
+
self,
|
631
|
+
model_id: str,
|
632
|
+
instance_shape: str,
|
588
633
|
) -> List[str]:
|
589
634
|
"""Gets the default params set in the deployment configs for the given model and instance shape.
|
590
635
|
|
@@ -616,8 +661,8 @@ class AquaDeploymentApp(AquaApp):
|
|
616
661
|
)
|
617
662
|
|
618
663
|
if (
|
619
|
-
|
620
|
-
|
664
|
+
container_type_key
|
665
|
+
and container_type_key in InferenceContainerTypeFamily.values()
|
621
666
|
):
|
622
667
|
deployment_config = self.get_deployment_config(model_id)
|
623
668
|
config_params = (
|
@@ -640,10 +685,10 @@ class AquaDeploymentApp(AquaApp):
|
|
640
685
|
return default_params
|
641
686
|
|
642
687
|
def validate_deployment_params(
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
688
|
+
self,
|
689
|
+
model_id: str,
|
690
|
+
params: List[str] = None,
|
691
|
+
container_family: str = None,
|
647
692
|
) -> Dict:
|
648
693
|
"""Validate if the deployment parameters passed by the user can be overridden. Parameter values are not
|
649
694
|
validated, only param keys are validated.
|
@@ -666,8 +711,7 @@ class AquaDeploymentApp(AquaApp):
|
|
666
711
|
if params:
|
667
712
|
model = DataScienceModel.from_id(model_id)
|
668
713
|
container_type_key = self._get_container_type_key(
|
669
|
-
model=model,
|
670
|
-
container_family=container_family
|
714
|
+
model=model, container_family=container_family
|
671
715
|
)
|
672
716
|
|
673
717
|
container_config = get_container_config()
|
@@ -689,9 +733,9 @@ class AquaDeploymentApp(AquaApp):
|
|
689
733
|
|
690
734
|
@staticmethod
|
691
735
|
def _find_restricted_params(
|
692
|
-
|
693
|
-
|
694
|
-
|
736
|
+
default_params: Union[str, List[str]],
|
737
|
+
user_params: Union[str, List[str]],
|
738
|
+
container_family: str,
|
695
739
|
) -> List[str]:
|
696
740
|
"""Returns a list of restricted params that user chooses to override when creating an Aqua deployment.
|
697
741
|
The default parameters coming from the container index json file cannot be overridden.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
4
4
|
|
5
5
|
from dataclasses import dataclass, field
|
6
|
-
from typing import Union
|
6
|
+
from typing import List, Optional, Union
|
7
7
|
|
8
8
|
from oci.data_science.models import (
|
9
9
|
ModelDeployment,
|
@@ -47,11 +47,13 @@ class AquaDeployment(DataClassSerializable):
|
|
47
47
|
created_on: str = None
|
48
48
|
created_by: str = None
|
49
49
|
endpoint: str = None
|
50
|
+
private_endpoint_id: str = None
|
50
51
|
console_link: str = None
|
51
52
|
lifecycle_details: str = None
|
52
|
-
shape_info:
|
53
|
+
shape_info: Optional[ShapeInfo] = None
|
53
54
|
tags: dict = None
|
54
55
|
environment_variables: dict = None
|
56
|
+
cmd: List[str] = None
|
55
57
|
|
56
58
|
@classmethod
|
57
59
|
def from_oci_model_deployment(
|
@@ -80,6 +82,7 @@ class AquaDeployment(DataClassSerializable):
|
|
80
82
|
)
|
81
83
|
instance_count = oci_model_deployment.model_deployment_configuration_details.model_configuration_details.scaling_policy.instance_count
|
82
84
|
environment_variables = oci_model_deployment.model_deployment_configuration_details.environment_configuration_details.environment_variables
|
85
|
+
cmd = oci_model_deployment.model_deployment_configuration_details.environment_configuration_details.cmd
|
83
86
|
shape_info = ShapeInfo(
|
84
87
|
instance_shape=instance_configuration.instance_shape_name,
|
85
88
|
instance_count=instance_count,
|
@@ -98,6 +101,9 @@ class AquaDeployment(DataClassSerializable):
|
|
98
101
|
freeform_tags = oci_model_deployment.freeform_tags or UNKNOWN_DICT
|
99
102
|
aqua_service_model_tag = freeform_tags.get(Tags.AQUA_SERVICE_MODEL_TAG, None)
|
100
103
|
aqua_model_name = freeform_tags.get(Tags.AQUA_MODEL_NAME_TAG, UNKNOWN)
|
104
|
+
private_endpoint_id = getattr(
|
105
|
+
instance_configuration, "private_endpoint_id", UNKNOWN
|
106
|
+
)
|
101
107
|
|
102
108
|
return AquaDeployment(
|
103
109
|
id=oci_model_deployment.id,
|
@@ -113,6 +119,7 @@ class AquaDeployment(DataClassSerializable):
|
|
113
119
|
created_on=str(oci_model_deployment.time_created),
|
114
120
|
created_by=oci_model_deployment.created_by,
|
115
121
|
endpoint=oci_model_deployment.model_deployment_url,
|
122
|
+
private_endpoint_id=private_endpoint_id,
|
116
123
|
console_link=get_console_link(
|
117
124
|
resource="model-deployments",
|
118
125
|
ocid=oci_model_deployment.id,
|
@@ -120,6 +127,7 @@ class AquaDeployment(DataClassSerializable):
|
|
120
127
|
),
|
121
128
|
tags=freeform_tags,
|
122
129
|
environment_variables=environment_variables,
|
130
|
+
cmd=cmd,
|
123
131
|
)
|
124
132
|
|
125
133
|
|
ads/aqua/ui.py
CHANGED
@@ -17,14 +17,13 @@ from ads.aqua.app import AquaApp
|
|
17
17
|
from ads.aqua.common.entities import ContainerSpec
|
18
18
|
from ads.aqua.common.enums import Tags
|
19
19
|
from ads.aqua.common.errors import AquaResourceAccessError, AquaValueError
|
20
|
-
from ads.aqua.common.utils import get_container_config,
|
20
|
+
from ads.aqua.common.utils import get_container_config, sanitize_response
|
21
|
+
from ads.aqua.constants import PRIVATE_ENDPOINT_TYPE
|
21
22
|
from ads.common import oci_client as oc
|
22
23
|
from ads.common.auth import default_signer
|
23
24
|
from ads.common.object_storage_details import ObjectStorageDetails
|
24
25
|
from ads.common.serializer import DataClassSerializable
|
25
26
|
from ads.config import (
|
26
|
-
AQUA_CONFIG_FOLDER,
|
27
|
-
AQUA_RESOURCE_LIMIT_NAMES_CONFIG,
|
28
27
|
COMPARTMENT_OCID,
|
29
28
|
DATA_SCIENCE_SERVICE_NAME,
|
30
29
|
TENANCY_OCID,
|
@@ -549,6 +548,32 @@ class AquaUIApp(AquaApp):
|
|
549
548
|
|
550
549
|
return sanitize_response(oci_client=vcn_client, response=res)
|
551
550
|
|
551
|
+
@telemetry(entry_point="plugin=ui&action=list_private_endpoints", name="aqua")
|
552
|
+
def list_private_endpoints(self, **kwargs) -> list:
|
553
|
+
"""Lists the private endpoints in the specified compartment.
|
554
|
+
Data seicne private endpoints have two types: `NOTEBOOK_SESSION` and `MODEL_DEPLOYMENT`.
|
555
|
+
This api will by default list `MODEL_DEPLOYMENT` type as needed by AQUA model deployment.
|
556
|
+
|
557
|
+
Parameters
|
558
|
+
----------
|
559
|
+
**kwargs
|
560
|
+
Addtional arguments, such as `compartment_id`,
|
561
|
+
for `list_data_science_private_endpoints <https://docs.oracle.com/en-us/iaas/tools/python/latest/api/data_science/client/oci.data_science.DataScienceClient.html#oci.data_science.DataScienceClient.list_data_science_private_endpoints>`_
|
562
|
+
|
563
|
+
Returns
|
564
|
+
-------
|
565
|
+
json representation of `oci.data_science.models.DataSciencePrivateEndpointSummary`.
|
566
|
+
"""
|
567
|
+
compartment_id = kwargs.pop("compartment_id", COMPARTMENT_OCID)
|
568
|
+
resource_type = kwargs.pop("resource_type", PRIVATE_ENDPOINT_TYPE)
|
569
|
+
logger.info(f"Loading private endpoints from compartment: {compartment_id}")
|
570
|
+
|
571
|
+
res = self.ds_client.list_data_science_private_endpoints(
|
572
|
+
compartment_id=compartment_id, data_science_resource_type=resource_type
|
573
|
+
).data
|
574
|
+
|
575
|
+
return sanitize_response(oci_client=self.ds_client, response=res)
|
576
|
+
|
552
577
|
@telemetry(entry_point="plugin=ui&action=get_shape_availability", name="aqua")
|
553
578
|
def get_shape_availability(self, **kwargs):
|
554
579
|
"""
|
@@ -572,25 +597,13 @@ class AquaUIApp(AquaApp):
|
|
572
597
|
"""
|
573
598
|
compartment_id = kwargs.pop("compartment_id", COMPARTMENT_OCID)
|
574
599
|
instance_shape = kwargs.pop("instance_shape", None)
|
600
|
+
limit_name = kwargs.pop("limit_name", None)
|
575
601
|
|
576
602
|
if not instance_shape:
|
577
603
|
raise AquaValueError("instance_shape argument is required.")
|
578
604
|
|
579
605
|
limits_client = oc.OCIClientFactory(**default_signer()).limits
|
580
606
|
|
581
|
-
artifact_path = AQUA_CONFIG_FOLDER
|
582
|
-
config = load_config(
|
583
|
-
artifact_path,
|
584
|
-
config_file_name=AQUA_RESOURCE_LIMIT_NAMES_CONFIG,
|
585
|
-
)
|
586
|
-
|
587
|
-
if instance_shape not in config:
|
588
|
-
logger.error(
|
589
|
-
f"{instance_shape} does not have mapping details in {AQUA_RESOURCE_LIMIT_NAMES_CONFIG}"
|
590
|
-
)
|
591
|
-
return {}
|
592
|
-
|
593
|
-
limit_name = config[instance_shape]
|
594
607
|
try:
|
595
608
|
res = limits_client.get_resource_availability(
|
596
609
|
DATA_SCIENCE_SERVICE_NAME, limit_name, compartment_id, **kwargs
|
ads/config.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
|
-
# -*- coding: utf-8; -*-
|
3
2
|
|
4
3
|
# Copyright (c) 2020, 2024 Oracle and/or its affiliates.
|
5
4
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
@@ -57,15 +56,11 @@ AQUA_MODEL_FINETUNING_CONFIG = os.environ.get(
|
|
57
56
|
AQUA_CONTAINER_INDEX_CONFIG = os.environ.get(
|
58
57
|
"AQUA_CONTAINER_INDEX_CONFIG", "container_index.json"
|
59
58
|
)
|
60
|
-
AQUA_MODEL_DEPLOYMENT_CONFIG_DEFAULTS = os.environ.get(
|
61
|
-
"AQUA_MODEL_DEPLOYMENT_CONFIG_DEFAULTS", "deployment_config_defaults.json"
|
62
|
-
)
|
63
|
-
AQUA_RESOURCE_LIMIT_NAMES_CONFIG = os.environ.get(
|
64
|
-
"AQUA_RESOURCE_LIMIT_NAMES_CONFIG", "resource_limit_names.json"
|
65
|
-
)
|
66
59
|
AQUA_DEPLOYMENT_CONTAINER_METADATA_NAME = "deployment-container"
|
67
60
|
AQUA_FINETUNING_CONTAINER_METADATA_NAME = "finetune-container"
|
68
61
|
AQUA_EVALUATION_CONTAINER_METADATA_NAME = "evaluation-container"
|
62
|
+
AQUA_DEPLOYMENT_CONTAINER_CMD_VAR_METADATA_NAME = "container-cmd-var"
|
63
|
+
AQUA_DEPLOYMENT_CONTAINER_URI_METADATA_NAME = "deployment-container-uri"
|
69
64
|
AQUA_DEPLOYMENT_CONTAINER_OVERRIDE_FLAG_METADATA_NAME = "deployment-container-custom"
|
70
65
|
AQUA_FINETUNING_CONTAINER_OVERRIDE_FLAG_METADATA_NAME = "finetune-container-custom"
|
71
66
|
AQUA_MODEL_DEPLOYMENT_FOLDER = "/opt/ds/model/deployed_model/"
|
@@ -212,7 +207,7 @@ def open(
|
|
212
207
|
frame.f_globals.pop("config", None)
|
213
208
|
|
214
209
|
# Restores original globals
|
215
|
-
for key in defined_globals
|
210
|
+
for key in defined_globals:
|
216
211
|
frame.f_globals[key] = defined_globals[key]
|
217
212
|
|
218
213
|
# Saving config if it necessary
|
ads/llm/deploy.py
CHANGED
@@ -19,13 +19,19 @@ from ads.llm.serialize import dump, load_from_yaml
|
|
19
19
|
|
20
20
|
|
21
21
|
class ChainDeployment(GenericModel):
|
22
|
+
"""Represents a model deployment with LangChain.
|
23
|
+
"""
|
22
24
|
def __init__(self, chain, **kwargs):
|
23
25
|
self.chain = chain
|
26
|
+
if "model_input_serializer" not in kwargs:
|
27
|
+
kwargs["model_input_serializer"] = self.model_input_serializer_type.JSON
|
24
28
|
super().__init__(**kwargs)
|
25
29
|
|
26
30
|
def prepare(self, **kwargs) -> GenericModel:
|
27
31
|
"""Prepares the model artifact."""
|
28
32
|
chain_yaml_uri = os.path.join(self.artifact_dir, "chain.yaml")
|
33
|
+
if not os.path.exists(self.artifact_dir):
|
34
|
+
os.makedirs(self.artifact_dir)
|
29
35
|
with open(chain_yaml_uri, "w", encoding="utf-8") as f:
|
30
36
|
f.write(yaml.safe_dump(dump(self.chain)))
|
31
37
|
|