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
281cc4b3
Unverified
Commit
281cc4b3
authored
Nov 18, 2024
by
Michael Goin
Committed by
GitHub
Nov 18, 2024
Browse files
[Model][Bugfix] Support TP for PixtralHF ViT (#10405)
Signed-off-by:
mgoin
<
michael@neuralmagic.com
>
parent
4f686d13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
vllm/model_executor/models/pixtral.py
vllm/model_executor/models/pixtral.py
+6
-2
No files found.
vllm/model_executor/models/pixtral.py
View file @
281cc4b3
...
...
@@ -17,6 +17,7 @@ from transformers.models.pixtral.modeling_pixtral import (
from
vllm.attention
import
AttentionMetadata
from
vllm.config
import
ModelConfig
,
VllmConfig
from
vllm.distributed
import
divide
,
get_tensor_model_parallel_world_size
from
vllm.inputs
import
(
INPUT_REGISTRY
,
DecoderOnlyInputs
,
DummyData
,
InputContext
,
token_inputs
)
from
vllm.model_executor.layers.activation
import
get_act_and_mul_fn
...
...
@@ -843,17 +844,20 @@ class PixtralHFAttention(nn.Module):
self
.
config
=
config
assert
not
config
.
hidden_size
%
config
.
num_attention_heads
self
.
n_heads
=
config
.
num_attention_heads
self
.
total_num_heads
=
config
.
num_attention_heads
tp_size
=
get_tensor_model_parallel_world_size
()
self
.
n_heads
=
divide
(
config
.
num_attention_heads
,
tp_size
)
self
.
head_dim
=
config
.
hidden_size
//
config
.
num_attention_heads
self
.
qkv_proj
=
QKVParallelLinear
(
hidden_size
=
config
.
hidden_size
,
head_size
=
self
.
head_dim
,
total_num_heads
=
self
.
n
_heads
,
total_num_heads
=
self
.
total_num
_heads
,
bias
=
False
,
quant_config
=
quant_config
,
prefix
=
f
"
{
prefix
}
.qkv_proj"
,
)
assert
self
.
total_num_heads
*
self
.
head_dim
==
config
.
hidden_size
self
.
o_proj
=
RowParallelLinear
(
input_size
=
config
.
hidden_size
,
output_size
=
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