Skip to content

Conversation

@lu-ohai
Copy link
Member

@lu-ohai lu-ohai commented Mar 12, 2025

Improved multi model metadata storage

  • Applied create_custom_metadata_artifact to store multi model metadata in model catalog while creating the aqua model.
  • Applied get_custom_metadata_artifact to get multi model metadata in model catalog while fetching the aqua deployment.

Notebook

Screenshot 2025-03-12 at 3 44 46 PM Screenshot 2025-03-12 at 3 43 20 PM

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 12, 2025
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
"""This module defines constants used in ads.aqua module."""

UNKNOWN = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use it form common.utils instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

ModelCustomMetadataItem(key=ModelCustomMetadataFields.MULTIMODEL_METADATA),
).value

if not multi_model_metadata_value:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error_message = (
        f"Required model metadata is missing for evaluation source ID: {create_aqua_evaluation_details.evaluation_source_id}. "
        f"A valid multi-model deployment requires {ModelCustomMetadataFields.MULTIMODEL_METADATA}. "
        "Please recreate the model deployment and retry the evaluation, as an issue occurred during the initialization of the model group."
    )
    logger.debug(error_message)
    raise AquaRuntimeError(error_message)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

logger.debug(error_message)
raise AquaRuntimeError(error_message)

multi_model_metadata = json.loads(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add more debug statements, indicating the steps we are doing here.
I also think that we should put the loading the metadata into try/catch to prevent returning useless error messages to the users. For users we should say that something wrong with loading the metadata, and put details into the debug logs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

)

# Build the list of valid model names from custom metadata.
model_names = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should load metadata back to the AquaMultiModelRef

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

# Finalize creation
custom_model.create(model_by_reference=True)

# Create custom metadata for multi model metadata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add more debug statements here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

),
).value
if not multi_model_metadata_value:
raise AquaRuntimeError(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raise AquaRuntimeError(
        f"Invalid multi-model deployment: {model_deployment_id}. "
        f"Ensure that the required custom metadata `{ModelCustomMetadataFields.MULTIMODEL_METADATA}` is added to the AQUA multi-model `{aqua_model.display_name}` ({aqua_model.id})."
    )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@mrDzurb mrDzurb merged commit 5060741 into feature/multi_model_deployment Mar 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants