Skip to content

Commit 6689440

Browse files
committed
Fixes unit tests
1 parent 7bbdb98 commit 6689440

File tree

11 files changed

+25
-23
lines changed

11 files changed

+25
-23
lines changed

ads/aqua/common/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Tags(ExtendedEnum):
4141
AQUA_EVALUATION_MODEL_ID = "evaluation_model_id"
4242
MODEL_FORMAT = "model_format"
4343
MODEL_ARTIFACT_FILE = "model_file"
44-
MULTIMODEL_TYPE_TAG = "multimodel"
44+
MULTIMODEL_TYPE_TAG = "aqua_multimodel"
4545

4646

4747
class InferenceContainerType(ExtendedEnum):

ads/aqua/model/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def create_multi(
369369

370370
# Combine tags
371371
tags = {
372-
Tags.AQUA_TAG: "active",
372+
# Tags.AQUA_TAG: "active",
373373
Tags.MULTIMODEL_TYPE_TAG: "true",
374374
**(freeform_tags or {}),
375375
}
@@ -1809,8 +1809,8 @@ def _rqs(self, compartment_id: str, model_type="FT", **kwargs):
18091809
filter_tag = Tags.AQUA_FINE_TUNED_MODEL_TAG
18101810
elif model_type == ModelType.BASE:
18111811
filter_tag = Tags.BASE_MODEL_CUSTOM
1812-
elif model_type == ModelType.MULTIMODEL:
1813-
filter_tag = Tags.MULTIMODEL_TYPE_TAG
1812+
# elif model_type == ModelType.MULTIMODEL:
1813+
# filter_tag = Tags.MULTIMODEL_TYPE_TAG
18141814
else:
18151815
raise AquaValueError(
18161816
f"Model of type {model_type} is unknown. The values should be in {ModelType.values()}"

ads/aqua/modeldeployment/entities.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def from_oci_model_deployment(
164164

165165
class Config:
166166
extra = "ignore"
167+
protected_namespaces = ()
167168

168169

169170
class AquaDeploymentDetail(AquaDeployment, DataClassSerializable):
@@ -180,16 +181,16 @@ class ShapeInfoConfig(Serializable):
180181
"""Describes how many memory and cpu to this model for specific shape.
181182
182183
Attributes:
183-
memory_in_gbs (int, optional): The number of memory in gbs to this model of the shape.
184-
ocpu (int, optional): The number of ocpus to this model of the shape.
184+
memory_in_gbs (float, optional): The number of memory in gbs to this model of the shape.
185+
ocpu (float, optional): The number of ocpus to this model of the shape.
185186
"""
186187

187-
memory_in_gbs: Optional[int] = Field(
188-
default_factory=int,
188+
memory_in_gbs: Optional[float] = Field(
189+
None,
189190
description="The number of memory in gbs to this model of the shape.",
190191
)
191-
ocpu: Optional[int] = Field(
192-
default_factory=int,
192+
ocpu: Optional[float] = Field(
193+
None,
193194
description="The number of ocpus to this model of the shape.",
194195
)
195196

@@ -558,3 +559,4 @@ def validate_multimodel_deployment_feasibility(
558559

559560
class Config:
560561
extra = "ignore"
562+
protected_namespaces = ()

tests/unitary/with_extras/aqua/test_data/deployment/aqua_create_gguf_deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
shapeName: "VM.Standard.A1.Flex"
1919
shapeConfigDetails:
2020
memoryInGBs: 60.0
21-
ocpus: 10
21+
ocpus: 10.0
2222
type: datascienceModelDeployment
2323
lifecycleState: CREATING
2424
modelDeploymentUrl: "https://modeldeployment.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.<region>.<MD_OCID>"

tests/unitary/with_extras/aqua/test_data/deployment/aqua_create_multi_deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ spec:
44
displayName: multi-model-deployment-name
55
freeformTags:
66
OCI_AQUA: active
7-
multimodel: "true"
7+
aqua_multimodel: "true"
88
aqua_model_id: model-id
99
id: "ocid1.datasciencemodeldeployment.oc1.<region>.<MD_OCID>"
1010
infrastructure:

tests/unitary/with_extras/aqua/test_data/deployment/aqua_multi_model.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ spec:
7777
displayName: multi_model
7878
freeformTags:
7979
OCI_AQUA: active
80-
multimodel: "true"
80+
aqua_multimodel: "true"
8181
license: Apache 2.0
8282
organization: Organization
8383
ready_to_fine_tune: false

tests/unitary/with_extras/aqua/test_deployment.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class TestDataset:
180180
"freeform_tags": {
181181
"OCI_AQUA": "active",
182182
"aqua_model_id": "model-id",
183-
"multimodel": "true",
183+
"aqua_multimodel": "true",
184184
},
185185
"id": "ocid1.datasciencemodeldeployment.oc1.<region>.<MD_OCID>",
186186
"lifecycle_state": "ACTIVE",
@@ -264,7 +264,7 @@ class TestDataset:
264264
"instance_shape_name": DEPLOYMENT_SHAPE_NAME_CPU,
265265
"model_deployment_instance_shape_config_details": oci.data_science.models.ModelDeploymentInstanceShapeConfigDetails(
266266
**{
267-
"ocpus": 10,
267+
"ocpus": 10.0,
268268
"memory_in_gbs": 60.0,
269269
}
270270
),
@@ -366,7 +366,7 @@ class TestDataset:
366366
"created_on": "2024-01-01T00:00:00.000000+00:00",
367367
"created_by": "ocid1.user.oc1..<OCID>",
368368
"endpoint": MODEL_DEPLOYMENT_URL,
369-
"private_endpoint_id": "",
369+
"private_endpoint_id": None,
370370
"models": [],
371371
"model_id": "ocid1.datasciencemodel.oc1.<region>.<OCID>",
372372
"environment_variables": {
@@ -397,7 +397,7 @@ class TestDataset:
397397
"created_on": "2024-01-01T00:00:00.000000+00:00",
398398
"created_by": "ocid1.user.oc1..<OCID>",
399399
"endpoint": MODEL_DEPLOYMENT_URL,
400-
"private_endpoint_id": "",
400+
"private_endpoint_id": None,
401401
"models": [
402402
{
403403
"env_var": {},
@@ -435,7 +435,7 @@ class TestDataset:
435435
"tags": {
436436
"OCI_AQUA": "active",
437437
"aqua_model_id": "model-id",
438-
"multimodel": "true",
438+
"aqua_multimodel": "true",
439439
},
440440
}
441441

@@ -450,7 +450,7 @@ class TestDataset:
450450
aqua_deployment_gguf_shape_info = {
451451
"instance_shape": DEPLOYMENT_SHAPE_NAME_CPU,
452452
"instance_count": 1,
453-
"ocpus": 10,
453+
"ocpus": 10.0,
454454
"memory_in_gbs": 60.0,
455455
}
456456

tests/unitary/with_extras/aqua/test_finetuning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from parameterized import parameterized
1111
from unittest import TestCase
1212
from unittest.mock import MagicMock, PropertyMock
13-
from mock import patch
13+
from unittest.mock import patch
1414
from importlib import reload
1515

1616
import ads.aqua

tests/unitary/with_extras/aqua/test_finetuning_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from unittest import TestCase
88
from unittest.mock import MagicMock
99

10-
from mock import patch
10+
from unittest.mock import patch
1111
from notebook.base.handlers import IPythonHandler
1212

1313
from ads.aqua.extension.finetune_handler import (

tests/unitary/with_extras/aqua/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def test_create_multimodel(
449449
mock_from_id.return_value = mock_model
450450
mock_create.return_value = mock_model
451451

452-
assert model.freeform_tags == {"OCI_AQUA": "active", "multimodel": "true"}
452+
assert model.freeform_tags == {"OCI_AQUA": "active", "aqua_multimodel": "true"}
453453
assert model.custom_metadata_list.get("model_group_count").value == "2"
454454
assert (
455455
model.custom_metadata_list.get("deployment-container").value

tests/unitary/with_extras/aqua/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class HandlerTestDataset:
2929
block_storage_size=1,
3030
experiment_name="test_experiment_name",
3131
memory_in_gbs=1,
32-
ocpus=1,
32+
ocpus=1.0,
3333
)
3434
mock_invalid_input = dict(name="myvalue")
3535
mock_dataclass_obj = MockData(id="myid", name="myname")

0 commit comments

Comments
 (0)