oracle-ads 2.11.15__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.
Files changed (41) hide show
  1. ads/aqua/common/entities.py +17 -0
  2. ads/aqua/common/enums.py +5 -1
  3. ads/aqua/common/utils.py +32 -2
  4. ads/aqua/config/config.py +1 -1
  5. ads/aqua/config/deployment_config_defaults.json +29 -1
  6. ads/aqua/config/resource_limit_names.json +1 -0
  7. ads/aqua/constants.py +5 -1
  8. ads/aqua/evaluation/entities.py +0 -1
  9. ads/aqua/evaluation/evaluation.py +47 -14
  10. ads/aqua/extension/common_ws_msg_handler.py +57 -0
  11. ads/aqua/extension/deployment_handler.py +14 -13
  12. ads/aqua/extension/deployment_ws_msg_handler.py +54 -0
  13. ads/aqua/extension/errors.py +1 -1
  14. ads/aqua/extension/evaluation_ws_msg_handler.py +28 -6
  15. ads/aqua/extension/model_handler.py +31 -6
  16. ads/aqua/extension/models/ws_models.py +78 -3
  17. ads/aqua/extension/models_ws_msg_handler.py +49 -0
  18. ads/aqua/extension/ui_websocket_handler.py +7 -1
  19. ads/aqua/model/entities.py +11 -1
  20. ads/aqua/model/model.py +260 -90
  21. ads/aqua/modeldeployment/deployment.py +52 -7
  22. ads/aqua/modeldeployment/entities.py +9 -20
  23. ads/aqua/ui.py +152 -28
  24. ads/common/object_storage_details.py +2 -5
  25. ads/common/serializer.py +2 -3
  26. ads/jobs/builders/infrastructure/dsc_job.py +29 -3
  27. ads/jobs/builders/infrastructure/dsc_job_runtime.py +74 -27
  28. ads/jobs/builders/runtimes/container_runtime.py +83 -4
  29. ads/opctl/operator/lowcode/anomaly/const.py +1 -0
  30. ads/opctl/operator/lowcode/anomaly/model/base_model.py +23 -7
  31. ads/opctl/operator/lowcode/anomaly/operator_config.py +1 -0
  32. ads/opctl/operator/lowcode/anomaly/schema.yaml +4 -0
  33. ads/opctl/operator/lowcode/common/errors.py +6 -0
  34. ads/opctl/operator/lowcode/forecast/model/base_model.py +21 -13
  35. ads/opctl/operator/lowcode/forecast/model_evaluator.py +11 -2
  36. ads/pipeline/ads_pipeline_run.py +13 -2
  37. {oracle_ads-2.11.15.dist-info → oracle_ads-2.11.16.dist-info}/METADATA +1 -1
  38. {oracle_ads-2.11.15.dist-info → oracle_ads-2.11.16.dist-info}/RECORD +41 -37
  39. {oracle_ads-2.11.15.dist-info → oracle_ads-2.11.16.dist-info}/LICENSE.txt +0 -0
  40. {oracle_ads-2.11.15.dist-info → oracle_ads-2.11.16.dist-info}/WHEEL +0 -0
  41. {oracle_ads-2.11.15.dist-info → oracle_ads-2.11.16.dist-info}/entry_points.txt +0 -0
@@ -1,27 +1,50 @@
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 re
7
- from typing import Optional
8
5
  from urllib.parse import urlparse
9
6
 
10
7
  from tornado.web import HTTPError
11
- from ads.aqua.extension.errors import Errors
8
+
12
9
  from ads.aqua.common.decorator import handle_exceptions
10
+ from ads.aqua.common.errors import AquaValueError
13
11
  from ads.aqua.extension.base_handler import AquaAPIhandler
12
+ from ads.aqua.extension.errors import Errors
14
13
  from ads.aqua.model import AquaModelApp
14
+ from ads.aqua.ui import ModelFormat
15
15
 
16
16
 
17
17
  class AquaModelHandler(AquaAPIhandler):
18
18
  """Handler for Aqua Model REST APIs."""
19
19
 
20
20
  @handle_exceptions
