oracle-ads 2.11.8__py3-none-any.whl → 2.11.10__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 (87) hide show
  1. ads/aqua/__init__.py +1 -1
  2. ads/aqua/{base.py → app.py} +27 -7
  3. ads/aqua/cli.py +59 -17
  4. ads/aqua/common/__init__.py +5 -0
  5. ads/aqua/{decorator.py → common/decorator.py} +14 -8
  6. ads/aqua/common/enums.py +69 -0
  7. ads/aqua/{exception.py → common/errors.py} +28 -0
  8. ads/aqua/{utils.py → common/utils.py} +171 -79
  9. ads/aqua/config/config.py +18 -0
  10. ads/aqua/constants.py +51 -33
  11. ads/aqua/data.py +15 -26
  12. ads/aqua/evaluation/__init__.py +8 -0
  13. ads/aqua/evaluation/constants.py +53 -0
  14. ads/aqua/evaluation/entities.py +170 -0
  15. ads/aqua/evaluation/errors.py +71 -0
  16. ads/aqua/{evaluation.py → evaluation/evaluation.py} +122 -370
  17. ads/aqua/extension/__init__.py +2 -0
  18. ads/aqua/extension/aqua_ws_msg_handler.py +97 -0
  19. ads/aqua/extension/base_handler.py +0 -7
  20. ads/aqua/extension/common_handler.py +12 -6
  21. ads/aqua/extension/deployment_handler.py +70 -4
  22. ads/aqua/extension/errors.py +10 -0
  23. ads/aqua/extension/evaluation_handler.py +5 -3
  24. ads/aqua/extension/evaluation_ws_msg_handler.py +43 -0
  25. ads/aqua/extension/finetune_handler.py +41 -3
  26. ads/aqua/extension/model_handler.py +56 -4
  27. ads/aqua/extension/models/__init__.py +0 -0
  28. ads/aqua/extension/models/ws_models.py +69 -0
  29. ads/aqua/extension/ui_handler.py +65 -4
  30. ads/aqua/extension/ui_websocket_handler.py +124 -0
  31. ads/aqua/extension/utils.py +1 -1
  32. ads/aqua/finetuning/__init__.py +7 -0
  33. ads/aqua/finetuning/constants.py +17 -0
  34. ads/aqua/finetuning/entities.py +102 -0
  35. ads/aqua/{finetune.py → finetuning/finetuning.py} +162 -136
  36. ads/aqua/model/__init__.py +8 -0
  37. ads/aqua/model/constants.py +46 -0
  38. ads/aqua/model/entities.py +266 -0
  39. ads/aqua/model/enums.py +26 -0
  40. ads/aqua/{model.py → model/model.py} +401 -309
  41. ads/aqua/modeldeployment/__init__.py +8 -0
  42. ads/aqua/modeldeployment/constants.py +26 -0
  43. ads/aqua/{deployment.py → modeldeployment/deployment.py} +288 -227
  44. ads/aqua/modeldeployment/entities.py +142 -0
  45. ads/aqua/modeldeployment/inference.py +75 -0
  46. ads/aqua/ui.py +88 -8
  47. ads/cli.py +55 -7
  48. ads/common/serializer.py +2 -2
  49. ads/config.py +2 -1
  50. ads/jobs/builders/infrastructure/dsc_job.py +49 -6
  51. ads/model/datascience_model.py +21 -1
  52. ads/model/deployment/model_deployment.py +11 -0
  53. ads/model/model_metadata.py +17 -6
  54. ads/opctl/operator/lowcode/anomaly/README.md +0 -2
  55. ads/opctl/operator/lowcode/anomaly/__main__.py +3 -3
  56. ads/opctl/operator/lowcode/anomaly/environment.yaml +0 -2
  57. ads/opctl/operator/lowcode/anomaly/model/automlx.py +2 -2
  58. ads/opctl/operator/lowcode/anomaly/model/autots.py +1 -1
  59. ads/opctl/operator/lowcode/anomaly/model/base_model.py +13 -17
  60. ads/opctl/operator/lowcode/anomaly/operator_config.py +2 -0
  61. ads/opctl/operator/lowcode/anomaly/schema.yaml +1 -2
  62. ads/opctl/operator/lowcode/anomaly/utils.py +3 -2
  63. ads/opctl/operator/lowcode/common/transformations.py +2 -1
  64. ads/opctl/operator/lowcode/common/utils.py +1 -1
  65. ads/opctl/operator/lowcode/forecast/README.md +1 -3
  66. ads/opctl/operator/lowcode/forecast/__main__.py +3 -18
  67. ads/opctl/operator/lowcode/forecast/const.py +2 -0
  68. ads/opctl/operator/lowcode/forecast/environment.yaml +1 -2
  69. ads/opctl/operator/lowcode/forecast/model/arima.py +1 -0
  70. ads/opctl/operator/lowcode/forecast/model/automlx.py +7 -4
  71. ads/opctl/operator/lowcode/forecast/model/autots.py +1 -0
  72. ads/opctl/operator/lowcode/forecast/model/base_model.py +38 -22
  73. ads/opctl/operator/lowcode/forecast/model/factory.py +33 -4
  74. ads/opctl/operator/lowcode/forecast/model/forecast_datasets.py +15 -1
  75. ads/opctl/operator/lowcode/forecast/model/ml_forecast.py +234 -0
  76. ads/opctl/operator/lowcode/forecast/model/neuralprophet.py +9 -1
  77. ads/opctl/operator/lowcode/forecast/model/prophet.py +1 -0
  78. ads/opctl/operator/lowcode/forecast/model_evaluator.py +147 -0
  79. ads/opctl/operator/lowcode/forecast/operator_config.py +2 -1
  80. ads/opctl/operator/lowcode/forecast/schema.yaml +7 -2
  81. ads/opctl/operator/lowcode/forecast/utils.py +18 -44
  82. {oracle_ads-2.11.8.dist-info → oracle_ads-2.11.10.dist-info}/METADATA +9 -12
  83. {oracle_ads-2.11.8.dist-info → oracle_ads-2.11.10.dist-info}/RECORD +86 -61
  84. ads/aqua/job.py +0 -29
  85. {oracle_ads-2.11.8.dist-info → oracle_ads-2.11.10.dist-info}/LICENSE.txt +0 -0
  86. {oracle_ads-2.11.8.dist-info → oracle_ads-2.11.10.dist-info}/WHEEL +0 -0
  87. {oracle_ads-2.11.8.dist-info → oracle_ads-2.11.10.dist-info}/entry_points.txt +0 -0
@@ -10,7 +10,6 @@ import logging
10
10
  import os
11
11
  import random
12
12
  import re
13
- from enum import Enum
14
13
  from functools import wraps
15
14
  from pathlib import Path
16
15
  from string import Template
@@ -20,64 +19,26 @@ import fsspec
20
19
  import oci
21
20
  from oci.data_science.models import JobRun, Model
22
21
 
23
- from ads.aqua.constants import RqsAdditionalDetails
22
+ from ads.aqua.common.enums import RqsAdditionalDetails
23
+ from ads.aqua.common.errors import (
24
+ AquaFileNotFoundError,
25
+ AquaRuntimeError,
26
+ AquaValueError,
27
+ )
28
+ from ads.aqua.constants import *
24
29
  from ads.aqua.data import AquaResourceIdentifier
25
- from ads.aqua.exception import AquaFileNotFoundError, AquaRuntimeError, AquaValueError
26
30
  from ads.common.auth import default_signer
31
+ from ads.common.extended_enum import ExtendedEnumMeta
27
32
  from ads.common.object_storage_details import ObjectStorageDetails
28
33
  from ads.common.oci_resource import SEARCH_TYPE, OCIResource
29
- from ads.common.utils import get_console_link, upload_to_os
34
+ from ads.common.utils import get_console_link, upload_to_os, copy_file
30
35
  from ads.config import AQUA_SERVICE_MODELS_BUCKET, CONDA_BUCKET_NS, TENANCY_OCID
