Skip to content

Commit 50e9c2d

Browse files
committed
add vllm_to_hf_output
1 parent f806004 commit 50e9c2d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/models/test_fuyu.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from typing import List, Optional, Type
1+
from typing import List, Optional, Tuple, Type
22

33
import pytest
44

55
from vllm.multimodal.utils import rescale_image_size
6+
from vllm.sequence import SampleLogprobs
67
from vllm.utils import is_cpu
78

89
from ..conftest import IMAGE_ASSETS, HfRunner, VllmRunner, _ImageAssets
@@ -19,6 +20,16 @@
1920
models = ["adept/fuyu-8b"]
2021

2122

23+
def vllm_to_hf_output(vllm_output: Tuple[List[int], str,
24+
Optional[SampleLogprobs]]):
25+
"""Sanitize vllm output to be comparable with hf output."""
26+
output_ids, output_str, out_logprobs = vllm_output
27+
28+
hf_output_str = output_str + "|ENDOFTEXT|"
29+
30+
return output_ids, hf_output_str, out_logprobs
31+
32+
2233
def run_test(
2334
hf_runner: Type[HfRunner],
2435
vllm_runner: Type[VllmRunner],
@@ -86,7 +97,9 @@ def run_test(
8697
vllm_outputs_per_image):
8798
check_logprobs_close(
8899
outputs_0_lst=hf_outputs,
89-
outputs_1_lst=vllm_outputs,
100+
outputs_1_lst=[
101+
vllm_to_hf_output(vllm_output) for vllm_output in vllm_outputs
102+
],
90103
name_0="hf",
91104
name_1="vllm",
92105
)

0 commit comments

Comments
 (0)