Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
c35e4a3d
Unverified
Commit
c35e4a3d
authored
Jun 20, 2024
by
Chang Su
Committed by
GitHub
Jun 21, 2024
Browse files
[BugFix] Fix test_phi3v.py (#5725)
parent
1f567421
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
tests/conftest.py
tests/conftest.py
+3
-1
tests/models/test_phi3v.py
tests/models/test_phi3v.py
+6
-4
No files found.
tests/conftest.py
View file @
c35e4a3d
...
...
@@ -233,11 +233,13 @@ class HfRunner:
prompts
:
List
[
str
],
max_tokens
:
int
,
images
:
Optional
[
List
[
Image
.
Image
]]
=
None
,
**
kwargs
,
)
->
List
[
Tuple
[
List
[
int
],
str
]]:
outputs
=
self
.
generate
(
prompts
,
do_sample
=
False
,
max_new_tokens
=
max_tokens
,
images
=
images
)
images
=
images
,
**
kwargs
)
return
[(
output_ids
[
0
],
output_str
[
0
])
for
output_ids
,
output_str
in
outputs
]
...
...
tests/models/test_phi3v.py
View file @
c35e4a3d
...
...
@@ -77,7 +77,7 @@ if is_cpu():
# numeric difference for longer context and test can't pass
@
pytest
.
mark
.
parametrize
(
"model_and_config"
,
model_and_vl_config
)
@
pytest
.
mark
.
parametrize
(
"dtype"
,
[
target_dtype
])
@
pytest
.
mark
.
parametrize
(
"max_tokens"
,
[
8
])
@
pytest
.
mark
.
parametrize
(
"max_tokens"
,
[
12
8
])
def
test_models
(
hf_runner
,
vllm_runner
,
hf_images
,
vllm_images
,
model_and_config
,
dtype
:
str
,
max_tokens
:
int
)
->
None
:
"""Inference result should be the same between hf and vllm.
...
...
@@ -95,9 +95,11 @@ def test_models(hf_runner, vllm_runner, hf_images, vllm_images,
hf_model_kwargs
=
{
"_attn_implementation"
:
"eager"
}
with
hf_runner
(
model_id
,
dtype
=
dtype
,
model_kwargs
=
hf_model_kwargs
)
as
hf_model
:
hf_outputs
=
hf_model
.
generate_greedy
(
HF_IMAGE_PROMPTS
,
hf_outputs
=
hf_model
.
generate_greedy
(
HF_IMAGE_PROMPTS
,
max_tokens
,
images
=
hf_images
)
images
=
hf_images
,
eos_token_id
=
hf_model
.
processor
.
tokenizer
.
eos_token_id
)
vllm_image_prompts
=
[
p
.
replace
(
"<|image_1|>"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment