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
fec9da0a
Unverified
Commit
fec9da0a
authored
Jan 23, 2026
by
Matteo Fari
Committed by
GitHub
Jan 24, 2026
Browse files
[Model] Enable LoRA support for internvl2 (#32397)
Signed-off-by:
Matteo Fari
<
matteofari06@gmail.com
>
parent
bbbd696a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
vllm/model_executor/models/internvl.py
vllm/model_executor/models/internvl.py
+16
-3
No files found.
vllm/model_executor/models/internvl.py
View file @
fec9da0a
...
...
@@ -1086,9 +1086,8 @@ class InternVLChatModel(nn.Module, SupportsMultiModal, SupportsPP, SupportsLoRA)
image_size
=
config
.
force_image_size
or
config
.
vision_config
.
image_size
patch_size
=
config
.
vision_config
.
patch_size
self
.
patch_size
=
patch_size
self
.
num_image_token
=
int
(
(
image_size
//
patch_size
)
**
2
*
(
config
.
downsample_ratio
**
2
)
)
self
.
patch_tokens
=
(
image_size
//
patch_size
)
**
2
self
.
num_image_token
=
int
(
self
.
patch_tokens
*
(
config
.
downsample_ratio
**
2
))
self
.
downsample_ratio
=
config
.
downsample_ratio
self
.
ps_version
=
config
.
ps_version
...
...
@@ -1430,3 +1429,17 @@ class InternVLChatModel(nn.Module, SupportsMultiModal, SupportsPP, SupportsLoRA)
connector
=
"mlp1"
,
tower_model
=
"vision_model"
,
)
def
get_num_mm_encoder_tokens
(
self
,
num_image_tokens
:
int
)
->
int
:
if
num_image_tokens
<=
0
or
self
.
num_image_token
<=
0
:
return
0
num_patches
=
num_image_tokens
//
self
.
num_image_token
return
num_patches
*
(
self
.
patch_tokens
+
1
)
def
get_num_mm_connector_tokens
(
self
,
num_vision_tokens
:
int
)
->
int
:
if
num_vision_tokens
<=
0
or
self
.
num_image_token
<=
0
:
return
0
num_patches
=
num_vision_tokens
//
(
self
.
patch_tokens
+
1
)
return
num_patches
*
self
.
num_image_token
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