Skip to content

Enable AQUA SDK & CLI to Deploy Fine-Tuned LLMs in Multi-Model Deployment #1175

New issue

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

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

Already on ? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

elizjo
Copy link
Member

@elizjo elizjo commented May 5, 2025

This PR aims to add support for using fine-tuned models in a Multi-Model deployment.

When deploying a model group w/ a fine tuned model

  • added FT_MODEL parameter (output path in oci bucket for fine tuned model)
  • we extract FT_MODEL from the fine tune single model deployment. The model_path is assumed to be the base model for the fine tuned model.
{ "models": [ { "params": "--served-model-name Llama-3.2-11B-Vision --enforce-eager --max-num-seqs 16 --tensor-parallel-size 2 --max-model-len 16000",  "FT_MODEL" : "oci://model-path", "model_path": "Llama-3.2-11B-Vision", "model_task": "image-text-to-text"}, ... 

@oracle-contributor-agreementoracle-contributor-agreement bot added the OCA VerifiedAll contributors have signed the Oracle Contributor Agreement.label May 5, 2025
@github-actionsGitHub Actions
Copy link

-actions bot commented May 5, 2025

📌 Cov diff with main:

Coverage-0%

📌 Overall coverage:

Coverage-19.14%

@github-actionsGitHub Actions
Copy link

-actions bot commented May 5, 2025

📌 Cov diff with main:

Coverage-84%

📌 Overall coverage:

Coverage-58.63%

@@ -311,6 +312,12 @@ def create_multi(
# "Currently only service models are supported for multi model deployment."
# )

is_fine_tuned_model = Tags.AQUA_FINE_TUNED_MODEL_TAG in source_model.freeform_tags
Copy link
Member

Choose a reason for hiding this comment

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

Could you add some comment what we are doing here?

@@ -179,3 +185,42 @@ class CreateFineTuningDetails(Serializable):

class Config:
extra = "ignore"


def extract_base_model_ocid(aqua_model: DataScienceModel) -> Tuple[str, str]:
Copy link
Member

Choose a reason for hiding this comment

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

The name of the function is a bit confusing, it says that it extracts the base model ocid, but returns name and ocid.
Also I think it would be better to create model/utils.py module and move this logic there. Same for the set_finetune_env_var.

Copy link
Member Author

Choose a reason for hiding this comment

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

moved logic as suggested


env_var.update({"FT_MODEL": f"{fine_tune_output_path}"})

return env_var
Copy link
Member

Choose a reason for hiding this comment

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

looks like we are already modifying the original env_var, probably we don't need to return anything form this function?

Copy link
Member Author

Choose a reason for hiding this comment

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

changed, see new commit

@mrDzurb
Copy link
Member

Could you add more description in the PR? It would be also helpful if you put in the details how the new config will look like.

@github-actionsGitHub Actions
Copy link

-actions bot commented May 7, 2025

📌 Cov diff with main:

Coverage-84%

📌 Overall coverage:

Coverage-58.63%

@github-actionsGitHub Actions
Copy link

-actions bot commented May 9, 2025

📌 Cov diff with main:

Coverage-81%

📌 Overall coverage:

Coverage-58.63%

@github-actionsGitHub Actions
Copy link

-actions bot commented May 9, 2025

📌 Cov diff with main:

Coverage-83%

📌 Overall coverage:

Coverage-58.62%

@github-actionsGitHub Actions
Copy link

-actions bot commented May 12, 2025

📌 Cov diff with main:

Coverage-83%

📌 Overall coverage:

Coverage-58.62%

@@ -157,6 +157,8 @@ class AquaMultiModelRef(Serializable):
Optional environment variables to override during deployment.
artifact_location : Optional[str]
Artifact path of model in the multimodel group.
fine_tune_artifact : Optional[str]
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 it would be better to be more specific, according to the comment, this is more about fine_tuned_weights_location, right?

return config_source_id, model_name


def set_fine_tune_env_var(aqua_model: DataScienceModel, env_var: Optional[Dict[str,str]], model: Optional[AquaMultiModelRef] = None) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we really want to combine two flows in one scope. Do we really need to setup theFT_MODEL env variable for multi-model deployment case? If not, I would prefer to keep single-model and multi-model deployment logics separately.

@github-actionsGitHub Actions
Copy link

-actions bot commented May 13, 2025

📌 Cov diff with main:

Coverage-83%

📌 Overall coverage:

Coverage-58.62%

Sign up for free to join this conversation on . Already have an account? Sign in to comment
Labels
OCA VerifiedAll contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants