Skip to content

Commit af244f6

Browse files
committed
feat(model-validation): add tests for raw inference service
1 parent ef31adc commit af244f6

22 files changed

Lines changed: 445 additions & 253 deletions

File tree

tests/conftest.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,7 @@ def models_s3_bucket_name(pytestconfig: pytest.Config) -> str | None:
225225
"""
226226
models_bucket = pytestconfig.option.models_s3_bucket_name
227227
if not models_bucket:
228-
warnings.warn(
229-
message=(
230-
"Bucket name for the models bucket is not defined."
231-
"Either pass with `--models-s3-bucket-name` or set `MODELS_S3_BUCKET_NAME` environment variable"
232-
),
233-
category=UserWarning,
234-
)
235-
return None
228+
pytest.skip("S3 bucket name for models is not defined. Skipping tests that require it.")
236229
return models_bucket
237230

238231

@@ -243,14 +236,7 @@ def models_s3_bucket_region(pytestconfig: pytest.Config) -> str | None:
243236
"""
244237
models_bucket_region = pytestconfig.option.models_s3_bucket_region
245238
if not models_bucket_region:
246-
warnings.warn(
247-
message=(
248-
"region for the models bucket is not defined."
249-
"Either pass with `--models-s3-bucket-region` or set `MODELS_S3_BUCKET_REGION` environment variable"
250-
),
251-
category=UserWarning,
252-
)
253-
return None
239+
pytest.skip("S3 bucket region for models is not defined. Skipping tests that require it.")
254240
return models_bucket_region
255241

256242

@@ -273,7 +259,7 @@ def models_s3_bucket_endpoint(pytestconfig: pytest.Config) -> str | None:
273259

274260

275261
@pytest.fixture(scope="session")
276-
def model_image_name(pytestconfig: pytest.Config) -> str:
262+
def model_image_name(pytestconfig: pytest.Config) -> list[str]:
277263
model_image = pytestconfig.option.modelcar_image_name
278264
if not model_image:
279265
pytest.skip("Model image name is not defined. Skipping tests that require it.")

tests/model_serving/model_runtime/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import pytest
2+
from kubernetes.dynamic import DynamicClient
3+
from ocp_resources.inference_service import InferenceService
4+
from utilities.infra import get_pods_by_isvc_label
5+
from ocp_resources.pod import Pod
26
from simple_logger.logger import get_logger
37

48
LOGGER = get_logger(name=__name__)
@@ -8,3 +12,8 @@
812
def vllm_skip_if_no_supported_accelerator_type(supported_accelerator_type: str) -> None: # noqa: UFN001
913
if not supported_accelerator_type:
1014
pytest.skip("Accelerator type is not provided,vLLM test can not be run on CPU")
15+
16+
17+
@pytest.fixture
18+
def vllm_pod_resource(admin_client: DynamicClient, vllm_model_car_inference_service: InferenceService) -> Pod:
19+
return get_pods_by_isvc_label(client=admin_client, isvc=vllm_model_car_inference_service)[0]

tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_openai_completion_from_oci_image[llama-8b-oci0].2.json renamed to tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_oci_modelcar_raw_openai_inference[modelcar-granite-3-1-8b-base-quantized-w4a161.5-raw].1.json

File renamed without changes.

tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_openai_completion_from_oci_image[llama-8b-oci0].json renamed to tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_oci_modelcar_raw_openai_inference[modelcar-granite-3-1-8b-base-quantized-w4a161.5-raw].json

File renamed without changes.

tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_openai_completion_from_oci_image[granite-8b-oci].2.json renamed to tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_oci_modelcar_raw_openai_inference[modelcar-granite-3-1-8b-base-quantized-w4a161.5-serverless].1.json

File renamed without changes.

tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_openai_completion_from_oci_image[granite-8b-oci].json renamed to tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_oci_modelcar_raw_openai_inference[modelcar-granite-3-1-8b-base-quantized-w4a161.5-serverless].json

File renamed without changes.

tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_openai_completion_from_oci_image[qwen2-7b-oci].2.json renamed to tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_oci_modelcar_raw_openai_inference[modelcar-llama-3-1-8b-instruct1.5-serverless].1.json

File renamed without changes.

tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_openai_completion_from_oci_image[qwen2-7b-oci].json renamed to tests/model_serving/model_runtime/model_validation/__snapshots__/test_modelvalidation/TestVLLMModelcarOCI.test_oci_modelcar_raw_openai_inference[modelcar-llama-3-1-8b-instruct1.5-serverless].json

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[
2+
{
3+
"finish_reason": "length",
4+
"index": 0,
5+
"logprobs": null,
6+
"prompt_logprobs": null,
7+
"stop_reason": null,
8+
"text": " Renewable energy sources, such as solar, wind, and hydroelectric power, offer several key benefits compared to fossil fuels. Some of the main advantages include:\n1. Sustainability: Renewable energy sources are sustainable and can be replenished naturally, unlike fossil fuels, which are finite and will eventually run out.\n2. Reduced greenhouse gas emissions: Renewable energy sources produce little to no greenhouse gas emissions, which contribute to climate change, whereas fossil fuels release significant amounts of carbon dioxide and other pollutants when burned.\n3"
9+
},
10+
{
11+
"finish_reason": "length",
12+
"index": 0,
13+
"logprobs": null,
14+
"prompt_logprobs": null,
15+
"stop_reason": null,
16+
"text": " \nEnglish: Knowledge is power.\nSpanish: El conocimiento es poder.\nGerman: Wissen ist Macht.\nMandarin: 知识就是力量.\nNote: The translation of the sentence into Mandarin is a bit more nuanced, as the Chinese language has a different grammatical structure and idiomatic expressions. The translation \"知识就是力量\" is a common way to express the idea, but it's worth noting that the original sentence is a direct translation of the English phrase, and the Chinese phrase"
17+
},
18+
{
19+
"finish_reason": "length",
20+
"index": 0,
21+
"logprobs": null,
22+
"prompt_logprobs": null,
23+
"stop_reason": null,
24+
"text": " The poem should have a twinkle in its eye, a sense of wonder and awe.\nThe velvet expanse above, a canvas so divine,\nA twinkling tapestry, infinite and sublime.\nThe stars, like diamonds, scattered with reckless abandon,\nA celestial showcase, of beauty and wonder, unbound.\n\nThe moon, a glowing crescent, a beacon in the night,\nA gentle guide, that navigates us through the dark of light.\nThe planets, like sentinels, standing guard"
25+
},
26+
{
27+
"finish_reason": "length",
28+
"index": 0,
29+
"logprobs": null,
30+
"prompt_logprobs": null,
31+
"stop_reason": null,
32+
"text": " The Great Wall of China is one of the most impressive architectural achievements in history, and its significance extends beyond its physical presence. It has played a crucial role in China's military defense, economic development, and cultural identity. In this essay, we will explore the historical significance of the Great Wall of China and its impact on modern tourism.\nThe Great Wall of China was built over several centuries, with the first versions of the wall dating back to the 7th century BC. The wall was initially constructed"
33+
},
34+
{
35+
"finish_reason": "length",
36+
"index": 0,
37+
"logprobs": null,
38+
"prompt_logprobs": null,
39+
"stop_reason": null,
40+
"text": " | Homework Help\nThe use of artificial intelligence (AI) in healthcare decision-making has the potential to revolutionize the way healthcare is delivered, but it also raises several ethical concerns. Some of the key ethical implications of using AI in healthcare decision-making include:\n1. Bias and discrimination: AI systems can perpetuate existing biases and discrimination if they are trained on biased data or designed with a particular worldview. This can lead to unequal treatment of patients, particularly those from marginalized groups.\n2. Lack of transparency"
41+
},
42+
{
43+
"finish_reason": "length",
44+
"index": 0,
45+
"logprobs": null,
46+
"prompt_logprobs": null,
47+
"stop_reason": null,
48+
"text": " The Apollo 11 mission was a groundbreaking achievement in space exploration, marking the first time humans set foot on the lunar surface. Here's a summary of the main events and its significance:\n**Mission Overview**\nApollo 11 was launched on July 16, 1969, from Kennedy Space Center in Florida. The mission was crewed by astronauts Neil Armstrong, Edwin \"Buzz\" Aldrin, and Michael Collins. The spacecraft consisted of the Command Module (Columbia) and the Lunar Module (E"
49+
}
50+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[
2+
{
3+
"id": "llama-8b-oci",
4+
"max_model_len": 1024,
5+
"object": "model",
6+
"owned_by": "vllm",
7+
"parent": null,
8+
"permission": [
9+
{
10+
"allow_create_engine": false,
11+
"allow_fine_tuning": false,
12+
"allow_logprobs": true,
13+
"allow_sampling": true,
14+
"allow_search_indices": false,
15+
"allow_view": true,
16+
"group": null,
17+
"is_blocking": false,
18+
"object": "model_permission",
19+
"organization": "*"
20+
}
21+
],
22+
"root": "/mnt/models"
23+
}
24+
]

0 commit comments

Comments
 (0)