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
0f961b3c
Unverified
Commit
0f961b3c
authored
Sep 20, 2024
by
zyddnys
Committed by
GitHub
Sep 20, 2024
Browse files
[Bugfix] Fix incorrect llava next feature size calculation (#8496)
parent
7f9c8902
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
vllm/model_executor/models/llava_next.py
vllm/model_executor/models/llava_next.py
+8
-6
No files found.
vllm/model_executor/models/llava_next.py
View file @
0f961b3c
...
@@ -87,17 +87,19 @@ def _get_llava_next_num_unpadded_features(
...
@@ -87,17 +87,19 @@ def _get_llava_next_num_unpadded_features(
current_height
=
npatches
*
num_patch_height
current_height
=
npatches
*
num_patch_height
current_width
=
npatches
*
num_patch_width
current_width
=
npatches
*
num_patch_width
aspect_ratio
=
original_width
/
original_height
original_
aspect_ratio
=
original_width
/
original_height
current_aspect_ratio
=
current_width
/
current_height
current_aspect_ratio
=
current_width
/
current_height
if
aspect_ratio
>
current_aspect_ratio
:
if
original_aspect_ratio
>
current_aspect_ratio
:
new_height
=
(
original_height
*
current_width
)
//
original_width
scale_factor
=
current_width
/
original_width
new_height
=
int
(
original_height
*
scale_factor
)
padding
=
(
current_height
-
new_height
)
//
2
padding
=
(
current_height
-
new_height
)
//
2
current_height
-=
padding
*
2
current_height
-=
2
*
padding
else
:
else
:
new_width
=
(
original_width
*
current_height
)
//
original_height
scale_factor
=
current_height
/
original_height
new_width
=
int
(
original_width
*
scale_factor
)
padding
=
(
current_width
-
new_width
)
//
2
padding
=
(
current_width
-
new_width
)
//
2
current_width
-=
padding
*
2
current_width
-=
2
*
padding
unpadded_features
=
current_height
*
current_width
unpadded_features
=
current_height
*
current_width
newline_features
=
current_height
newline_features
=
current_height
...
...
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