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
d022115c
Unverified
Commit
d022115c
authored
May 22, 2025
by
youngrok cha
Committed by
GitHub
May 21, 2025
Browse files
[Bugfix] Inconsistent token calculation compared to HF in llava family (#18479)
Signed-off-by:
jaycha
<
jaycha@ncsoft.com
>
parent
acb54ca8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
vllm/model_executor/models/llava_next.py
vllm/model_executor/models/llava_next.py
+4
-2
vllm/model_executor/models/llava_onevision.py
vllm/model_executor/models/llava_onevision.py
+4
-2
No files found.
vllm/model_executor/models/llava_next.py
View file @
d022115c
...
...
@@ -135,11 +135,13 @@ class LlavaNextProcessingInfo(BaseLlavaProcessingInfo):
current_aspect_ratio
=
current_width
/
current_height
if
aspect_ratio
>
current_aspect_ratio
:
new_height
=
(
original_height
*
current_width
)
//
original_width
new_height
=
int
(
round
(
original_height
*
(
current_width
/
original_width
),
7
))
padding
=
(
current_height
-
new_height
)
//
2
current_height
=
current_height
-
(
2
*
padding
)
else
:
new_width
=
(
original_width
*
current_height
)
//
original_height
new_width
=
int
(
round
(
original_width
*
(
current_height
/
original_height
),
7
))
padding
=
(
current_width
-
new_width
)
//
2
current_width
=
current_width
-
(
2
*
padding
)
...
...
vllm/model_executor/models/llava_onevision.py
View file @
d022115c
...
...
@@ -116,11 +116,13 @@ class LlavaOnevisionProcessingInfo(LlavaNextProcessingInfo):
current_aspect_ratio
=
current_width
/
current_height
if
aspect_ratio
>
current_aspect_ratio
:
new_height
=
(
original_height
*
current_width
)
//
original_width
new_height
=
int
(
round
(
original_height
*
(
current_width
/
original_width
),
7
))
padding
=
(
current_height
-
new_height
)
//
2
current_height
=
current_height
-
(
2
*
padding
)
else
:
new_width
=
(
original_width
*
current_height
)
//
original_height
new_width
=
int
(
round
(
original_width
*
(
current_height
/
original_height
),
7
))
padding
=
(
current_width
-
new_width
)
//
2
current_width
=
current_width
-
(
2
*
padding
)
...
...
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