Skip to content

ODSC 68580- Update Evaluation SDK to Support Multi-Model Deployment #1085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

elizjo
Copy link
Member

@elizjo elizjo commented Feb 25, 2025

The "name" parameter in the model parameters had to be updated from using the same default name for all deployments to the model's specific name.

This PR introduces a method to validate the user's input when they specify the model name for targeting a single model for evaluation when the model is within a multi model deployment.

Added method validate_name_multi_model():

  • used in AquaEvaluationApp.create() in evaluation.py.
  • assumes that the UI and evaluation handler sends back the user's input model parameters, which includes the "name" parameter with the key being the model specific name
  • we check the DataScienceModel metadata for the model specific name (configuration setting) and whether this name matches the user's input.

Wrote test cases in test_deployment() in the test_validate_multi_model_evaluation() method.

  • see Jira Ticket for screenshots of passed test cases.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 25, 2025
@elizjo elizjo changed the base branch from main to feature/multi_model_deployment February 25, 2025 23:47
Copy link

📌 Cov diff with main:

Coverage-91%

📌 Overall coverage:

Coverage-58.87%

aqua_model, create_aqua_evaluation_details
)

except (AquaRuntimeError, AquaValueError) as err:
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need to add AquaValueError into except section. Ot will work by itself.

Copy link
Member Author

@elizjo elizjo Feb 26, 2025

Choose a reason for hiding this comment

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

I see. I will remove except (AquaRuntimeError, AquaValueError) as err: and the try block. The evaluation_handler.py post method (that calls .create() method here) has the @handle_exceptions decorator, which has the except AquaError as error. I believe that the decorator will catch the exception, so this code is redundant here.

@@ -550,6 +571,43 @@ def create(
parameters=AquaEvalParams(),
)

@staticmethod
def validate_name_multi_model(
Copy link
Member

Choose a reason for hiding this comment

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

Let name it - validate_model_name? Also please add description for this method.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed the name to validate_model_name

def validate_name_multi_model(
evaluation_source: DataScienceModel,
create_aqua_evaluation_details: CreateAquaEvaluationDetails,
):
Copy link
Member

Choose a reason for hiding this comment

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

NIT: ->None?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

f"User did not input model name for multi model deployment evaluation with evaluation source ID: {create_aqua_evaluation_details.evaluation_source_id}"
)
raise AquaValueError(
"Provide the model name. For evaluation, a single model needs to be targeted using the name in the multi model deployment."
Copy link
Member

Choose a reason for hiding this comment

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

I think we can show the valid names in this message.

Provide the model name. For evaluation, a single model needs to be targeted using the name in the multi model deployment. The valid model names for this Model Deployment are {valid_model_names}.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -449,7 +451,7 @@ def test_create_evaluation(
mock_from_id.return_value = foundation_model

experiment = MagicMock()
experiment.id = "test_experiment_id"
experiment.id = "ocid1.datasciencemodelversionset.oc1.iad.amaaaaaav66vvniakngdzelb5hcgjd6yvfejksu2excidvvi3s5s5whtmdea"
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 not use real IDs?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@darenr
Copy link
Member

darenr commented Feb 26, 2025

If someone specifies a model name (correctly) in a single model deployment case is this valid, or does that require the old/current "odsc_model" (or whatever it is)

custom_metadata_list = evaluation_source.custom_metadata_list
user_model_name = user_model_parameters.get("model")

model_group_count = int(
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this fail if ModelCustomMetadataFields.MULTIMODEL_GROUP_COUNT is missing from the custom metadata?

Copy link
Member Author

Choose a reason for hiding this comment

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

corrected

for idx in range(model_group_count)
]

valid_model_names = ", ".join(map(str, 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.

Why do we need map() here? For the case if some name returns None?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes- I changed it now to not include None values

@elizjo
Copy link
Member Author

elizjo commented Feb 26, 2025

@darenr we would only allow the user to enter the name if the Model Deployment selected is a multi model deployment (we use a freeform tag to ID these deployments).

Otherwise, the user will not be able to enter the name and we would be keeping the odsc_llm (default name for MD).

Hope this clarifies your question!

@elizjo elizjo merged commit 67c6891 into feature/multi_model_deployment Feb 26, 2025
2 checks 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.

3 participants