21
- def get(self, model_id=""):
21
+ def get(
22
+ self,
23
+ model_id="",
24
+ ):
22
25
  """Handle GET request."""
23
- if not model_id:
26
+ url_parse = urlparse(self.request.path)
27
+ paths = url_parse.path.strip("/")
28
+ if paths.startswith("aqua/model/files"):
29
+ os_path = self.get_argument("os_path")
30
+ if not os_path:
31
+ raise HTTPError(
32
+ 400, Errors.MISSING_REQUIRED_PARAMETER.format("os_path")
33
+ )
34
+ model_format = self.get_argument("model_format")
35
+ if not model_format:
36
+ raise HTTPError(
37
+ 400, Errors.MISSING_REQUIRED_PARAMETER.format("model_format")
38
+ )
39
+ try:
40
+ model_format = ModelFormat(model_format.upper())
41
+ except ValueError:
42
+ raise AquaValueError(f"Invalid model format: {model_format}")
43
+ else:
44
+ return self.finish(AquaModelApp.get_model_files(os_path, model_format))
45
+ elif not model_id:
24
46
  return self.list()
47
+
25
48
  return self.read(model_id)
26
49
 
27
50
  def read(self, model_id):
@@ -81,6 +104,7 @@ class AquaModelHandler(AquaAPIhandler):
81
104
  finetuning_container = input_data.get("finetuning_container")
82
105
  compartment_id = input_data.get("compartment_id")
83
106
  project_id = input_data.get("project_id")
107
+ model_file = input_data.get("model_file")
84
108
 
85
109
  return self.finish(
86
110
  AquaModelApp().register(
@@ -90,6 +114,7 @@ class AquaModelHandler(AquaAPIhandler):
90
114
  finetuning_container=finetuning_container,
91
115
  compartment_id=compartment_id,
92
116
  project_id=project_id,
117
+ model_file=model_file,
93
118
  )
94
119
  )
95
120
 
@@ -7,15 +7,22 @@
7
7
  from dataclasses import dataclass
8
8
  from typing import List, Optional
9
9
 
10
- from ads.aqua.evaluation.entities import AquaEvaluationSummary
11
- from ads.aqua.model.entities import AquaModelSummary
10
+ from ads.aqua.evaluation.entities import AquaEvaluationSummary, AquaEvaluationDetail
11
+ from ads.aqua.model.entities import AquaModelSummary, AquaModel
12
+ from ads.aqua.modeldeployment.entities import AquaDeployment, AquaDeploymentDetail
12
13
  from ads.common.extended_enum import ExtendedEnumMeta
13
14
  from ads.common.serializer import DataClassSerializable
14
15
 
15
16
 
16
17
  class RequestResponseType(str, metaclass=ExtendedEnumMeta):
17
18
  ListEvaluations = "ListEvaluations"
19
+ EvaluationDetails = "EvaluationDetails"
20
+ ListDeployments = "ListDeployments"
21
+ DeploymentDetails = "DeploymentDetails"
18
22
  ListModels = "ListModels"
23
+ ModelDetails = "ModelDetails"
24
+ AdsVersion = "AdsVersion"
25
+ CompatibilityCheck = "CompatibilityCheck"
19
26
  Error = "Error"
20
27
 
21
28
 
@@ -23,7 +30,7 @@ class RequestResponseType(str, metaclass=ExtendedEnumMeta):
23
30
  class BaseResponse(DataClassSerializable):
24
31
  message_id: str
25
32
  kind: RequestResponseType
26
- data: object
33
+ data: Optional[object]
27
34
 
28
35
 
29
36
  @dataclass
@@ -40,9 +47,37 @@ class ListEvaluationsRequest(BaseRequest):
40
47
  kind = RequestResponseType.ListEvaluations
41
48
 
42
49
 
50
+ @dataclass
51
+ class EvaluationDetailsRequest(BaseRequest):
52
+ kind = RequestResponseType.EvaluationDetails
53
+ evaluation_id: str
54
+
55
+
43
56
  @dataclass
44
57
  class ListModelsRequest(BaseRequest):
45
58
  compartment_id: Optional[str] = None
59
+ project_id: Optional[str] = None
60
+ model_type: Optional[str] = None
61
+ kind = RequestResponseType.ListDeployments
62
+
63
+
64
+ @dataclass
65
+ class ModelDetailsRequest(BaseRequest):
66
+ kind = RequestResponseType.ModelDetails
67
+ model_id: str
68
+
69
+
70
+ @dataclass
71
+ class ListDeploymentRequest(BaseRequest):
72
+ compartment_id: str
73
+ project_id: Optional[str] = None
74
+ kind = RequestResponseType.ListDeployments
75
+
76
+
77
+ @dataclass
78
+ class DeploymentDetailsRequest(BaseRequest):
79
+ model_deployment_id: str
80
+ kind = RequestResponseType.DeploymentDetails
46
81
 
47
82
 
48
83
  @dataclass
@@ -50,11 +85,51 @@ class ListEvaluationsResponse(BaseResponse):
50
85
  data: List[AquaEvaluationSummary]
51
86
 
52
87
 
88
+ @dataclass
89
+ class EvaluationDetailsResponse(BaseResponse):
90
+ data: AquaEvaluationDetail
91
+
92
+
93
+ @dataclass
94
+ class ListDeploymentResponse(BaseResponse):
95
+ data: List[AquaDeployment]
96
+
97
+
98
+ @dataclass
99
+ class ModelDeploymentDetailsResponse(BaseResponse):
100
+ data: AquaDeploymentDetail
101
+
102
+
53
103
  @dataclass
54
104
  class ListModelsResponse(BaseResponse):
55
105
  data: List[AquaModelSummary]
56
106
 
57
107
 
108
+ @dataclass
109
+ class ModelDetailsResponse(BaseResponse):
110
+ data: AquaModel
111
+
112
+
113
+ @dataclass
114
+ class AdsVersionRequest(BaseRequest):
115
+ kind: RequestResponseType.AdsVersion
116
+
117
+
118
+ @dataclass
119
+ class AdsVersionResponse(BaseResponse):
120
+ data: str
121
+
122
+
123
+ @dataclass
124
+ class CompatibilityCheckRequest(BaseRequest):
125
+ kind: RequestResponseType.CompatibilityCheck
126
+
127
+
128
+ @dataclass
129
+ class CompatibilityCheckResponse(BaseResponse):
130
+ data: object
131
+
132
+
58
133
  @dataclass
59
134
  class AquaWsError(DataClassSerializable):
60
135
  status: str
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) 2024 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 json
7
+ from typing import List, Union
8
+
9
+ from ads.aqua.common.decorator import handle_exceptions
10
+ from ads.aqua.extension.aqua_ws_msg_handler import AquaWSMsgHandler
11
+ from ads.aqua.extension.models.ws_models import (
12
+ ListModelsResponse,
13
+ ModelDetailsResponse,
14
+ RequestResponseType,
15
+ )
16
+ from ads.aqua.model import AquaModelApp
17
+
18
+
19
+ class AquaModelWSMsgHandler(AquaWSMsgHandler):
20
+ def __init__(self, message: Union[str, bytes]):
21
+ super().__init__(message)
22
+
23
+ @staticmethod
24
+ def get_message_types() -> List[RequestResponseType]:
25
+ return [RequestResponseType.ListModels, RequestResponseType.ModelDetails]
26
+
27
+ @handle_exceptions
28
+ def process(self) -> Union[ListModelsResponse, ModelDetailsResponse]:
29
+ request = json.loads(self.message)
30
+ if request.get("kind") == "ListModels":
31
+ models_list = AquaModelApp().list(
32
+ compartment_id=request.get("compartment_id"),
33
+ project_id=request.get("project_id"),
34
+ model_type=request.get("model_type"),
35
+ )
36
+ response = ListModelsResponse(
37
+ message_id=request.get("message_id"),
38
+ kind=RequestResponseType.ListModels,
39
+ data=models_list,
40
+ )
41
+ return response
42
+ elif request.get("kind") == "ModelDetails":
43
+ model_id = request.get("model_id")
44
+ response = AquaModelApp().get(model_id)
45
+ return ModelDetailsResponse(
46
+ message_id=request.get("message_id"),
47
+ kind=RequestResponseType.ModelDetails,
48
+ data=response,
49
+ )
@@ -14,6 +14,8 @@ from tornado.websocket import WebSocketHandler
14
14
 
