@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 3dd507083f
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 16, 22:00 UTC

[CI/Build] Cleanup VLM tests (#6107)

Cyrus Leung committed Jul 4, 2024 at 09:58 UTC 3dd507083f4d8416d5fed9827e91d22f29b0b723
4 files changed +5 -8
tests/models/test_llava_next.py
+2 -5
@@ -1,4 +1,3 @@
1 -import re
1 from typing import List, Optional, Tuple
2
3 import pytest
@@ -36,7 +35,6 @@ def vllm_to_hf_output(vllm_output: Tuple[List[int], str,
35 output_ids, output_str, out_logprobs = vllm_output
36
37 tokenizer = AutoTokenizer.from_pretrained(model)
39 - image_token_str = tokenizer.decode(IMAGE_TOKEN_ID)
38 eos_token_id = tokenizer.eos_token_id
39
40 hf_output_ids = [
@@ -44,9 +42,8 @@ def vllm_to_hf_output(vllm_output: Tuple[List[int], str,
42 if token_id != IMAGE_TOKEN_ID or output_ids[idx - 1] != IMAGE_TOKEN_ID
43 ]
44
47 - hf_output_str = re.sub(fr"({image_token_str})+", "", output_str)
48 - assert hf_output_str[0] == " "
49 - hf_output_str = hf_output_str[1:]
45 + assert output_str[0] == " "
46 + hf_output_str = output_str[1:]
47 if hf_output_ids[-1] == eos_token_id:
48 hf_output_str = hf_output_str + tokenizer.decode(eos_token_id)
49
tests/models/test_phi3v.py
+1 -2
@@ -35,8 +35,7 @@ def vllm_to_hf_output(vllm_output: Tuple[List[int], str,
35 assert output_str_without_image[0] == " "
36 output_str_without_image = output_str_without_image[1:]
37
38 - hf_output_str = output_str_without_image.replace("<|user|>", "") \
39 - .replace("<|end|>\n<|assistant|>", " ")
38 + hf_output_str = output_str_without_image + "<|end|><|endoftext|>"
39
40 tokenizer = AutoTokenizer.from_pretrained(model)
41 hf_output_ids = tokenizer.encode(output_str_without_image)
tests/models/utils.py
+1
@@ -77,6 +77,7 @@ def check_logprobs_close(
77 # Each predicted token must be in top N logprobs of the other
78 fail_msg = (
79 f"Test{prompt_idx}:"
80 + f"\nMatched tokens:\t{output_ids_0[:idx]}"
81 f"\n{name_0}:\t{output_str_0!r}\t{logprobs_elem_0}"
82 f"\n{name_1}:\t{output_str_1!r}\t{logprobs_elem_1}")
83
vllm/multimodal/image.py
+1 -1
@@ -115,7 +115,7 @@ class ImagePlugin(MultiModalPlugin):
115 if isinstance(data, Image.Image):
116 image_processor = self._get_hf_image_processor(model_config)
117 if image_processor is None:
118 - raise RuntimeError("No HuggingFace processor is available"
118 + raise RuntimeError("No HuggingFace processor is available "
119 "to process the image object")
120 try:
121 batch_data = image_processor \