oracle-ads 2.12.8__py3-none-any.whl → 2.12.10rc0__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/__init__.py +4 -4
- ads/aqua/app.py +12 -2
- ads/aqua/common/enums.py +3 -0
- ads/aqua/common/utils.py +62 -2
- ads/aqua/data.py +2 -19
- ads/aqua/evaluation/entities.py +6 -0
- ads/aqua/evaluation/evaluation.py +25 -3
- ads/aqua/extension/deployment_handler.py +8 -4
- ads/aqua/extension/finetune_handler.py +8 -14
- ads/aqua/extension/model_handler.py +25 -6
- ads/aqua/extension/ui_handler.py +13 -1
- ads/aqua/finetuning/constants.py +5 -2
- ads/aqua/finetuning/entities.py +70 -17
- ads/aqua/finetuning/finetuning.py +79 -82
- ads/aqua/model/entities.py +4 -1
- ads/aqua/model/model.py +95 -29
- ads/aqua/modeldeployment/deployment.py +13 -1
- ads/aqua/modeldeployment/entities.py +7 -4
- ads/aqua/ui.py +24 -2
- ads/common/auth.py +9 -9
- ads/llm/autogen/__init__.py +2 -0
- ads/llm/autogen/constants.py +15 -0
- ads/llm/autogen/reports/__init__.py +2 -0
- ads/llm/autogen/reports/base.py +67 -0
- ads/llm/autogen/reports/data.py +103 -0
- ads/llm/autogen/reports/session.py +526 -0
- ads/llm/autogen/reports/templates/chat_box.html +13 -0
- ads/llm/autogen/reports/templates/chat_box_lt.html +5 -0
- ads/llm/autogen/reports/templates/chat_box_rt.html +6 -0
- ads/llm/autogen/reports/utils.py +56 -0
- ads/llm/autogen/v02/__init__.py +4 -0
- ads/llm/autogen/{client_v02.py → v02/client.py} +23 -10
- ads/llm/autogen/v02/log_handlers/__init__.py +2 -0
- ads/llm/autogen/v02/log_handlers/oci_file_handler.py +83 -0
- ads/llm/autogen/v02/loggers/__init__.py +6 -0
- ads/llm/autogen/v02/loggers/metric_logger.py +320 -0
- ads/llm/autogen/v02/loggers/session_logger.py +580 -0
- ads/llm/autogen/v02/loggers/utils.py +86 -0
- ads/llm/autogen/v02/runtime_logging.py +163 -0
- ads/llm/guardrails/base.py +6 -5
- ads/llm/langchain/plugins/chat_models/oci_data_science.py +46 -20
- ads/llm/langchain/plugins/llms/oci_data_science_model_deployment_endpoint.py +38 -11
- ads/model/__init__.py +11 -13
- ads/model/artifact.py +47 -8
- ads/model/extractor/embedding_onnx_extractor.py +80 -0
- ads/model/framework/embedding_onnx_model.py +438 -0
- ads/model/generic_model.py +26 -24
- ads/model/model_metadata.py +8 -7
- ads/opctl/config/merger.py +13 -14
- ads/opctl/operator/common/operator_config.py +4 -4
- ads/opctl/operator/lowcode/common/transformations.py +12 -5
- ads/opctl/operator/lowcode/common/utils.py +11 -5
- ads/opctl/operator/lowcode/forecast/const.py +3 -0
- ads/opctl/operator/lowcode/forecast/model/arima.py +19 -13
- ads/opctl/operator/lowcode/forecast/model/automlx.py +129 -36
- ads/opctl/operator/lowcode/forecast/model/autots.py +1 -0
- ads/opctl/operator/lowcode/forecast/model/base_model.py +58 -17
- ads/opctl/operator/lowcode/forecast/model/neuralprophet.py +10 -3
- ads/opctl/operator/lowcode/forecast/model/prophet.py +25 -18
- ads/opctl/operator/lowcode/forecast/model_evaluator.py +3 -2
- ads/opctl/operator/lowcode/forecast/schema.yaml +13 -0
- ads/opctl/operator/lowcode/forecast/utils.py +8 -6
- ads/telemetry/base.py +18 -11
- ads/telemetry/client.py +33 -13
- ads/templates/schemas/openapi.json +1740 -0
- ads/templates/score_embedding_onnx.jinja2 +202 -0
- {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10rc0.dist-info}/METADATA +9 -10
- {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10rc0.dist-info}/RECORD +71 -50
- {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10rc0.dist-info}/LICENSE.txt +0 -0
- {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10rc0.dist-info}/WHEEL +0 -0
- {oracle_ads-2.12.8.dist-info → oracle_ads-2.12.10rc0.dist-info}/entry_points.txt +0 -0
ads/aqua/finetuning/entities.py
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
|
-
# Copyright (c) 2024 Oracle and/or its affiliates.
|
2
|
+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
|
3
3
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
4
|
-
from dataclasses import dataclass, field
|
5
|
-
from typing import List, Optional
|
6
4
|
|
7
|
-
|
8
|
-
from
|
5
|
+
import json
|
6
|
+
from typing import List, Literal, Optional, Union
|
9
7
|
|
8
|
+
from pydantic import Field, model_validator
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
from ads.aqua.common.errors import AquaValueError
|
11
|
+
from ads.aqua.config.utils.serializer import Serializable
|
12
|
+
from ads.aqua.data import AquaResourceIdentifier
|
13
|
+
from ads.aqua.finetuning.constants import FineTuningRestrictedParams
|
14
|
+
|
15
|
+
|
16
|
+
class AquaFineTuningParams(Serializable):
|
17
|
+
"""Class for maintaining aqua fine-tuning model parameters"""
|
18
|
+
|
19
|
+
epochs: Optional[int] = None
|
14
20
|
learning_rate: Optional[float] = None
|
15
|
-
sample_packing:
|
21
|
+
sample_packing: Union[bool, None, Literal["auto"]] = "auto"
|
16
22
|
batch_size: Optional[int] = (
|
17
23
|
None # make it batch_size for user, but internally this is micro_batch_size
|
18
24
|
)
|
@@ -22,21 +28,59 @@ class AquaFineTuningParams(DataClassSerializable):
|
|
22
28
|
lora_alpha: Optional[int] = None
|
23
29
|
lora_dropout: Optional[float] = None
|
24
30
|
lora_target_linear: Optional[bool] = None
|
25
|
-
lora_target_modules: Optional[List] = None
|
31
|
+
lora_target_modules: Optional[List[str]] = None
|
26
32
|
early_stopping_patience: Optional[int] = None
|
27
33
|
early_stopping_threshold: Optional[float] = None
|
28
34
|
|
35
|
+
class Config:
|
36
|
+
extra = "allow"
|
37
|
+
|
38
|
+
def to_dict(self) -> dict:
|
39
|
+
return json.loads(super().to_json(exclude_none=True))
|
40
|
+
|
41
|
+
@model_validator(mode="before")
|
42
|
+
@classmethod
|
43
|
+
def validate_restricted_fields(cls, data: dict):
|
44
|
+
# we may want to skip validation if loading data from config files instead of user entered parameters
|
45
|
+
validate = data.pop("_validate", True)
|
46
|
+
if not (validate and isinstance(data, dict)):
|
47
|
+
return data
|
48
|
+
restricted_params = [
|
49
|
+
param for param in data if param in FineTuningRestrictedParams.values()
|
50
|
+
]
|
51
|
+
if restricted_params:
|
52
|
+
raise AquaValueError(
|
53
|
+
f"Found restricted parameter name: {restricted_params}"
|
54
|
+
)
|
55
|
+
return data
|
29
56
|
|
30
|
-
@dataclass(repr=False)
|
31
|
-
class AquaFineTuningSummary(AquaJobSummary, DataClassSerializable):
|
32
|
-
parameters: AquaFineTuningParams = field(default_factory=AquaFineTuningParams)
|
33
57
|
|
58
|
+
class AquaFineTuningSummary(Serializable):
|
59
|
+
"""Represents a summary of Aqua Finetuning job."""
|
34
60
|
|
35
|
-
|
36
|
-
|
37
|
-
|
61
|
+
id: str
|
62
|
+
name: str
|
63
|
+
console_url: str
|
64
|
+
lifecycle_state: str
|
65
|
+
lifecycle_details: str
|
66
|
+
time_created: str
|
67
|
+
tags: dict
|
68
|
+
experiment: AquaResourceIdentifier = Field(default_factory=AquaResourceIdentifier)
|
69
|
+
source: AquaResourceIdentifier = Field(default_factory=AquaResourceIdentifier)
|
70
|
+
job: AquaResourceIdentifier = Field(default_factory=AquaResourceIdentifier)
|
71
|
+
parameters: AquaFineTuningParams = Field(default_factory=AquaFineTuningParams)
|
38
72
|
|
39
|
-
|
73
|
+
class Config:
|
74
|
+
extra = "ignore"
|
75
|
+
|
76
|
+
def to_dict(self) -> dict:
|
77
|
+
return json.loads(super().to_json(exclude_none=True))
|
78
|
+
|
79
|
+
|
80
|
+
class CreateFineTuningDetails(Serializable):
|
81
|
+
"""Class to create aqua model fine-tuning instance.
|
82
|
+
|
83
|
+
Properties
|
40
84
|
------
|
41
85
|
ft_source_id: str
|
42
86
|
The fine tuning source id. Must be model ocid.
|
@@ -80,6 +124,10 @@ class CreateFineTuningDetails(DataClassSerializable):
|
|
80
124
|
The log id for fine tuning job infrastructure.
|
81
125
|
force_overwrite: (bool, optional). Defaults to `False`.
|
82
126
|
Whether to force overwrite the existing file in object storage.
|
127
|
+
freeform_tags: (dict, optional)
|
128
|
+
Freeform tags for the fine-tuning model
|
129
|
+
defined_tags: (dict, optional)
|
130
|
+
Defined tags for the fine-tuning model
|
83
131
|
"""
|
84
132
|
|
85
133
|
ft_source_id: str
|
@@ -101,3 +149,8 @@ class CreateFineTuningDetails(DataClassSerializable):
|
|
101
149
|
log_id: Optional[str] = None
|
102
150
|
log_group_id: Optional[str] = None
|
103
151
|
force_overwrite: Optional[bool] = False
|
152
|
+
freeform_tags: Optional[dict] = None
|
153
|
+
defined_tags: Optional[dict] = None
|
154
|
+
|
155
|
+
class Config:
|
156
|
+
extra = "ignore"
|
@@ -1,10 +1,9 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
|
-
# Copyright (c) 2024 Oracle and/or its affiliates.
|
2
|
+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
|
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 json
|
6
6
|
import os
|
7
|
-
from dataclasses import MISSING, asdict, fields
|
8
7
|
from typing import Dict
|
9
8
|
|
10
9
|
from oci.data_science.models import (
|
@@ -12,12 +11,14 @@ from oci.data_science.models import (
|
|
12
11
|
UpdateModelDetails,
|
13
12
|
UpdateModelProvenanceDetails,
|
14
13
|
)
|
14
|
+
from pydantic import ValidationError
|
15
15
|
|
16
16
|
from ads.aqua import logger
|
17
17
|
from ads.aqua.app import AquaApp
|
18
18
|
from ads.aqua.common.enums import Resource, Tags
|
19
19
|
from ads.aqua.common.errors import AquaFileExistsError, AquaValueError
|
20
20
|
from ads.aqua.common.utils import (
|
21
|
+
build_pydantic_error_message,
|
21
22
|
get_container_image,
|
22
23
|
upload_local_to_os,
|
23
24
|
)
|
@@ -35,7 +36,11 @@ from ads.aqua.finetuning.constants import (
|
|
35
36
|
ENV_AQUA_FINE_TUNING_CONTAINER,
|
36
37
|
FineTuneCustomMetadata,
|
37
38
|
)
|
38
|
-
from ads.aqua.finetuning.entities import
|
39
|
+
from ads.aqua.finetuning.entities import (
|
40
|
+
AquaFineTuningParams,
|
41
|
+
AquaFineTuningSummary,
|
42
|
+
CreateFineTuningDetails,
|
43
|
+
)
|
39
44
|
from ads.common.auth import default_signer
|
40
45
|
from ads.common.object_storage_details import ObjectStorageDetails
|
41
46
|
from ads.common.utils import get_console_link
|
@@ -100,23 +105,11 @@ class AquaFineTuningApp(AquaApp):
|
|
100
105
|
if not create_fine_tuning_details:
|
101
106
|
try:
|
102
107
|
create_fine_tuning_details = CreateFineTuningDetails(**kwargs)
|
103
|
-
except:
|
104
|
-
|
105
|
-
field.name for field in fields(CreateFineTuningDetails)
|
106
|
-
).rstrip()
|
108
|
+
except ValidationError as ex:
|
109
|
+
custom_errors = build_pydantic_error_message(ex)
|
107
110
|
raise AquaValueError(
|
108
|
-
"Invalid
|
109
|
-
|
110
|
-
)
|
111
|
-
|
112
|
-
source = self.get_source(create_fine_tuning_details.ft_source_id)
|
113
|
-
|
114
|
-
# todo: revisit validation for fine tuned models
|
115
|
-
# if source.compartment_id != ODSC_MODEL_COMPARTMENT_OCID:
|
116
|
-
# raise AquaValueError(
|
117
|
-
# f"Fine tuning is only supported for Aqua service models in {ODSC_MODEL_COMPARTMENT_OCID}. "
|
118
|
-
# "Use a valid Aqua service model id instead."
|
119
|
-
# )
|
111
|
+
f"Invalid parameters for creating a fine-tuned model. Error details: {custom_errors}."
|
112
|
+
) from ex
|
120
113
|
|
121
114
|
target_compartment = (
|
122
115
|
create_fine_tuning_details.compartment_id or COMPARTMENT_OCID
|
@@ -148,29 +141,18 @@ class AquaFineTuningApp(AquaApp):
|
|
148
141
|
"Specify the subnet id via API or environment variable AQUA_JOB_SUBNET_ID."
|
149
142
|
)
|
150
143
|
|
151
|
-
if create_fine_tuning_details.replica > DEFAULT_FT_REPLICA
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
):
|
156
|
-
raise AquaValueError(
|
157
|
-
f"Logging is required for fine tuning if replica is larger than {DEFAULT_FT_REPLICA}."
|
158
|
-
)
|
159
|
-
|
160
|
-
ft_parameters = None
|
161
|
-
try:
|
162
|
-
ft_parameters = AquaFineTuningParams(
|
163
|
-
**create_fine_tuning_details.ft_parameters,
|
164
|
-
)
|
165
|
-
except:
|
166
|
-
allowed_fine_tuning_parameters = ", ".join(
|
167
|
-
field.name for field in fields(AquaFineTuningParams)
|
168
|
-
).rstrip()
|
144
|
+
if create_fine_tuning_details.replica > DEFAULT_FT_REPLICA and not (
|
145
|
+
create_fine_tuning_details.log_id
|
146
|
+
and create_fine_tuning_details.log_group_id
|
147
|
+
):
|
169
148
|
raise AquaValueError(
|
170
|
-
"
|
171
|
-
f"be a dictionary with keys: {allowed_fine_tuning_parameters}."
|
149
|
+
f"Logging is required for fine tuning if replica is larger than {DEFAULT_FT_REPLICA}."
|
172
150
|
)
|
173
151
|
|
152
|
+
ft_parameters = self._get_finetuning_params(
|
153
|
+
create_fine_tuning_details.ft_parameters
|
154
|
+
)
|
155
|
+
|
174
156
|
experiment_model_version_set_id = create_fine_tuning_details.experiment_id
|
175
157
|
experiment_model_version_set_name = create_fine_tuning_details.experiment_name
|
176
158
|
|
@@ -197,11 +179,11 @@ class AquaFineTuningApp(AquaApp):
|
|
197
179
|
auth=default_signer(),
|
198
180
|
force_overwrite=create_fine_tuning_details.force_overwrite,
|
199
181
|
)
|
200
|
-
except FileExistsError:
|
182
|
+
except FileExistsError as fe:
|
201
183
|
raise AquaFileExistsError(
|
202
184
|
f"Dataset {dataset_file} already exists in {create_fine_tuning_details.report_path}. "
|
203
185
|
"Please use a new dataset file name, report path or set `force_overwrite` as True."
|
204
|
-
)
|
186
|
+
) from fe
|
205
187
|
logger.debug(
|
206
188
|
f"Uploaded local file {ft_dataset_path} to object storage {dst_uri}."
|
207
189
|
)
|
@@ -222,8 +204,12 @@ class AquaFineTuningApp(AquaApp):
|
|
222
204
|
description=create_fine_tuning_details.experiment_description,
|
223
205
|
compartment_id=target_compartment,
|
224
206
|
project_id=target_project,
|
207
|
+
freeform_tags=create_fine_tuning_details.freeform_tags,
|
208
|
+
defined_tags=create_fine_tuning_details.defined_tags,
|
225
209
|
)
|
226
210
|
|
211
|
+
source = self.get_source(create_fine_tuning_details.ft_source_id)
|
212
|
+
|
227
213
|
ft_model_custom_metadata = ModelCustomMetadata()
|
228
214
|
ft_model_custom_metadata.add(
|
229
215
|
key=FineTuneCustomMetadata.FINE_TUNE_SOURCE,
|
@@ -272,6 +258,7 @@ class AquaFineTuningApp(AquaApp):
|
|
272
258
|
ft_job_freeform_tags = {
|
273
259
|
Tags.AQUA_TAG: UNKNOWN,
|
274
260
|
Tags.AQUA_FINE_TUNED_MODEL_TAG: f"{source.id}#{source.display_name}",
|
261
|
+
**(create_fine_tuning_details.freeform_tags or {}),
|
275
262
|
}
|
276
263
|
|
277
264
|
ft_job = Job(name=ft_model.display_name).with_infrastructure(
|
@@ -286,6 +273,7 @@ class AquaFineTuningApp(AquaApp):
|
|
286
273
|
or DEFAULT_FT_BLOCK_STORAGE_SIZE
|
287
274
|
)
|
288
275
|
.with_freeform_tag(**ft_job_freeform_tags)
|
276
|
+
.with_defined_tag(**(create_fine_tuning_details.defined_tags or {}))
|
289
277
|
)
|
290
278
|
|
291
279
|
if not subnet_id:
|
@@ -353,6 +341,7 @@ class AquaFineTuningApp(AquaApp):
|
|
353
341
|
ft_job_run = ft_job.run(
|
354
342
|
name=ft_model.display_name,
|
355
343
|
freeform_tags=ft_job_freeform_tags,
|
344
|
+
defined_tags=create_fine_tuning_details.defined_tags or {},
|
356
345
|
wait=False,
|
357
346
|
)
|
358
347
|
logger.debug(
|
@@ -372,22 +361,25 @@ class AquaFineTuningApp(AquaApp):
|
|
372
361
|
for metadata in ft_model_custom_metadata.to_dict()["data"]
|
373
362
|
]
|
374
363
|
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
364
|
+
model_freeform_tags = source.freeform_tags or {}
|
365
|
+
model_freeform_tags.pop(Tags.LICENSE, None)
|
366
|
+
model_freeform_tags.pop(Tags.BASE_MODEL_CUSTOM, None)
|
367
|
+
|
368
|
+
model_freeform_tags = {
|
369
|
+
**model_freeform_tags,
|
370
|
+
Tags.READY_TO_FINE_TUNE: "false",
|
371
|
+
Tags.AQUA_TAG: UNKNOWN,
|
372
|
+
Tags.AQUA_FINE_TUNED_MODEL_TAG: f"{source.id}#{source.display_name}",
|
373
|
+
**(create_fine_tuning_details.freeform_tags or {}),
|
374
|
+
}
|
375
|
+
model_defined_tags = create_fine_tuning_details.defined_tags or {}
|
380
376
|
|
381
377
|
self.update_model(
|
382
378
|
model_id=ft_model.id,
|
383
379
|
update_model_details=UpdateModelDetails(
|
384
380
|
custom_metadata_list=updated_custom_metadata_list,
|
385
|
-
freeform_tags=
|
386
|
-
|
387
|
-
f"{source.id}#{source.display_name}"
|
388
|
-
),
|
389
|
-
**source_freeform_tags,
|
390
|
-
},
|
381
|
+
freeform_tags=model_freeform_tags,
|
382
|
+
defined_tags=model_defined_tags,
|
391
383
|
),
|
392
384
|
)
|
393
385
|
|
@@ -462,17 +454,15 @@ class AquaFineTuningApp(AquaApp):
|
|
462
454
|
region=self.region,
|
463
455
|
),
|
464
456
|
),
|
465
|
-
tags=
|
466
|
-
aqua_finetuning
|
467
|
-
finetuning_job_id
|
468
|
-
finetuning_source
|
469
|
-
finetuning_experiment_id
|
470
|
-
|
471
|
-
|
472
|
-
key: value
|
473
|
-
for key, value in asdict(ft_parameters).items()
|
474
|
-
if value is not None
|
457
|
+
tags={
|
458
|
+
"aqua_finetuning": Tags.AQUA_FINE_TUNING,
|
459
|
+
"finetuning_job_id": ft_job.id,
|
460
|
+
"finetuning_source": source.id,
|
461
|
+
"finetuning_experiment_id": experiment_model_version_set_id,
|
462
|
+
**model_freeform_tags,
|
463
|
+
**model_defined_tags,
|
475
464
|
},
|
465
|
+
parameters=ft_parameters,
|
476
466
|
)
|
477
467
|
|
478
468
|
def _build_fine_tuning_runtime(
|
@@ -535,7 +525,7 @@ class AquaFineTuningApp(AquaApp):
|
|
535
525
|
) -> str:
|
536
526
|
"""Builds the oci launch cmd for fine tuning container runtime."""
|
537
527
|
oci_launch_cmd = f"--training_data {dataset_path} --output_dir {report_path} --val_set_size {val_set_size} "
|
538
|
-
for key, value in
|
528
|
+
for key, value in parameters.to_dict().items():
|
539
529
|
if value is not None:
|
540
530
|
if key == "batch_size":
|
541
531
|
oci_launch_cmd += f"--micro_{key} {value} "
|
@@ -600,15 +590,36 @@ class AquaFineTuningApp(AquaApp):
|
|
600
590
|
default_params = {"params": {}}
|
601
591
|
finetuning_config = self.get_finetuning_config(model_id)
|
602
592
|
config_parameters = finetuning_config.get("configuration", UNKNOWN_DICT)
|
603
|
-
dataclass_fields =
|
593
|
+
dataclass_fields = self._get_finetuning_params(
|
594
|
+
config_parameters, validate=False
|
595
|
+
).to_dict()
|
604
596
|
for name, value in config_parameters.items():
|
605
|
-
if name == "micro_batch_size":
|
606
|
-
name = "batch_size"
|
607
597
|
if name in dataclass_fields:
|
598
|
+
if name == "micro_batch_size":
|
599
|
+
name = "batch_size"
|
608
600
|
default_params["params"][name] = value
|
609
601
|
|
610
602
|
return default_params
|
611
603
|
|
604
|
+
@staticmethod
|
605
|
+
def _get_finetuning_params(
|
606
|
+
params: Dict = None, validate: bool = True
|
607
|
+
) -> AquaFineTuningParams:
|
608
|
+
"""
|
609
|
+
Get and validate the fine-tuning params, and return an error message if validation fails. In order to skip
|
610
|
+
@model_validator decorator's validation, pass validate=False.
|
611
|
+
"""
|
612
|
+
try:
|
613
|
+
finetuning_params = AquaFineTuningParams(
|
614
|
+
**{**params, **{"_validate": validate}}
|
615
|
+
)
|
616
|
+
except ValidationError as ex:
|
617
|
+
custom_errors = build_pydantic_error_message(ex)
|
618
|
+
raise AquaValueError(
|
619
|
+
f"Invalid finetuning parameters. Error details: {custom_errors}."
|
620
|
+
) from ex
|
621
|
+
return finetuning_params
|
622
|
+
|
612
623
|
def validate_finetuning_params(self, params: Dict = None) -> Dict:
|
613
624
|
"""Validate if the fine-tuning parameters passed by the user can be overridden. Parameter values are not
|
614
625
|
validated, only param keys are validated.
|
@@ -622,19 +633,5 @@ class AquaFineTuningApp(AquaApp):
|
|
622
633
|
-------
|
623
634
|
Return a list of restricted params.
|
624
635
|
"""
|
625
|
-
|
626
|
-
|
627
|
-
**params,
|
628
|
-
)
|
629
|
-
except Exception as e:
|
630
|
-
logger.debug(str(e))
|
631
|
-
allowed_fine_tuning_parameters = ", ".join(
|
632
|
-
f"{field.name} (required)" if field.default is MISSING else field.name
|
633
|
-
for field in fields(AquaFineTuningParams)
|
634
|
-
).rstrip()
|
635
|
-
raise AquaValueError(
|
636
|
-
f"Invalid fine tuning parameters. Allowable parameters are: "
|
637
|
-
f"{allowed_fine_tuning_parameters}."
|
638
|
-
)
|
639
|
-
|
640
|
-
return dict(valid=True)
|
636
|
+
self._get_finetuning_params(params or {})
|
637
|
+
return {"valid": True}
|
ads/aqua/model/entities.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
|
-
# Copyright (c) 2024 Oracle and/or its affiliates.
|
2
|
+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
|
3
3
|
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
4
4
|
|
5
5
|
"""
|
@@ -283,6 +283,7 @@ class ImportModelDetails(CLIBuilderMixin):
|
|
283
283
|
os_path: str
|
284
284
|
download_from_hf: Optional[bool] = True
|
285
285
|
local_dir: Optional[str] = None
|
286
|
+
cleanup_model_cache: Optional[bool] = True
|
286
287
|
inference_container: Optional[str] = None
|
287
288
|
finetuning_container: Optional[str] = None
|
288
289
|
compartment_id: Optional[str] = None
|
@@ -291,6 +292,8 @@ class ImportModelDetails(CLIBuilderMixin):
|
|
291
292
|
inference_container_uri: Optional[str] = None
|
292
293
|
allow_patterns: Optional[List[str]] = None
|
293
294
|
ignore_patterns: Optional[List[str]] = None
|
295
|
+
freeform_tags: Optional[dict] = None
|
296
|
+
defined_tags: Optional[dict] = None
|
294
297
|
|
295
298
|
def __post_init__(self):
|
296
299
|
self._command = "model register"
|