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
9ad0688e
Unverified
Commit
9ad0688e
authored
Sep 10, 2025
by
Jee Jee Li
Committed by
GitHub
Sep 09, 2025
Browse files
[Bugfix] Fix hidden_size for multimodal classification model (#24501)
Signed-off-by:
Jee Jee Li
<
pandaleefree@gmail.com
>
parent
b9a1c4c8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
vllm/model_executor/models/adapters.py
vllm/model_executor/models/adapters.py
+3
-2
vllm/model_executor/models/utils.py
vllm/model_executor/models/utils.py
+7
-0
No files found.
vllm/model_executor/models/adapters.py
View file @
9ad0688e
...
@@ -255,7 +255,7 @@ def as_seq_cls_model(cls: _T) -> _T:
...
@@ -255,7 +255,7 @@ def as_seq_cls_model(cls: _T) -> _T:
from
vllm.model_executor.models.interfaces
import
SupportsCrossEncoding
from
vllm.model_executor.models.interfaces
import
SupportsCrossEncoding
from
vllm.sequence
import
IntermediateTensors
from
vllm.sequence
import
IntermediateTensors
from
.utils
import
maybe_prefix
from
.utils
import
get_model_hidden_size
,
maybe_prefix
class
ModelForSequenceClassification
(
_create_pooling_model_cls
(
cls
),
class
ModelForSequenceClassification
(
_create_pooling_model_cls
(
cls
),
SupportsCrossEncoding
):
SupportsCrossEncoding
):
...
@@ -263,9 +263,10 @@ def as_seq_cls_model(cls: _T) -> _T:
...
@@ -263,9 +263,10 @@ def as_seq_cls_model(cls: _T) -> _T:
def
_init_pooler
(
self
,
vllm_config
:
"VllmConfig"
,
prefix
:
str
=
""
):
def
_init_pooler
(
self
,
vllm_config
:
"VllmConfig"
,
prefix
:
str
=
""
):
config
=
vllm_config
.
model_config
.
hf_config
config
=
vllm_config
.
model_config
.
hf_config
quant_config
=
vllm_config
.
quant_config
quant_config
=
vllm_config
.
quant_config
hidden_size
=
get_model_hidden_size
(
config
)
self
.
score
=
ReplicatedLinear
(
self
.
score
=
ReplicatedLinear
(
config
.
hidden_size
,
hidden_size
,
config
.
num_labels
,
config
.
num_labels
,
bias
=
False
,
bias
=
False
,
params_dtype
=
torch
.
float32
,
params_dtype
=
torch
.
float32
,
...
...
vllm/model_executor/models/utils.py
View file @
9ad0688e
...
@@ -761,3 +761,10 @@ def fast_topk(values: torch.Tensor, topk: int,
...
@@ -761,3 +761,10 @@ def fast_topk(values: torch.Tensor, topk: int,
else
:
else
:
# Use topk for efficiency with larger k values
# Use topk for efficiency with larger k values
return
torch
.
topk
(
values
,
topk
,
dim
=
dim
)
return
torch
.
topk
(
values
,
topk
,
dim
=
dim
)
def
get_model_hidden_size
(
hf_config
:
PretrainedConfig
)
->
int
:
if
hasattr
(
hf_config
,
"hidden_size"
):
return
hf_config
.
hidden_size
text_config
=
hf_config
.
get_text_config
()
return
text_config
.
hidden_size
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