Skip to content

Commit 76defcd

Browse files
committed
Fixes unit tests
1 parent f2f09db commit 76defcd

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

ads/aqua/common/entities.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ class LoraModuleSpec(Serializable):
150150
The model-by-reference path to the LoRA Module within the model artifact
151151
"""
152152

153-
model_id: str = Field(
154-
..., description="The fine tuned model OCID to deploy.", exclude=True
155-
)
153+
model_id: str = Field(..., description="The fine tuned model OCID to deploy.")
156154
model_name: str = Field(..., description="The name of the fine-tuned model.")
157155
model_path: str = Field(
158156
...,

ads/aqua/model/model.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ def create_multi(
315315
Tags.AQUA_FINE_TUNED_MODEL_TAG in source_model.freeform_tags
316316
)
317317

318+
model_artifact_path = ""
319+
fine_tune_path = ""
320+
318321
if is_fine_tuned_model:
319322
model_artifact_path, fine_tune_path = extract_fine_tune_artifacts_path(
320323
source_model
@@ -334,10 +337,6 @@ def create_multi(
334337
# Retrieve model artifact for base models
335338
model_artifact_path = source_model.artifact
336339

337-
display_name_list.append(display_name)
338-
339-
self._extract_model_task(model, source_model)
340-
341340
if not model_artifact_path:
342341
raise AquaValueError(
343342
f"Model '{display_name}' (ID: {model.model_id}) has no artifacts. "
@@ -346,6 +345,8 @@ def create_multi(
346345

347346
# Update model artifact location in user's input model
348347
model.artifact_location = model_artifact_path
348+
display_name_list.append(display_name)
349+
self._extract_model_task(model, source_model)
349350

350351
if not model_file_description:
351352
raise AquaValueError(

ads/aqua/modeldeployment/model_group_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class BaseModelSpec(BaseModel):
3838
3939
Attributes
4040
----------
41+
model_id: str
42+
The OCID of the base model.
4143
model_path : str
4244
Path to the model in OCI Object Storage.
4345
params : str
@@ -48,6 +50,7 @@ class BaseModelSpec(BaseModel):
4850
List of associated LoRA modules for fine-tuned models.
4951
"""
5052

