Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
066d555
Added support to create model group.
lu-ohai May 29, 2025
99ef319
Added comments.
lu-ohai May 29, 2025
895112c
Merge branch 'main' of https://github.com/oracle/accelerated-data-sci…
lu-ohai May 29, 2025
f6c2c57
Updated pr and added unit tests.
lu-ohai Jun 10, 2025
41e6d6a
[Model Group] Added support for model group (#1194)
lu-ohai Jun 10, 2025
8b63630
Merge branch 'main' of https://github.com/oracle/accelerated-data-sci…
lu-ohai Jun 26, 2025
395e5ce
Merge branch 'main' of https://github.com/oracle/accelerated-data-sci…
lu-ohai Jul 7, 2025
a84b58b
[AQUA] Integrate aqua to use model group (#1214)
lu-ohai Jul 7, 2025
43d0a37
Merge branch 'main' into feature/model_group
mrDzurb Jul 10, 2025
2d4f16c
Added support for deploy stack model.
lu-ohai Jul 10, 2025
4095c8b
Updated pr.
lu-ohai Jul 16, 2025
41f543e
Added unit tests.
lu-ohai Jul 16, 2025
0797da8
Updated pr.
lu-ohai Jul 21, 2025
190e2d8
Updated pr.
lu-ohai Jul 25, 2025
44e025c
[AQUA] Added support for deploy stack model. (#1223)
lu-ohai Jul 28, 2025
c8bb83a
Added support for ft model v2.
lu-ohai Jul 28, 2025
437a47c
Merge branch 'feature/model_group' of https://github.com/oracle/accel…
lu-ohai Jul 28, 2025
23ff32b
Merge branch 'main' of https://github.com/oracle/accelerated-data-sci…
lu-ohai Jul 29, 2025
97568d5
Fixed import error.
lu-ohai Jul 29, 2025
c9e6ea1
Blocks legacy ft model.
lu-ohai Jul 31, 2025
f3ff244
Merge branch 'main' of https://github.com/oracle/accelerated-data-sci…
lu-ohai Jul 31, 2025
71c908c
Merge branch 'main' of https://github.com/oracle/accelerated-data-sci…
lu-ohai Jul 31, 2025
f0022c3
Merge branch 'feature/model_group' of https://github.com/oracle/accel…
lu-ohai Jul 31, 2025
e0e3f06
Updated pr.
lu-ohai Aug 5, 2025
d852209
Added cli to convert legacy fine tuned model to v2. (#1241)
lu-ohai Aug 6, 2025
d225417
Merge branch 'feature/model_group' into ODSC-75507/block_legacy_ft_model
lu-ohai Aug 6, 2025
5719e85
Updated pr.
lu-ohai Aug 7, 2025
0dc0ad5
Merge branch 'ODSC-75507/block_legacy_ft_model' of https://github.com…
lu-ohai Aug 7, 2025
dcfa11e
Update deployment.py
lu-ohai Aug 13, 2025
b9618d8
[AQUA] Block legacy ft model (#1238)
lu-ohai Aug 15, 2025
cf21ec8
Update deployment.py
lu-ohai Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ads/aqua/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ def create_model_catalog(
model_taxonomy_metadata: Union[ModelTaxonomyMetadata, Dict],
compartment_id: str,
project_id: str,
freeform_tags: Dict = None,
defined_tags: Dict = None,
**kwargs,
) -> DataScienceModel:
Expand All @@ -303,6 +304,7 @@ def create_model_catalog(
.with_custom_metadata_list(model_custom_metadata)
.with_defined_metadata_list(model_taxonomy_metadata)
.with_provenance_metadata(ModelProvenanceMetadata(training_id=UNKNOWN))
.with_freeform_tags(**(freeform_tags or {}))
.with_defined_tags(
**(defined_tags or {})
) # Create defined tags when a model is created.
Expand Down
1 change: 1 addition & 0 deletions ads/aqua/common/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Tags(ExtendedEnum):
MODEL_FORMAT = "model_format"
MODEL_ARTIFACT_FILE = "model_file"
MULTIMODEL_TYPE_TAG = "aqua_multimodel"
AQUA_FINE_TUNE_MODEL_VERSION = "fine_tune_model_version"


class InferenceContainerType(ExtendedEnum):
Expand Down
18 changes: 16 additions & 2 deletions ads/aqua/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,18 @@ def get_resource_name(ocid: str) -> str:
return name


def get_model_by_reference_paths(model_file_description: dict):
def get_model_by_reference_paths(
model_file_description: dict, is_ft_model_v2: bool = False
):
"""Reads the model file description json dict and returns the base model path and fine-tuned path for
models created by reference.

Parameters
----------
model_file_description: dict
json dict containing model paths and objects for models created by reference.
is_ft_model_v2: bool
Flag to indicate if it's fine tuned model v2. Defaults to False.

Returns
-------
Expand All @@ -666,8 +670,18 @@ def get_model_by_reference_paths(model_file_description: dict):
"Please check if the model created by reference has the correct artifact."
)

if is_ft_model_v2:
# model_file_description json for fine tuned model v2 contains only fine tuned model artifacts
# so first model is always the fine tuned model
ft_model_artifact = models[0]
fine_tune_output_path = f"oci://{ft_model_artifact['bucketName']}@{ft_model_artifact['namespace']}/{ft_model_artifact['prefix']}".rstrip(
"/"
)

return UNKNOWN, fine_tune_output_path

if len(models) > 0:
# since the model_file_description json does not have a flag to identify the base model, we consider
# since the model_file_description json for legacy fine tuned model does not have a flag to identify the base model, we consider
# the first instance to be the base model.
base_model_artifact = models[0]
base_model_path = f"oci://{base_model_artifact['bucketName']}@{base_model_artifact['namespace']}/{base_model_artifact['prefix']}".rstrip(
Expand Down
2 changes: 2 additions & 0 deletions ads/aqua/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
AQUA_TROUBLESHOOTING_LINK = "https://github.com/oracle-samples/oci-data-science-ai-samples/blob/main/ai-quick-actions/troubleshooting-tips.md"
MODEL_FILE_DESCRIPTION_VERSION = "1.0"
MODEL_FILE_DESCRIPTION_TYPE = "modelOSSReferenceDescription"
AQUA_FINE_TUNE_MODEL_VERSION = "v2"
INCLUDE_BASE_MODEL = 1

TRAINING_METRICS_FINAL = "training_metrics_final"
VALIDATION_METRICS_FINAL = "validation_metrics_final"
Expand Down
1 change: 1 addition & 0 deletions ads/aqua/finetuning/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class FineTuneCustomMetadata(ExtendedEnum):
SERVICE_MODEL_ARTIFACT_LOCATION = "artifact_location"
SERVICE_MODEL_DEPLOYMENT_CONTAINER = "deployment-container"
SERVICE_MODEL_FINE_TUNE_CONTAINER = "finetune-container"
FINE_TUNE_INCLUDE_BASE_MODEL_ARTIFACT = "include_base_model_artifact"


class FineTuningRestrictedParams(ExtendedEnum):
Expand Down
8 changes: 8 additions & 0 deletions ads/aqua/finetuning/finetuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
upload_local_to_os,
)
from ads.aqua.constants import (
AQUA_FINE_TUNE_MODEL_VERSION,
DEFAULT_FT_BATCH_SIZE,
DEFAULT_FT_BLOCK_STORAGE_SIZE,
DEFAULT_FT_REPLICA,
Expand Down Expand Up @@ -304,6 +305,11 @@ def create(
"val_set_size": create_fine_tuning_details.validation_set_size,
"training_data": ft_dataset_path,
}
# needs to add 'fine_tune_model_version' tag when creating the ft model for the
# ft container to block merging base model artifact with ft model artifact.
ft_model_freeform_tags = {
Tags.AQUA_FINE_TUNE_MODEL_VERSION: AQUA_FINE_TUNE_MODEL_VERSION
}

ft_model = self.create_model_catalog(
display_name=create_fine_tuning_details.ft_name,
Expand All @@ -314,6 +320,7 @@ def create(
compartment_id=target_compartment,
project_id=target_project,
model_by_reference=True,
freeform_tags=ft_model_freeform_tags,
defined_tags=create_fine_tuning_details.defined_tags,
)
defined_metadata_dict = {}
Expand Down Expand Up @@ -446,6 +453,7 @@ def create(

model_freeform_tags = {
**model_freeform_tags,
**(ft_model.freeform_tags or {}),
Tags.READY_TO_FINE_TUNE: "false",
Tags.AQUA_TAG: UNKNOWN,
Tags.AQUA_FINE_TUNED_MODEL_TAG: f"{source.id}#{source.display_name}",
Expand Down
Loading