@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / ec784b2526
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 17, 00:30 UTC

[CI/Build] Add inputs tests (#5215)

Cyrus Leung committed Jun 4, 2024 at 12:01 UTC ec784b2526219cd96159a52074ab8cd4e684410a
2 files changed +14 -5
.buildkite/test-pipeline.yaml
+7 -1
@@ -62,7 +62,6 @@ steps:
62 mirror_hardwares: [amd]
63
64 commands:
65 - - pytest -v -s test_inputs.py
65 - pytest -v -s entrypoints -m llm
66 - pytest -v -s entrypoints -m openai
67
@@ -79,6 +78,13 @@ steps:
78 - python3 llava_example.py
79 - python3 tensorize_vllm_model.py --model facebook/opt-125m serialize --serialized-directory /tmp/ --suffix v1 && python3 tensorize_vllm_model.py --model facebook/opt-125m deserialize --path-to-tensors /tmp/vllm/facebook/opt-125m/v1/model.tensors
80
81 +- label: Inputs Test
82 + #mirror_hardwares: [amd]
83 + commands:
84 + - bash ../.buildkite/download-images.sh
85 + - pytest -v -s test_inputs.py
86 + - pytest -v -s multimodal
87 +
88 - label: Kernels Test %N
89 #mirror_hardwares: [amd]
90 command: pytest -v -s kernels --shard-id=$$BUILDKITE_PARALLEL_JOB --num-shards=$$BUILDKITE_PARALLEL_JOB_COUNT
tests/multimodal/test_processor.py
+7 -4
@@ -6,8 +6,10 @@ from vllm.config import ModelConfig, VisionLanguageConfig
6 from vllm.multimodal import MULTIMODAL_REGISTRY
7 from vllm.multimodal.image import ImagePixelData
8
9 +from ..conftest import _STR_DTYPE_TO_TORCH_DTYPE
10
10 -@pytest.mark.parametrize("dtype", ["half", "bfloat16", "float"])
11 +
12 +@pytest.mark.parametrize("dtype", ["half", "float"])
13 def test_clip_image_processor(hf_images, dtype):
14 MODEL_NAME = "llava-hf/llava-1.5-7b-hf"
15 IMAGE_HEIGHT = IMAGE_WIDTH = 33
@@ -36,8 +38,8 @@ def test_clip_image_processor(hf_images, dtype):
38 for image in hf_images:
39 hf_result = hf_processor.preprocess(
40 image,
39 - return_tensors="np",
40 - )
41 + return_tensors="pt",
42 + ).to(dtype=_STR_DTYPE_TO_TORCH_DTYPE[dtype])
43 vllm_result = MULTIMODAL_REGISTRY.process_input(
44 ImagePixelData(image),
45 model_config=model_config,
@@ -45,7 +47,8 @@ def test_clip_image_processor(hf_images, dtype):
47 )
48
49 assert hf_result.keys() == vllm_result.keys()
48 - for key, hf_arr in hf_result.items():
50 + for key, hf_tensor in hf_result.items():
51 + hf_arr: np.ndarray = hf_tensor.numpy()
52 vllm_arr: np.ndarray = vllm_result[key].numpy()
53
54 assert hf_arr.shape == vllm_arr.shape, f"Failed for key={key}"