oracle-ads 2.12.2__py3-none-any.whl → 2.12.4__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/evaluation/entities.py +45 -50
- ads/aqua/evaluation/evaluation.py +26 -61
- ads/aqua/extension/deployment_handler.py +35 -0
- ads/aqua/extension/errors.py +1 -0
- ads/aqua/extension/evaluation_handler.py +0 -5
- ads/aqua/extension/finetune_handler.py +1 -2
- ads/aqua/extension/model_handler.py +38 -1
- 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 +350 -140
- ads/aqua/modeldeployment/deployment.py +118 -62
- ads/aqua/modeldeployment/entities.py +10 -2
- ads/aqua/ui.py +29 -16
- ads/config.py +3 -8
- ads/dataset/dataset.py +2 -2
- ads/dataset/factory.py +1 -1
- 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
- ads/opctl/operator/lowcode/forecast/cmd.py +3 -9
- ads/opctl/operator/lowcode/forecast/const.py +3 -4
- ads/opctl/operator/lowcode/forecast/model/factory.py +13 -12
- ads/opctl/operator/lowcode/forecast/model/ml_forecast.py +4 -3
- ads/opctl/operator/lowcode/forecast/operator_config.py +17 -10
- ads/opctl/operator/lowcode/forecast/schema.yaml +2 -2
- ads/oracledb/oracle_db.py +32 -20
- ads/secrets/adb.py +28 -6
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.4.dist-info}/METADATA +3 -2
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.4.dist-info}/RECORD +54 -55
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.4.dist-info}/WHEEL +1 -1
- 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.4.dist-info}/LICENSE.txt +0 -0
- {oracle_ads-2.12.2.dist-info → oracle_ads-2.12.4.dist-info}/entry_points.txt +0 -0
ads/aqua/extension/ui_handler.py
CHANGED
@@ -1,5 +1,4 @@
|
|
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
|
|
@@ -10,8 +9,9 @@ from tornado.web import HTTPError
|
|
10
9
|
|
11
10
|
from ads.aqua.common.decorator import handle_exceptions
|
12
11
|
from ads.aqua.common.enums import Tags
|
13
|
-
from ads.aqua.
|
12
|
+
from ads.aqua.constants import PRIVATE_ENDPOINT_TYPE
|
14
13
|
from ads.aqua.extension.base_handler import AquaAPIhandler
|
14
|
+
from ads.aqua.extension.errors import Errors
|
15
15
|
from ads.aqua.extension.utils import validate_function_parameters
|
16
16
|
from ads.aqua.model.entities import ImportModelDetails
|
17
17
|
from ads.aqua.ui import AquaUIApp
|
@@ -72,6 +72,8 @@ class AquaUIHandler(AquaAPIhandler):
|
|
72
72
|
return self.list_vcn()
|
73
73
|
elif paths.startswith("aqua/subnets"):
|
74
74
|
return self.list_subnets()
|
75
|
+
elif paths.startswith("aqua/privateendpoints"):
|
76
|
+
return self.list_private_endpoints()
|
75
77
|
elif paths.startswith("aqua/shapes/limit"):
|
76
78
|
return self.get_shape_availability()
|
77
79
|
elif paths.startswith("aqua/bucket/versioning"):
|
@@ -175,15 +177,31 @@ class AquaUIHandler(AquaAPIhandler):
|
|
175
177
|
)
|
176
178
|
)
|
177
179
|
|
180
|
+
def list_private_endpoints(self, **kwargs):
|
181
|
+
"""Lists the private endpoints in the specified compartment."""
|
182
|
+
compartment_id = self.get_argument("compartment_id", default=COMPARTMENT_OCID)
|
183
|
+
resource_type = self.get_argument(
|
184
|
+
"resource_type", default=PRIVATE_ENDPOINT_TYPE
|
185
|
+
)
|
186
|
+
return self.finish(
|
187
|
+
AquaUIApp().list_private_endpoints(
|
188
|
+
compartment_id=compartment_id, resource_type=resource_type, **kwargs
|
189
|
+
)
|
190
|
+
)
|
191
|
+
|
178
192
|
def get_shape_availability(self, **kwargs):
|
179
193
|
"""For a given compartmentId, resource limit name, and scope, returns the number of available resources associated
|
180
194
|
with the given limit."""
|
181
195
|
compartment_id = self.get_argument("compartment_id", default=COMPARTMENT_OCID)
|
182
196
|
instance_shape = self.get_argument("instance_shape")
|
197
|
+
limit_name = self.get_argument("limit_name")
|
183
198
|
|
184
199
|
return self.finish(
|
185
200
|
AquaUIApp().get_shape_availability(
|
186
|
-
compartment_id=compartment_id,
|
201
|
+
compartment_id=compartment_id,
|
202
|
+
instance_shape=instance_shape,
|
203
|
+
limit_name=limit_name,
|
204
|
+
**kwargs,
|
187
205
|
)
|
188
206
|
)
|
189
207
|
|
@@ -244,6 +262,7 @@ __handlers__ = [
|
|
244
262
|
("job/shapes/?([^/]*)", AquaUIHandler),
|
245
263
|
("vcn/?([^/]*)", AquaUIHandler),
|
246
264
|
("subnets/?([^/]*)", AquaUIHandler),
|
265
|
+
("privateendpoints/?([^/]*)", AquaUIHandler),
|
247
266
|
("shapes/limit/?([^/]*)", AquaUIHandler),
|
248
267
|
("bucket/versioning/?([^/]*)", AquaUIHandler),
|
249
268
|
("containers/?([^/]*)", AquaUIHandler),
|
ads/aqua/finetuning/entities.py
CHANGED
@@ -1,5 +1,4 @@
|
|
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
|
from dataclasses import dataclass, field
|
@@ -14,9 +13,9 @@ class AquaFineTuningParams(DataClassSerializable):
|
|
14
13
|
epochs: int
|
15
14
|
learning_rate: Optional[float] = None
|
16
15
|
sample_packing: Optional[bool] = "auto"
|
17
|
-
batch_size: Optional[
|
18
|
-
|
19
|
-
|
16
|
+
batch_size: Optional[int] = (
|
17
|
+
None # make it batch_size for user, but internally this is micro_batch_size
|
18
|
+
)
|
20
19
|
sequence_len: Optional[int] = None
|
21
20
|
pad_to_sequence_len: Optional[bool] = None
|
22
21
|
lora_r: Optional[int] = None
|
@@ -24,6 +23,8 @@ class AquaFineTuningParams(DataClassSerializable):
|
|
24
23
|
lora_dropout: Optional[float] = None
|
25
24
|
lora_target_linear: Optional[bool] = None
|
26
25
|
lora_target_modules: Optional[List] = None
|
26
|
+
early_stopping_patience: Optional[int] = None
|
27
|
+
early_stopping_threshold: Optional[float] = None
|
27
28
|
|
28
29
|
|
29
30
|
@dataclass(repr=False)
|
@@ -1,11 +1,10 @@
|
|
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
|
import json
|
7
6
|
import os
|
8
|
-
from dataclasses import asdict, fields
|
7
|
+
from dataclasses import MISSING, asdict, fields
|
9
8
|
from typing import Dict
|
10
9
|
|
11
10
|
from oci.data_science.models import (
|
@@ -14,7 +13,7 @@ from oci.data_science.models import (
|
|
14
13
|
UpdateModelProvenanceDetails,
|
15
14
|
)
|
16
15
|
|
17
|
-
from ads.aqua import
|
16
|
+
from ads.aqua import logger
|
18
17
|
from ads.aqua.app import AquaApp
|
19
18
|
from ads.aqua.common.enums import Resource, Tags
|
20
19
|
from ads.aqua.common.errors import AquaFileExistsError, AquaValueError
|
@@ -31,7 +30,6 @@ from ads.aqua.constants import (
|
|
31
30
|
UNKNOWN,
|
32
31
|
UNKNOWN_DICT,
|
33
32
|
)
|
34
|
-
from ads.aqua.config.config import get_finetuning_config_defaults
|
35
33
|
from ads.aqua.data import AquaResourceIdentifier
|
36
34
|
from ads.aqua.finetuning.constants import *
|
37
35
|
from ads.aqua.finetuning.entities import *
|
@@ -132,7 +130,7 @@ class AquaFineTuningApp(AquaApp):
|
|
132
130
|
or create_fine_tuning_details.validation_set_size >= 1
|
133
131
|
):
|
134
132
|
raise AquaValueError(
|
135
|
-
|
133
|
+
"Fine tuning validation set size should be a float number in between [0, 1)."
|
136
134
|
)
|
137
135
|
|
138
136
|
if create_fine_tuning_details.replica < DEFAULT_FT_REPLICA:
|
@@ -394,7 +392,7 @@ class AquaFineTuningApp(AquaApp):
|
|
394
392
|
)
|
395
393
|
# track shapes that were used for fine-tune creation
|
396
394
|
self.telemetry.record_event_async(
|
397
|
-
category=
|
395
|
+
category="aqua/service/finetune/create/shape/",
|
398
396
|
action=f"{create_fine_tuning_details.shape_name}x{create_fine_tuning_details.replica}",
|
399
397
|
**telemetry_kwargs,
|
400
398
|
)
|
@@ -533,6 +531,12 @@ class AquaFineTuningApp(AquaApp):
|
|
533
531
|
oci_launch_cmd += f"--num_{key} {value} "
|
534
532
|
elif key == "lora_target_modules":
|
535
533
|
oci_launch_cmd += f"--{key} {','.join(str(k) for k in value)} "
|
534
|
+
elif key == "early_stopping_patience":
|
535
|
+
if value != 0:
|
536
|
+
oci_launch_cmd += f"--{key} {value} "
|
537
|
+
elif key == "early_stopping_threshold":
|
538
|
+
if "early_stopping_patience" in oci_launch_cmd:
|
539
|
+
oci_launch_cmd += f"--{key} {value} "
|
536
540
|
else:
|
537
541
|
oci_launch_cmd += f"--{key} {value} "
|
538
542
|
|
@@ -558,8 +562,9 @@ class AquaFineTuningApp(AquaApp):
|
|
558
562
|
|
559
563
|
config = self.get_config(model_id, AQUA_MODEL_FINETUNING_CONFIG)
|
560
564
|
if not config:
|
561
|
-
logger.
|
562
|
-
|
565
|
+
logger.debug(
|
566
|
+
f"Fine-tuning config for custom model: {model_id} is not available."
|
567
|
+
)
|
563
568
|
return config
|
564
569
|
|
565
570
|
@telemetry(
|
ads/aqua/model/constants.py
CHANGED
@@ -17,6 +17,7 @@ class ModelCustomMetadataFields(str, metaclass=ExtendedEnumMeta):
|
|
17
17
|
DEPLOYMENT_CONTAINER = "deployment-container"
|
18
18
|
EVALUATION_CONTAINER = "evaluation-container"
|
19
19
|
FINETUNE_CONTAINER = "finetune-container"
|
20
|
+
DEPLOYMENT_CONTAINER_URI = "deployment-container-uri"
|
20
21
|
|
21
22
|
|
22
23
|
class ModelTask(str, metaclass=ExtendedEnumMeta):
|
ads/aqua/model/entities.py
CHANGED
@@ -98,6 +98,7 @@ class AquaModel(AquaModelSummary, DataClassSerializable):
|
|
98
98
|
|
99
99
|
model_card: str = None
|
100
100
|
inference_container: str = None
|
101
|
+
inference_container_uri: str = None
|
101
102
|
finetuning_container: str = None
|
102
103
|
evaluation_container: str = None
|
103
104
|
artifact_location: str = None
|
@@ -287,6 +288,7 @@ class ImportModelDetails(CLIBuilderMixin):
|
|
287
288
|
compartment_id: Optional[str] = None
|
288
289
|
project_id: Optional[str] = None
|
289
290
|
model_file: Optional[str] = None
|
291
|
+
inference_container_uri: Optional[str] = None
|
290
292
|
|
291
293
|
def __post_init__(self):
|
292
294
|
self._command = "model register"
|