15
15
  from ads.aqua import logger
16
16
  from ads.aqua.extension.aqua_ws_msg_handler import AquaWSMsgHandler
17
+ from ads.aqua.extension.common_ws_msg_handler import AquaCommonWsMsgHandler
18
+ from ads.aqua.extension.deployment_ws_msg_handler import AquaDeploymentWSMsgHandler
17
19
  from ads.aqua.extension.evaluation_ws_msg_handler import AquaEvaluationWSMsgHandler
18
20
  from ads.aqua.extension.models.ws_models import (
19
21
  AquaWsError,
@@ -22,6 +24,7 @@ from ads.aqua.extension.models.ws_models import (
22
24
  ErrorResponse,
23
25
  RequestResponseType,
24
26
  )
27
+ from ads.aqua.extension.models_ws_msg_handler import AquaModelWSMsgHandler
25
28
 
26
29
  MAX_WORKERS = 20
27
30
 
@@ -43,7 +46,10 @@ def get_aqua_internal_error_response(message_id: str) -> ErrorResponse:
43
46
  class AquaUIWebSocketHandler(WebSocketHandler):
44
47
  """Handler for Aqua Websocket."""
45
48
 
46
- _handlers_: List[Type[AquaWSMsgHandler]] = [AquaEvaluationWSMsgHandler]
49
+ _handlers_: List[Type[AquaWSMsgHandler]] = [AquaEvaluationWSMsgHandler,
50
+ AquaDeploymentWSMsgHandler,
51
+ AquaModelWSMsgHandler,
52
+ AquaCommonWsMsgHandler]
47
53
 
48
54
  thread_pool: ThreadPoolExecutor
49
55
 
@@ -14,7 +14,6 @@ from dataclasses import InitVar, dataclass, field
14
14
  from typing import List, Optional
15
15
 
16
16
  import oci
17
-
18
17
  from ads.aqua import logger
19
18
  from ads.aqua.app import CLIBuilderMixin
20
19
  from ads.aqua.common import utils
@@ -22,6 +21,7 @@ from ads.aqua.constants import LIFECYCLE_DETAILS_MISSING_JOBRUN, UNKNOWN_VALUE
22
21
  from ads.aqua.data import AquaResourceIdentifier
23
22
  from ads.aqua.model.enums import FineTuningDefinedMetadata
24
23
  from ads.aqua.training.exceptions import exit_code_dict
24
+ from ads.aqua.ui import ModelFormat
25
25
  from ads.common.serializer import DataClassSerializable
26
26
  from ads.common.utils import get_log_links
27
27
  from ads.model.datascience_model import DataScienceModel
@@ -41,6 +41,12 @@ class AquaFineTuneValidation(DataClassSerializable):
41
41
  value: str = ""
42
42
 
43
43
 
44
+ class ModelValidationResult:
45
+ model_file: Optional[str] = None
46
+ model_format: ModelFormat = None
47
+ telemetry_model_name: str = None
48
+
49
+
44
50
  @dataclass(repr=False)
45
51
  class AquaFineTuningMetric(DataClassSerializable):
46
52
  name: str = field(default_factory=str)
@@ -76,6 +82,9 @@ class AquaModelSummary(DataClassSerializable):
76
82
  ready_to_deploy: bool = True
77
83
  ready_to_finetune: bool = False
78
84
  ready_to_import: bool = False
85
+ nvidia_gpu_supported: bool = False
86
+ arm_cpu_supported: bool = False
87
+ model_format: ModelFormat = ModelFormat.UNKNOWN
79
88
 
80
89
 
81
90
  @dataclass(repr=False)
@@ -259,6 +268,7 @@ class ImportModelDetails(CLIBuilderMixin):
259
268
  finetuning_container: Optional[str] = None
260
269
  compartment_id: Optional[str] = None
261
270
  project_id: Optional[str] = None
271
+ model_file: Optional[str] = None
262
272
 
263
273
  def __post_init__(self):
264
274
  self._command = "model register"