53+
model_id: str = Field(..., description="The base model OCID.")
5154
model_path: str = Field(..., description="Path to the base model.")
5255
params: str = Field(..., description="Startup parameters passed to vLLM.")
5356
model_task: Optional[str] = Field(
@@ -94,6 +97,7 @@ def from_aqua_multi_model_ref(
9497
"""Converts AquaMultiModelRef to BaseModelSpec. Fields are validated using @field_validator methods above."""
9598

9699
return cls(
100+
model_id=model.model_id,
97101
model_path=model.artifact_location,
98102
params=model_params,
99103
model_task=model.model_task,

tests/unitary/with_extras/aqua/test_deployment.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class TestDataset:
277277
"environment_configuration_type": "OCIR_CONTAINER",
278278
"environment_variables": {
279279
"MODEL_DEPLOY_PREDICT_ENDPOINT": "/v1/completions",
280-
"MULTI_MODEL_CONFIG": '{ "models": [{ "params": "--served-model-name model_one --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_one/5be6479/artifact/", "model_task": "text_embedding"}, {"params": "--served-model-name model_two --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_two/83e9aa1/artifact/", "model_task": "image_text_to_text"}, {"params": "--served-model-name model_three --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_three/83e9aa1/artifact/", "model_task": "code_synthesis", "fine_tune_weights": [{"model_name": "ft_model", "model_path": "oci://test_bucket@test_namespace/models/ft-models/meta-llama-3b/ocid1.datasciencejob.oc1.iad.<ocid>"}] }]}',
280+
"MULTI_MODEL_CONFIG": '{ "models": [{"model_id":"model_a", "params": "--served-model-name model_one --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_one/5be6479/artifact/", "model_task": "text_embedding"}, {"model_id":"model_b", "params": "--served-model-name model_two --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_two/83e9aa1/artifact/", "model_task": "image_text_to_text"}, {"model_id":"model_c", "params": "--served-model-name model_three --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_three/83e9aa1/artifact/", "model_task": "code_synthesis", "fine_tune_weights": [{"model_id":"ocid1.datasciencemodel.oc1..<OCID>", "model_name": "ft_model", "model_path": "oci://test_bucket@test_namespace/models/ft-models/meta-llama-3b/ocid1.datasciencejob.oc1.iad.<ocid>"}] }]}',
281281
},
282282
"health_check_port": 8080,
283283
"image": "dsmc://image-name:1.0.0.0",
@@ -507,6 +507,7 @@ class TestDataset:
507507
"artifact_location": "oci://test_location_3",
508508
"fine_tune_weights": [
509509
{
510+
"model_id": "ocid1.datasciencemodel.oc1..<OCID>",
510511
"model_name": "ft_model",
511512
"model_path": "oci://test_bucket@test_namespace/models/ft-models/meta-llama-3b/ocid1.datasciencejob.oc1.iad.<ocid>",
512513
}
@@ -516,7 +517,7 @@ class TestDataset:
516517
"model_id": "ocid1.datasciencemodel.oc1.<region>.<OCID>",
517518
"environment_variables": {
518519
"MODEL_DEPLOY_PREDICT_ENDPOINT": "/v1/completions",
519-
"MULTI_MODEL_CONFIG": '{ "models": [{ "params": "--served-model-name model_one --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_one/5be6479/artifact/", "model_task": "text_embedding"}, {"params": "--served-model-name model_two --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_two/83e9aa1/artifact/", "model_task": "image_text_to_text"}, {"params": "--served-model-name model_three --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_three/83e9aa1/artifact/", "model_task": "code_synthesis", "fine_tune_weights": [{"model_name": "ft_model", "model_path": "oci://test_bucket@test_namespace/models/ft-models/meta-llama-3b/ocid1.datasciencejob.oc1.iad.<ocid>"}] }]}',
520+
"MULTI_MODEL_CONFIG": '{ "models": [{"model_id":"model_a", "params": "--served-model-name model_one --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_one/5be6479/artifact/", "model_task": "text_embedding"}, {"model_id":"model_b", "params": "--served-model-name model_two --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_two/83e9aa1/artifact/", "model_task": "image_text_to_text"}, {"model_id":"model_c", "params": "--served-model-name model_three --tensor-parallel-size 1 --max-model-len 2096", "model_path": "models/model_three/83e9aa1/artifact/", "model_task": "code_synthesis", "fine_tune_weights": [{"model_id":"ocid1.datasciencemodel.oc1..<OCID>", "model_name": "ft_model", "model_path": "oci://test_bucket@test_namespace/models/ft-models/meta-llama-3b/ocid1.datasciencejob.oc1.iad.<ocid>"}] }]}',
520521
},
521522
"cmd": [],
522523
"console_link": "https://cloud.oracle.com/data-science/model-deployments/ocid1.datasciencemodeldeployment.oc1.<region>.<MD_OCID>?region=region-name",
@@ -1007,20 +1008,24 @@ class TestDataset:
10071008
multi_model_deployment_group_config = {
10081009
"models": [
10091010
{
1011+
"model_id": "model_a",
10101012
"fine_tune_weights": [],
10111013
"model_path": "",
10121014
"model_task": "text_embedding",
10131015
"params": "--example-container-params test --served-model-name test_model_1 --tensor-parallel-size 1 --trust-remote-code --max-model-len 60000",
10141016
},
10151017
{
1018+
"model_id": "model_b",
10161019
"fine_tune_weights": [],
10171020
"model_path": "",
10181021
"model_task": "image_text_to_text",
10191022
"params": "--example-container-params test --served-model-name test_model_2 --tensor-parallel-size 2 --trust-remote-code --max-model-len 32000",
10201023
},
10211024
{
1025+
"model_id": "model_c",
10221026
"fine_tune_weights": [
10231027
{
1028+
"model_id": "ocid1.datasciencemodel.oc1..<OCID>",
10241029
"model_name": "ft_model",
10251030
"model_path": "oci://test_bucket@test_namespace/models/ft-models/meta-llama-3b/ocid1.datasciencejob.oc1.iad.<ocid>",
10261031
},
@@ -1035,12 +1040,14 @@ class TestDataset:
10351040
multi_model_deployment_group_config_no_ft = {
10361041
"models": [
10371042
{
1043+
"model_id": "model_a",
10381044
"fine_tune_weights": [],
10391045
"model_path": "",
10401046
"model_task": "text_embedding",
10411047
"params": "--example-container-params test --served-model-name test_model_1 --tensor-parallel-size 1 --trust-remote-code --max-model-len 60000",
10421048
},
10431049
{
1050+
"model_id": "model_b",
10441051
"fine_tune_weights": [],
10451052
"model_path": "",
10461053
"model_task": "image_text_to_text",
@@ -1188,7 +1195,6 @@ def test_get_multi_model_deployment(
11881195
actual_attributes_no_ft_id = copy.deepcopy(
11891196
TestDataset.multi_model_deployment_model_attributes
11901197
)
1191-
actual_attributes_no_ft_id[2]["fine_tune_weights"][0].pop("model_id")
11921198
assert [
11931199
model.model_dump() for model in result.models
11941200
] == actual_attributes_no_ft_id

0 commit comments

Comments
 (0)