Skip to content

Commit 5af99de

Browse files
committed
Merge branch 'main' of github.com:oracle/accelerated-data-science into feature/ms_backup_retention
2 parents b5b5ecf + 5b52216 commit 5af99de

File tree

17 files changed

+349
-259
lines changed

17 files changed

+349
-259
lines changed

ads/aqua/config/config.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,3 @@ def get_evaluation_service_config(
2929
.get(ContainerSpec.CONTAINER_SPEC, {})
3030
.get(container, {})
3131
)
32-
33-
34-
# TODO: move this to global config.json in object storage
35-
def get_finetuning_config_defaults():
36-
"""Generate and return the fine-tuning default configuration dictionary."""
37-
return {
38-
"shape": {
39-
"VM.GPU.A10.1": {"batch_size": 1, "replica": "1-10"},
40-
"VM.GPU.A10.2": {"batch_size": 1, "replica": "1-10"},
41-
"BM.GPU.A10.4": {"batch_size": 1, "replica": 1},
42-
"BM.GPU4.8": {"batch_size": 4, "replica": 1},
43-
"BM.GPU.L40S-NC.4": {"batch_size": 4, "replica": 1},
44-
"BM.GPU.A100-v2.8": {"batch_size": 6, "replica": 1},
45-
"BM.GPU.H100.8": {"batch_size": 6, "replica": 1},
46-
}
47-
}

ads/aqua/config/deployment_config_defaults.json

Lines changed: 0 additions & 38 deletions
This file was deleted.

ads/aqua/config/resource_limit_names.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

ads/aqua/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
LIFECYCLE_DETAILS_MISSING_JOBRUN = "The associated JobRun resource has been deleted."
2828
READY_TO_DEPLOY_STATUS = "ACTIVE"
2929
READY_TO_FINE_TUNE_STATUS = "TRUE"
30+
PRIVATE_ENDPOINT_TYPE = "MODEL_DEPLOYMENT"
3031
AQUA_GA_LIST = ["id19sfcrra6z"]
3132
AQUA_MODEL_TYPE_SERVICE = "service"
3233
AQUA_MODEL_TYPE_CUSTOM = "custom"

ads/aqua/extension/finetune_handler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
# Copyright (c) 2024 Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
54

@@ -9,8 +8,8 @@
98
from tornado.web import HTTPError
109

1110
from ads.aqua.common.decorator import handle_exceptions
12-
from ads.aqua.extension.errors import Errors
1311
from ads.aqua.extension.base_handler import AquaAPIhandler
12+
from ads.aqua.extension.errors import Errors
1413
from ads.aqua.extension.utils import validate_function_parameters
1514
from ads.aqua.finetuning import AquaFineTuningApp
1615
from ads.aqua.finetuning.entities import CreateFineTuningDetails

ads/aqua/extension/ui_handler.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
# Copyright (c) 2024 Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
54

@@ -10,8 +9,9 @@
109

1110
from ads.aqua.common.decorator import handle_exceptions
1211
from ads.aqua.common.enums import Tags
13-
from ads.aqua.extension.errors import Errors
12+
from ads.aqua.constants import PRIVATE_ENDPOINT_TYPE
1413
from ads.aqua.extension.base_handler import AquaAPIhandler
14+
from ads.aqua.extension.errors import Errors
1515
from ads.aqua.extension.utils import validate_function_parameters
1616
from ads.aqua.model.entities import ImportModelDetails
1717
from ads.aqua.ui import AquaUIApp
@@ -72,6 +72,8 @@ def get(self, id=""):
7272
return self.list_vcn()
7373
elif paths.startswith("aqua/subnets"):
7474
return self.list_subnets()
75+
elif paths.startswith("aqua/privateendpoints"):
76+
return self.list_private_endpoints()
7577
elif paths.startswith("aqua/shapes/limit"):
7678
return self.get_shape_availability()
7779
elif paths.startswith("aqua/bucket/versioning"):
@@ -175,15 +177,31 @@ def list_subnets(self, **kwargs):
175177
)
176178
)
177179

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+
178192
def get_shape_availability(self, **kwargs):
179193
"""For a given compartmentId, resource limit name, and scope, returns the number of available resources associated
180194
with the given limit."""
181195
compartment_id = self.get_argument("compartment_id", default=COMPARTMENT_OCID)
182196
instance_shape = self.get_argument("instance_shape")
197+
limit_name = self.get_argument("limit_name")
183198

184199
return self.finish(
185200
AquaUIApp().get_shape_availability(
186-
compartment_id=compartment_id, instance_shape=instance_shape, **kwargs
201+
compartment_id=compartment_id,
202+
instance_shape=instance_shape,
203+
limit_name=limit_name,
204+
**kwargs,
187205
)
188206
)
189207

@@ -244,6 +262,7 @@ def post(self, *args, **kwargs):
244262
("job/shapes/?([^/]*)", AquaUIHandler),
245263
("vcn/?([^/]*)", AquaUIHandler),
246264
("subnets/?([^/]*)", AquaUIHandler),
265+
("privateendpoints/?([^/]*)", AquaUIHandler),
247266
("shapes/limit/?([^/]*)", AquaUIHandler),
248267
("bucket/versioning/?([^/]*)", AquaUIHandler),
249268
("containers/?([^/]*)", AquaUIHandler),

ads/aqua/finetuning/entities.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
# Copyright (c) 2024 Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
54
from dataclasses import dataclass, field
@@ -14,16 +13,18 @@ class AquaFineTuningParams(DataClassSerializable):
1413
epochs: int
1514
learning_rate: Optional[float] = None
1615
sample_packing: Optional[bool] = "auto"
17-
batch_size: Optional[
18-
int
19-
] = None # make it batch_size for user, but internally this is micro_batch_size
16+
batch_size: Optional[int] = (
17+
None # make it batch_size for user, but internally this is micro_batch_size
18+
)
2019
sequence_len: Optional[int] = None
2120
pad_to_sequence_len: Optional[bool] = None
2221
lora_r: Optional[int] = None
2322
lora_alpha: Optional[int] = None
2423
lora_dropout: Optional[float] = None
2524
lora_target_linear: Optional[bool] = None
2625
lora_target_modules: Optional[List] = None
26+
early_stopping_patience: Optional[int] = None
27+
early_stopping_threshold: Optional[float] = None
2728

2829

2930
@dataclass(repr=False)

ads/aqua/finetuning/finetuning.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
# Copyright (c) 2024 Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
54

65
import json
76
import os
8-
from dataclasses import asdict, fields, MISSING
7+
from dataclasses import MISSING, asdict, fields
98
from typing import Dict
109

1110
from oci.data_science.models import (
@@ -14,7 +13,7 @@
1413
UpdateModelProvenanceDetails,
1514
)
1615

17-
from ads.aqua import ODSC_MODEL_COMPARTMENT_OCID, logger
16+
from ads.aqua import logger
1817
from ads.aqua.app import AquaApp
1918
from ads.aqua.common.enums import Resource, Tags
2019
from ads.aqua.common.errors import AquaFileExistsError, AquaValueError
@@ -31,7 +30,6 @@
3130
UNKNOWN,
3231
UNKNOWN_DICT,
3332
)
34-
from ads.aqua.config.config import get_finetuning_config_defaults
3533
from ads.aqua.data import AquaResourceIdentifier
3634
from ads.aqua.finetuning.constants import *
3735
from ads.aqua.finetuning.entities import *
@@ -132,7 +130,7 @@ def create(
132130
or create_fine_tuning_details.validation_set_size >= 1
133131
):
134132
raise AquaValueError(
135-
f"Fine tuning validation set size should be a float number in between [0, 1)."
133+
"Fine tuning validation set size should be a float number in between [0, 1)."
136134
)
137135

138136
if create_fine_tuning_details.replica < DEFAULT_FT_REPLICA:
@@ -394,7 +392,7 @@ def create(
394392
)
395393
# track shapes that were used for fine-tune creation
396394
self.telemetry.record_event_async(
397-
category=f"aqua/service/finetune/create/shape/",
395+
category="aqua/service/finetune/create/shape/",
398396
action=f"{create_fine_tuning_details.shape_name}x{create_fine_tuning_details.replica}",
399397
**telemetry_kwargs,
400398
)
@@ -533,6 +531,12 @@ def _build_oci_launch_cmd(
533531
oci_launch_cmd += f"--num_{key} {value} "
534532
elif key == "lora_target_modules":
535533
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} "
536540
else:
537541
oci_launch_cmd += f"--{key} {value} "
538542

@@ -558,8 +562,9 @@ def get_finetuning_config(self, model_id: str) -> Dict:
558562

559563
config = self.get_config(model_id, AQUA_MODEL_FINETUNING_CONFIG)
560564
if not config:
561-
logger.info(f"Fetching default fine-tuning config for model: {model_id}")
562-
config = get_finetuning_config_defaults()
565+
logger.debug(
566+
f"Fine-tuning config for custom model: {model_id} is not available."
567+
)
563568
return config
564569

565570
@telemetry(

0 commit comments

Comments
 (0)