Skip to content

Commit 8687883

Browse files
authored
Fix/add UTs for 1.0.3 and update supported arm shapes (#905)
2 parents f302387 + d8df9ff commit 8687883

File tree

12 files changed

+179
-65
lines changed

12 files changed

+179
-65
lines changed

ads/aqua/common/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
)
4747
from ads.aqua.data import AquaResourceIdentifier
4848
from ads.common.auth import default_signer
49-
from ads.common.decorator.threaded import threaded
5049
from ads.common.extended_enum import ExtendedEnumMeta
5150
from ads.common.object_storage_details import ObjectStorageDetails
5251
from ads.common.oci_resource import SEARCH_TYPE, OCIResource
@@ -216,7 +215,6 @@ def read_file(file_path: str, **kwargs) -> str:
216215
return UNKNOWN
217216

218217

219-
@threaded()
220218
def load_config(file_path: str, config_file_name: str, **kwargs) -> dict:
221219
artifact_path = f"{file_path.rstrip('/')}/{config_file_name}"
222220
signer = default_signer() if artifact_path.startswith("oci://") else {}

ads/aqua/config/deployment_config_defaults.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
"configs": [
77
{
88
"memory_in_gbs": 128,
9-
"ocpu": 32
9+
"ocpu": 20
1010
},
1111
{
1212
"memory_in_gbs": 256,
13-
"ocpu": 64
13+
"ocpu": 40
1414
},
1515
{
16-
"memory_in_gbs": 512,
17-
"ocpu": 128
16+
"memory_in_gbs": 384,
17+
"ocpu": 60
1818
},
1919
{
20-
"memory_in_gbs": 1024,
21-
"ocpu": 256
20+
"memory_in_gbs": 512,
21+
"ocpu": 80
2222
}
2323
],
2424
"type": "CPU"

ads/aqua/ui.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class Platform(Enum):
5151
def to_dict(self):
5252
return self.value
5353

54+
def __repr__(self):
55+
return repr(self.value)
56+
5457
name: str = None
5558
version: str = None
5659
display_name: str = None

ads/common/object_storage_details.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*--
32

43
# Copyright (c) 2021, 2024 Oracle and/or its affiliates.
54
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
65

76
import json
87
import os
98
import re
9+
from concurrent.futures import ThreadPoolExecutor, as_completed
1010
from dataclasses import dataclass
1111
from typing import Dict, List
1212
from urllib.parse import urlparse
1313

14-
1514
import oci
1615
from ads.common import auth as authutil
1716
from ads.common import oci_client
1817
from ads.dataset.progress import TqdmProgressBar
19-
from concurrent.futures import ThreadPoolExecutor, as_completed
2018

2119
THREAD_POOL_MAX_WORKERS = 10
2220

@@ -169,8 +167,7 @@ def is_bucket_versioned(self) -> bool:
169167

170168
def list_objects(self, **kwargs):
171169
"""Lists objects in a given oss path
172-
173-
Parameters
170+
Parameters
174171
-------
175172
**kwargs:
176173
namespace, bucket, filepath are set by the class. By default, fields gets all values. For other supported

ads/common/serializer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8; -*-
32

43
# Copyright (c) 2021, 2024 Oracle and/or its affiliates.
54
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
@@ -25,10 +24,8 @@
2524
from ads.common.auth import default_signer
2625

2726
try:
28-
from yaml import CSafeDumper as dumper
2927
from yaml import CSafeLoader as loader
3028
except:
31-
from yaml import SafeDumper as dumper
3229
from yaml import SafeLoader as loader
3330

3431

@@ -99,6 +96,8 @@ def serialize(obj):
9996
"""JSON serializer for objects not serializable by default json code."""
10097
if isinstance(obj, datetime):
10198
return obj.isoformat()
99+
if hasattr(obj, "to_dict"):
100+
return obj.to_dict()
102101
raise TypeError(f"Type {type(obj)} not serializable.")
103102

104103
@staticmethod

tests/unitary/with_extras/aqua/test_data/ui/container_index.json

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,44 +63,56 @@
6363
},
6464
"odsc-llama-cpp-serving": [
6565
{
66-
"displayName": "llama.cpp",
67-
"name": "dsmc://odsc-llama-cpp-serving",
66+
"displayName": "LLAMA-CPP:0.2.75",
67+
"modelFormats": [
68+
"GGUF"
69+
],
70+
"name": "iad.ocir.io/ociodscdev/odsc-llama-cpp-python-aio-linux_arm64_v8",
71+
"platforms": [
72+
"ARM_CPU"
73+
],
6874
"type": "inference",
69-
"version": "0.2.75.2"
75+
"version": "0.2.75.5"
7076
}
7177
],
7278
"odsc-llm-evaluate": [
7379
{
7480
"name": "dsmc://odsc-llm-evaluate",
75-
"version": "0.1.2.0"
81+
"version": "0.1.2.1"
7682
}
7783
],
7884
"odsc-llm-fine-tuning": [
7985
{
8086
"name": "dsmc://odsc-llm-fine-tuning",
81-
"version": "1.1.33.34"
87+
"version": "1.1.37.37"
8288
}
8389
],
8490
"odsc-tgi-serving": [
8591
{
86-
"displayName": "TGI:1.4.5",
87-
"name": "dsmc://odsc-tgi-serving",
88-
"type": "inference",
89-
"version": "1.4.5"
90-
},
91-
{
92-
"displayName": "TGI:2.0.2",
93-
"name": "dsmc://odsc-tgi-serving",
92+
"displayName": "TGI:2.0.1",
93+
"modelFormats": [
94+
"SAFETENSORS"
95+
],
96+
"name": "dsmc://odsc-text-generation-inference",
97+
"platforms": [
98+
"NVIDIA_GPU"
99+
],
94100
"type": "inference",
95-
"version": "2.0.2"
101+
"version": "2.0.1.4"
96102
}
97103
],
98104
"odsc-vllm-serving": [
99105
{
100-
"displayName": "VLLM:0.3.0",
106+
"displayName": "VLLM:0.4.1",
107+
"modelFormats": [
108+
"SAFETENSORS"
109+
],
101110
"name": "dsmc://odsc-vllm-serving",
111+
"platforms": [
112+
"NVIDIA_GPU"
113+
],
102114
"type": "inference",
103-
"version": "0.3.0.7"
115+
"version": "0.4.1.3"
104116
}
105117
]
106118
}

tests/unitary/with_extras/aqua/test_decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def setUp(self, ipython_init_mock) -> None:
126126
"status": 500,
127127
"message": "Internal Server Error",
128128
"service_payload": {},
129-
"reason": f"MultipartUploadError: MultipartUploadError exception has occured. {UPLOAD_MANAGER_DEBUG_INFORMATION_LOG}",
129+
"reason": f"MultipartUploadError: MultipartUploadError exception has occurred. {UPLOAD_MANAGER_DEBUG_INFORMATION_LOG}",
130130
"request_id": TestDataset.mock_request_id,
131131
},
132132
],

tests/unitary/with_extras/aqua/test_handlers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def tearDownClass(cls):
211211
"load_evaluation_config",
212212
TestDataset.MOCK_OCID,
213213
TestDataset.MOCK_OCID,
214+
"/evaluation/config",
214215
),
215216
(
216217
"AquaEvaluationMetricsHandler",
@@ -219,6 +220,7 @@ def tearDownClass(cls):
219220
"load_metrics",
220221
TestDataset().mock_url("metrics"),
221222
TestDataset.MOCK_OCID,
223+
f"/evaluation/{TestDataset.MOCK_OCID}/metrics",
222224
),
223225
(
224226
"AquaEvaluationReportHandler",
@@ -227,6 +229,7 @@ def tearDownClass(cls):
227229
"download_report",
228230
TestDataset().mock_url("report"),
229231
TestDataset.MOCK_OCID,
232+
f"/evaluation/{TestDataset.MOCK_OCID}/report",
230233
),
231234
(
232235
"AquaEvaluationStatusHandler",
@@ -235,6 +238,7 @@ def tearDownClass(cls):
235238
"get_status",
236239
TestDataset().mock_url("status"),
237240
TestDataset.MOCK_OCID,
241+
f"/aqua/evaluation/{TestDataset.MOCK_OCID}/status",
238242
),
239243
(
240244
"ADSVersionHandler",
@@ -243,6 +247,7 @@ def tearDownClass(cls):
243247
None,
244248
None,
245249
{"data": metadata.version("oracle_ads")},
250+
f"/aqua/ads_version",
246251
),
247252
(
248253
"CompatibilityCheckHandler",
@@ -251,6 +256,7 @@ def tearDownClass(cls):
251256
None,
252257
None,
253258
dict(status="ok"),
259+
"/aqua/hello",
254260
),
255261
(
256262
"AquaModelLicenseHandler",
@@ -259,6 +265,7 @@ def tearDownClass(cls):
259265
"load_license",
260266
TestDataset().mock_url("license"),
261267
TestDataset.MOCK_OCID,
268+
f"/aqua/model/{TestDataset.MOCK_OCID}/license",
262269
),
263270
(
264271
"AquaModelHandler",
@@ -267,6 +274,7 @@ def tearDownClass(cls):
267274
"get",
268275
TestDataset.MOCK_OCID,
269276
TestDataset.MOCK_OCID,
277+
f"/aqua/model/{TestDataset.MOCK_OCID}",
270278
),
271279
(
272280
"AquaModelHandler_list",
@@ -275,6 +283,7 @@ def tearDownClass(cls):
275283
"list",
276284
"",
277285
(None, None),
286+
f"/aqua/model",
278287
),
279288
]
280289
)
@@ -287,6 +296,7 @@ def test_get(
287296
associated_api,
288297
url,
289298
expected_call,
299+
path,
290300
ipython_init_mock,
291301
):
292302
"""Tests invoking GET method successfully."""
@@ -295,6 +305,7 @@ def test_get(
295305
test_instance = target_handler(MagicMock(), MagicMock())
296306
test_instance.finish = MagicMock()
297307
test_instance.request = MagicMock()
308+
test_instance.request.path = path
298309

299310
if associated_api:
300311
with patch.object(target_app, associated_api) as mock_api:

0 commit comments

Comments
 (0)