31
36
  from ads.model import DataScienceModel, ModelVersionSet
32
37
 
33
38
  logger = logging.getLogger("ads.aqua")
34
39
 
35
- UNKNOWN = ""
36
- UNKNOWN_DICT = {}
37
- README = "README.md"
38
- LICENSE_TXT = "config/LICENSE.txt"
39
- DEPLOYMENT_CONFIG = "deployment_config.json"
40
- COMPARTMENT_MAPPING_KEY = "service-model-compartment"
41
- CONTAINER_INDEX = "container_index.json"
42
- EVALUATION_REPORT_JSON = "report.json"
43
- EVALUATION_REPORT_MD = "report.md"
44
- EVALUATION_REPORT = "report.html"
45
- UNKNOWN_JSON_STR = "{}"
46
- CONSOLE_LINK_RESOURCE_TYPE_MAPPING = dict(
47
- datasciencemodel="models",
48
- datasciencemodeldeployment="model-deployments",
49
- datasciencemodeldeploymentdev="model-deployments",
50
- datasciencemodeldeploymentint="model-deployments",
51
- datasciencemodeldeploymentpre="model-deployments",
52
- datasciencejob="jobs",
53
- datasciencejobrun="job-runs",
54
- datasciencejobrundev="job-runs",
55
- datasciencejobrunint="job-runs",
56
- datasciencejobrunpre="job-runs",
57
- datasciencemodelversionset="model-version-sets",
58
- datasciencemodelversionsetpre="model-version-sets",
59
- datasciencemodelversionsetint="model-version-sets",
60
- datasciencemodelversionsetdev="model-version-sets",
61
- )
62
- FINE_TUNING_RUNTIME_CONTAINER = "iad.ocir.io/ociodscdev/aqua_ft_cuda121:0.3.17.20"
63
- DEFAULT_FT_BLOCK_STORAGE_SIZE = 750
64
- DEFAULT_FT_REPLICA = 1
65
- DEFAULT_FT_BATCH_SIZE = 1
66
- DEFAULT_FT_VALIDATION_SET_SIZE = 0.1
67
-
68
- HF_MODELS = "/home/datascience/conda/pytorch21_p39_gpu_v1/"
69
- MAXIMUM_ALLOWED_DATASET_IN_BYTE = 52428800 # 1024 x 1024 x 50 = 50MB
70
- JOB_INFRASTRUCTURE_TYPE_DEFAULT_NETWORKING = "ME_STANDALONE"
71
- NB_SESSION_IDENTIFIER = "NB_SESSION_OCID"
72
- LIFECYCLE_DETAILS_MISSING_JOBRUN = "The asscociated JobRun resource has been deleted."
73
- READY_TO_DEPLOY_STATUS = "ACTIVE"
74
- READY_TO_FINE_TUNE_STATUS = "TRUE"
75
- AQUA_GA_LIST = ["id19sfcrra6z"]
76
- AQUA_MODEL_TYPE_SERVICE = "service"
77
- AQUA_MODEL_TYPE_CUSTOM = "custom"
78
-
79
-
80
- class LifecycleStatus(Enum):
40
+
41
+ class LifecycleStatus(str, metaclass=ExtendedEnumMeta):
81
42
  UNKNOWN = ""
82
43
 
83
44
  @property
@@ -136,8 +97,6 @@ LIFECYCLE_DETAILS_MAPPING = {
136
97
  JobRun.LIFECYCLE_STATE_FAILED: "The evaluation failed.",
137
98
  JobRun.LIFECYCLE_STATE_NEEDS_ATTENTION: "Missing jobrun information.",
138
99
  }
139
- SUPPORTED_FILE_FORMATS = ["jsonl"]
140
- MODEL_BY_REFERENCE_OSS_PATH_KEY = "artifact_location"
141
100
 
142
101
 
143
102
  def random_color_generator(word: str):
@@ -201,22 +160,28 @@ def get_artifact_path(custom_metadata_list: List) -> str:
201
160
  Parameters
202
161
  ----------
203
162
  custom_metadata_list: List
204
- A list of custom metadata of model.
163
+ A list of custom metadata of OCI model.
205
164
 
206
165
  Returns
207
166
  -------
208
167
  str:
209
168
  The artifact path from model.
210
169
  """
211
- for custom_metadata in custom_metadata_list:
212
- if custom_metadata.key == MODEL_BY_REFERENCE_OSS_PATH_KEY:
213
- if ObjectStorageDetails.is_oci_path(custom_metadata.value):
214
- artifact_path = custom_metadata.value
215
- else:
216
- artifact_path = ObjectStorageDetails(
217
- AQUA_SERVICE_MODELS_BUCKET, CONDA_BUCKET_NS, custom_metadata.value
218
- ).path
219
- return artifact_path
170
+ try:
171
+ for custom_metadata in custom_metadata_list:
172
+ if custom_metadata.key == MODEL_BY_REFERENCE_OSS_PATH_KEY:
173
+ if ObjectStorageDetails.is_oci_path(custom_metadata.value):
174
+ artifact_path = custom_metadata.value
175
+ else:
176
+ artifact_path = ObjectStorageDetails(
177
+ AQUA_SERVICE_MODELS_BUCKET,
178
+ CONDA_BUCKET_NS,
179
+ custom_metadata.value,
180
+ ).path
181
+ return artifact_path
182
+ except Exception as ex:
183
+ logger.debug(ex)
184
+
220
185
  logger.debug("Failed to get artifact path from custom metadata.")
221
186
  return UNKNOWN
222
187
 
@@ -260,12 +225,10 @@ def is_valid_ocid(ocid: str) -> bool:
260
225
  bool:
261
226
  Whether the given ocid is valid.
262
227
  """
263
- # TODO: revisit pattern
264
- pattern = (
265
- r"^ocid1\.([a-z0-9_]+)\.([a-z0-9]+)\.([a-z0-9-]*)(\.[^.]+)?\.([a-z0-9_]+)$"
266
- )
267
- match = re.match(pattern, ocid)
268
- return True
228
+
229
+ if not ocid:
230
+ return False
231
+ return ocid.lower().startswith("ocid")
269
232
 
270
233
 
271
234
  def get_resource_type(ocid: str) -> str:
@@ -520,6 +483,19 @@ def _build_job_identifier(
520
483
  return AquaResourceIdentifier()
521
484
 
522
485
 
486
+ def container_config_path():
487
+ return f"oci://{AQUA_SERVICE_MODELS_BUCKET}@{CONDA_BUCKET_NS}/service_models/config"
488
+
489
+
490
+ def get_container_config():
491
+ config = load_config(
492
+ file_path=container_config_path(),
493
+ config_file_name=CONTAINER_INDEX,
494
+ )
495
+
496
+ return config
497
+
498
+
523
499
  def get_container_image(
524
500
  config_file_name: str = None, container_type: str = None
525
501
  ) -> str:
@@ -537,14 +513,8 @@ def get_container_image(
537
513
  A dict of allowed configs.
538
514
  """
539
515
 
540
- config_file_name = (
541
- f"oci://{AQUA_SERVICE_MODELS_BUCKET}@{CONDA_BUCKET_NS}/service_models/config"
542
- )
543
-
544
- config = load_config(
545
- file_path=config_file_name,
546
- config_file_name=CONTAINER_INDEX,
547
- )
516
+ config = config_file_name or get_container_config()
517
+ config_file_name = container_config_path()
548
518
 
549
519
  if container_type not in config:
550
520
  raise AquaValueError(
@@ -582,9 +552,10 @@ def fetch_service_compartment() -> Union[str, None]:
582
552
  file_path=config_file_name,
583
553
  config_file_name=CONTAINER_INDEX,
584
554
  )
585
- except AquaFileNotFoundError:
586
- logger.error(
587
- f"Config file {config_file_name}/{CONTAINER_INDEX} to fetch service compartment OCID could not be found."
555
+ except Exception as e:
556
+ logger.debug(
557
+ f"Config file {config_file_name}/{CONTAINER_INDEX} to fetch service compartment OCID could not be found. "
558
+ f"\n{str(e)}."
588
559
  )
589
560
  return
590
561
  compartment_mapping = config.get(COMPARTMENT_MAPPING_KEY)
@@ -749,3 +720,124 @@ def get_ocid_substring(ocid: str, key_len: int) -> str:
749
720
  """This helper function returns the last n characters of the ocid specified by key_len parameter.
750
721
  If ocid is None or length is less than key_len, it returns an empty string."""
751
722
  return ocid[-key_len:] if ocid and len(ocid) > key_len else ""
723
+
724
+
725
+ def is_service_managed_container(container):
726
+ return container and container.startswith(SERVICE_MANAGED_CONTAINER_URI_SCHEME)
727
+
728
+
729
+ def get_params_list(params: str) -> List[str]:
730
+ """Parses the string parameter and returns a list of params.
731
+
732
+ Parameters
733
+ ----------
734
+ params
735
+ string parameters by separated by -- delimiter
736
+
737
+ Returns
738
+ -------
739
+ list of params
740
+
741
+ """
742
+ if not params:
743
+ return []
744
+ return ["--" + param.strip() for param in params.split("--")[1:]]
745
+
746
+
747
+ def get_params_dict(params: Union[str, List[str]]) -> dict:
748
+ """Accepts a string or list of string of double-dash parameters and returns a dict with the parameter keys and values.
749
+
750
+ Parameters
751
+ ----------
752
+ params:
753
+ List of parameters or parameter string separated by space.
754
+
755
+ Returns
756
+ -------
757
+ dict containing parameter keys and values
758
+
759
+ """
760
+ params_list = get_params_list(params) if isinstance(params, str) else params
761
+ return {
762
+ split_result[0]: split_result[1] if len(split_result) > 1 else UNKNOWN
763
+ for split_result in (x.split() for x in params_list)
764
+ }
765
+
766
+
767
+ def get_combined_params(params1: str = None, params2: str = None) -> str:
768
+ """
769
+ Combines string of double-dash parameters, and overrides the values from the second string in the first.
770
+ Parameters
771
+ ----------
772
+ params1:
773
+ Parameter string with values
774
+ params2:
775
+ Parameter string with values that need to be overridden.
776
+
777
+ Returns
778
+ -------
779
+ A combined list with overridden values from params2.
780
+ """
781
+ if not params1:
782
+ return params2
783
+ if not params2:
784
+ return params1
785
+
786
+ # overwrite values from params2 into params1
787
+ combined_params = [
788
+ f"{key} {value}" if value else key
789
+ for key, value in {
790
+ **get_params_dict(params1),
791
+ **get_params_dict(params2),
792
+ }.items()
793
+ ]
794
+
795
+ return " ".join(combined_params)
796
+
797
+
798
+ def copy_model_config(artifact_path: str, os_path: str, auth: dict = None):
799
+ """Copies the aqua model config folder from the artifact path to the user provided object storage path.
800
+ The config folder is overwritten if the files already exist at the destination path.
801
+
802
+ Parameters
803
+ ----------
804
+ artifact_path:
805
+ Path of the aqua model where config folder is available.
806
+ os_path:
807
+ User provided path where config folder will be copied.
808
+ auth: (Dict, optional). Defaults to None.
809
+ The default authentication is set using `ads.set_auth` API. If you need to override the
810
+ default, use the `ads.common.auth.api_keys` or `ads.common.auth.resource_principal` to create appropriate
811
+ authentication signer and kwargs required to instantiate IdentityClient object.
812
+
813
+ Returns
814
+ -------
815
+ None
816
+ Nothing.
817
+ """
818
+
819
+ try:
820
+ source_dir = ObjectStorageDetails(
821
+ AQUA_SERVICE_MODELS_BUCKET,
822
+ CONDA_BUCKET_NS,
823
+ f"{os.path.dirname(artifact_path).rstrip('/')}/config",
824
+ ).path
825
+ dest_dir = f"{os_path.rstrip('/')}/config"
826
+
827
+ oss_details = ObjectStorageDetails.from_path(source_dir)
828
+ objects = oss_details.list_objects(fields="name").objects
829
+
830
+ for obj in objects:
831
+ source_path = ObjectStorageDetails(
832
+ AQUA_SERVICE_MODELS_BUCKET, CONDA_BUCKET_NS, obj.name
833
+ ).path
834
+ destination_path = os.path.join(dest_dir, os.path.basename(obj.name))
835
+ copy_file(
836
+ uri_src=source_path,
837
+ uri_dst=destination_path,
838
+ force_overwrite=True,
839
+ auth=auth,
840
+ )
841
+ except Exception as ex:
842
+ logger.debug(ex)
843
+ logger.debug(f"Failed to copy config folder from {artifact_path} to {os_path}.")
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
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
+
7
+ # TODO: move this to global config.json in object storage
8
+ def get_finetuning_config_defaults():
9
+ """Generate and return the fine-tuning default configuration dictionary."""
10
+ return {
11
+ "shape": {
12
+ "VM.GPU.A10.1": {"batch_size": 1, "replica": "1-10"},
13
+ "VM.GPU.A10.2": {"batch_size": 1, "replica": "1-10"},
14
+ "BM.GPU.A10.4": {"batch_size": 1, "replica": 1},
15
+ "BM.GPU4.8": {"batch_size": 4, "replica": 1},
16
+ "BM.GPU.A100-v2.8": {"batch_size": 6, "replica": 1},
17
+ }
18
+ }
ads/aqua/constants.py CHANGED
@@ -3,43 +3,61 @@
3
3
  # Copyright (c) 2024 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
  """This module defines constants used in ads.aqua module."""
6
- from enum import Enum
7
6
 
7
+ UNKNOWN = ""
8
8
  UNKNOWN_VALUE = ""
9
-
10
-
11
- class RqsAdditionalDetails:
12
- METADATA = "metadata"
13
- CREATED_BY = "createdBy"
14
- DESCRIPTION = "description"
15
- MODEL_VERSION_SET_ID = "modelVersionSetId"
16
- MODEL_VERSION_SET_NAME = "modelVersionSetName"
17
- PROJECT_ID = "projectId"
18
- VERSION_LABEL = "versionLabel"
19
-
20
-
21
- class FineTuningDefinedMetadata(Enum):
22
- """Represents the defined metadata keys used in Fine Tuning."""
23
-
24
- VAL_SET_SIZE = "val_set_size"
25
- TRAINING_DATA = "training_data"
26
-
27
-
28
- class FineTuningCustomMetadata(Enum):
29
- """Represents the custom metadata keys used in Fine Tuning."""
30
-
31
- FT_SOURCE = "fine_tune_source"
32
- FT_SOURCE_NAME = "fine_tune_source_name"
33
- FT_OUTPUT_PATH = "fine_tune_output_path"
34
- FT_JOB_ID = "fine_tune_job_id"
35
- FT_JOB_RUN_ID = "fine_tune_jobrun_id"
36
- TRAINING_METRICS_FINAL = "train_metrics_final"
37
- VALIDATION_METRICS_FINAL = "val_metrics_final"
38
- TRAINING_METRICS_EPOCH = "train_metrics_epoch"
39
- VALIDATION_METRICS_EPOCH = "val_metrics_epoch"
40
-
9
+ READY_TO_IMPORT_STATUS = "TRUE"
10
+ UNKNOWN_DICT = {}
11
+ README = "README.md"
12
+ LICENSE_TXT = "config/LICENSE.txt"
13
+ DEPLOYMENT_CONFIG = "deployment_config.json"
14
+ COMPARTMENT_MAPPING_KEY = "service-model-compartment"
15
+ CONTAINER_INDEX = "container_index.json"
16
+ EVALUATION_REPORT_JSON = "report.json"
17
+ EVALUATION_REPORT_MD = "report.md"
18
+ EVALUATION_REPORT = "report.html"
19
+ UNKNOWN_JSON_STR = "{}"
20
+ FINE_TUNING_RUNTIME_CONTAINER = "iad.ocir.io/ociodscdev/aqua_ft_cuda121:0.3.17.20"
21
+ DEFAULT_FT_BLOCK_STORAGE_SIZE = 750
22
+ DEFAULT_FT_REPLICA = 1
23
+ DEFAULT_FT_BATCH_SIZE = 1
24
+ DEFAULT_FT_VALIDATION_SET_SIZE = 0.1
25
+
26
+ MAXIMUM_ALLOWED_DATASET_IN_BYTE = 52428800 # 1024 x 1024 x 50 = 50MB
27
+ JOB_INFRASTRUCTURE_TYPE_DEFAULT_NETWORKING = "ME_STANDALONE"
28
+ NB_SESSION_IDENTIFIER = "NB_SESSION_OCID"
29
+ LIFECYCLE_DETAILS_MISSING_JOBRUN = "The asscociated JobRun resource has been deleted."
30
+ READY_TO_DEPLOY_STATUS = "ACTIVE"
31
+ READY_TO_FINE_TUNE_STATUS = "TRUE"
32
+ AQUA_GA_LIST = ["id19sfcrra6z"]
33
+ AQUA_MODEL_TYPE_SERVICE = "service"
34
+ AQUA_MODEL_TYPE_CUSTOM = "custom"
35
+ AQUA_MODEL_ARTIFACT_CONFIG = "config.json"
36
+ AQUA_MODEL_ARTIFACT_CONFIG_MODEL_NAME = "_name_or_path"
37
+ AQUA_MODEL_ARTIFACT_CONFIG_MODEL_TYPE = "model_type"
41
38
 
42
39
  TRAINING_METRICS_FINAL = "training_metrics_final"
43
40
  VALIDATION_METRICS_FINAL = "validation_metrics_final"
44
41
  TRINING_METRICS = "training_metrics"
45
42
  VALIDATION_METRICS = "validation_metrics"
43
+
44
+ SERVICE_MANAGED_CONTAINER_URI_SCHEME = "dsmc://"
45
+ SUPPORTED_FILE_FORMATS = ["jsonl"]
46
+ MODEL_BY_REFERENCE_OSS_PATH_KEY = "artifact_location"
47
+
48
+ CONSOLE_LINK_RESOURCE_TYPE_MAPPING = dict(
49
+ datasciencemodel="models",
50
+ datasciencemodeldeployment="model-deployments",
51
+ datasciencemodeldeploymentdev="model-deployments",
52
+ datasciencemodeldeploymentint="model-deployments",
53
+ datasciencemodeldeploymentpre="model-deployments",
54
+ datasciencejob="jobs",
55
+ datasciencejobrun="job-runs",
56
+ datasciencejobrundev="job-runs",
57
+ datasciencejobrunint="job-runs",
58
+ datasciencejobrunpre="job-runs",
59
+ datasciencemodelversionset="model-version-sets",
60
+ datasciencemodelversionsetpre="model-version-sets",
61
+ datasciencemodelversionsetint="model-version-sets",
62
+ datasciencemodelversionsetdev="model-version-sets",
63
+ )
ads/aqua/data.py CHANGED
@@ -3,8 +3,7 @@
3
3
  # Copyright (c) 2024 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 dataclasses import dataclass
7
- from enum import Enum
6
+ from dataclasses import dataclass, field
8
7
 
9
8
  from ads.common.serializer import DataClassSerializable
10
9
 
@@ -16,27 +15,17 @@ class AquaResourceIdentifier(DataClassSerializable):
16
15
  url: str = ""
17
16
 
18
17
 
19
- class Resource(Enum):
20
- JOB = "jobs"
21
- JOBRUN = "jobruns"
22
- MODEL = "models"
23
- MODEL_DEPLOYMENT = "modeldeployments"
24
- MODEL_VERSION_SET = "model-version-sets"
25
-
26
-
27
- class DataScienceResource(Enum):
28
- MODEL_DEPLOYMENT = "datasciencemodeldeployment"
29
- MODEL = "datasciencemodel"
30
-
31
-
32
- class Tags(Enum):
33
- TASK = "task"
34
- LICENSE = "license"
35
- ORGANIZATION = "organization"
36
- AQUA_TAG = "OCI_AQUA"
37
- AQUA_SERVICE_MODEL_TAG = "aqua_service_model"
38
- AQUA_FINE_TUNED_MODEL_TAG = "aqua_fine_tuned_model"
39
- AQUA_MODEL_NAME_TAG = "aqua_model_name"
40
- AQUA_EVALUATION = "aqua_evaluation"
41
- AQUA_FINE_TUNING = "aqua_finetuning"
42
- READY_TO_FINE_TUNE = "ready_to_fine_tune"
18
+ @dataclass(repr=False)
19
+ class AquaJobSummary(DataClassSerializable):
20
+ """Represents an Aqua job summary."""
21
+
22
+ id: str
23
+ name: str
24
+ console_url: str
25
+ lifecycle_state: str
26
+ lifecycle_details: str
27
+ time_created: str
28
+ tags: dict
29
+ experiment: AquaResourceIdentifier = field(default_factory=AquaResourceIdentifier)
30
+ source: AquaResourceIdentifier = field(default_factory=AquaResourceIdentifier)
31
+ job: AquaResourceIdentifier = field(default_factory=AquaResourceIdentifier)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*--
3
+
4
+ # Copyright (c) 2024 Oracle and/or its affiliates.
5
+ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
+ from ads.aqua.evaluation.evaluation import AquaEvaluationApp
7
+
8
+ __all__ = ["AquaEvaluationApp"]
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
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
+ """
7
+ aqua.evaluation.const
8
+ ~~~~~~~~~~~~~~
9
+
10
+ This module contains constants/enums used in Aqua Evaluation.
11
+ """
12
+ from oci.data_science.models import JobRun
13
+
14
+ from ads.common.extended_enum import ExtendedEnumMeta
15
+
16
+ EVAL_TERMINATION_STATE = [
17
+ JobRun.LIFECYCLE_STATE_SUCCEEDED,
18
+ JobRun.LIFECYCLE_STATE_FAILED,
19
+ ]
20
+
21
+
22
+ class EvaluationCustomMetadata(str, metaclass=ExtendedEnumMeta):
23
+ EVALUATION_SOURCE = "evaluation_source"
24
+ EVALUATION_JOB_ID = "evaluation_job_id"
25
+ EVALUATION_JOB_RUN_ID = "evaluation_job_run_id"
26
+ EVALUATION_OUTPUT_PATH = "evaluation_output_path"
27
+ EVALUATION_SOURCE_NAME = "evaluation_source_name"
28
+ EVALUATION_ERROR = "aqua_evaluate_error"
29
+
30
+
31
+ class EvaluationConfig(str, metaclass=ExtendedEnumMeta):
32
+ PARAMS = "model_params"
33
+
34
+
35
+ class EvaluationReportJson(str, metaclass=ExtendedEnumMeta):
36
+ """Contains evaluation report.json fields name."""
37
+
38
+ METRIC_SUMMARY_RESULT = "metric_summary_result"
39
+ METRIC_RESULT = "metric_results"
40
+ MODEL_PARAMS = "model_params"
41
+ MODEL_DETAILS = "model_details"
42
+ DATA = "data"
43
+ DATASET = "dataset"
44
+
45
+
46
+ class EvaluationMetricResult(str, metaclass=ExtendedEnumMeta):
47
+ """Contains metric result's fields name in report.json."""
48
+
49
+ SHORT_NAME = "key"
50
+ NAME = "name"
51
+ DESCRIPTION = "description"
52
+ SUMMARY_DATA = "summary_data"
53
+ DATA = "data"