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
6b2427f9
Unverified
Commit
6b2427f9
authored
Apr 23, 2025
by
Chen Xia
Committed by
GitHub
Apr 23, 2025
Browse files
[Quantization]add prefix for commandA quantized model (#17017)
parent
b07d7416
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
vllm/model_executor/models/commandr.py
vllm/model_executor/models/commandr.py
+8
-1
No files found.
vllm/model_executor/models/commandr.py
View file @
6b2427f9
...
@@ -89,6 +89,7 @@ class CohereMLP(nn.Module):
...
@@ -89,6 +89,7 @@ class CohereMLP(nn.Module):
self
,
self
,
config
:
CohereConfig
,
config
:
CohereConfig
,
quant_config
:
Optional
[
QuantizationConfig
]
=
None
,
quant_config
:
Optional
[
QuantizationConfig
]
=
None
,
prefix
:
str
=
""
,
):
):
super
().
__init__
()
super
().
__init__
()
self
.
config
=
config
self
.
config
=
config
...
@@ -99,12 +100,14 @@ class CohereMLP(nn.Module):
...
@@ -99,12 +100,14 @@ class CohereMLP(nn.Module):
[
self
.
intermediate_size
]
*
2
,
[
self
.
intermediate_size
]
*
2
,
bias
=
False
,
bias
=
False
,
quant_config
=
quant_config
,
quant_config
=
quant_config
,
prefix
=
f
"
{
prefix
}
.gate_up_proj"
,
)
)
self
.
down_proj
=
RowParallelLinear
(
self
.
down_proj
=
RowParallelLinear
(
self
.
intermediate_size
,
self
.
intermediate_size
,
self
.
hidden_size
,
self
.
hidden_size
,
bias
=
False
,
bias
=
False
,
quant_config
=
quant_config
,
quant_config
=
quant_config
,
prefix
=
f
"
{
prefix
}
.down_proj"
,
)
)
self
.
act_fn
=
SiluAndMul
()
self
.
act_fn
=
SiluAndMul
()
...
@@ -158,12 +161,14 @@ class CohereAttention(nn.Module):
...
@@ -158,12 +161,14 @@ class CohereAttention(nn.Module):
self
.
total_num_kv_heads
,
self
.
total_num_kv_heads
,
bias
=
False
,
bias
=
False
,
quant_config
=
quant_config
,
quant_config
=
quant_config
,
prefix
=
f
"
{
prefix
}
.qkv_proj"
,
)
)
self
.
o_proj
=
RowParallelLinear
(
self
.
o_proj
=
RowParallelLinear
(
self
.
total_num_heads
*
self
.
head_dim
,
self
.
total_num_heads
*
self
.
head_dim
,
self
.
hidden_size
,
self
.
hidden_size
,
bias
=
False
,
bias
=
False
,
quant_config
=
quant_config
,
quant_config
=
quant_config
,
prefix
=
f
"
{
prefix
}
.o_proj"
,
)
)
self
.
rotary_emb
=
get_rope
(
self
.
rotary_emb
=
get_rope
(
self
.
head_dim
,
self
.
head_dim
,
...
@@ -244,7 +249,9 @@ class CohereDecoderLayer(nn.Module):
...
@@ -244,7 +249,9 @@ class CohereDecoderLayer(nn.Module):
quant_config
=
quant_config
,
quant_config
=
quant_config
,
prefix
=
f
"
{
prefix
}
.self_attn"
)
prefix
=
f
"
{
prefix
}
.self_attn"
)
self
.
mlp
=
CohereMLP
(
config
,
quant_config
=
quant_config
)
self
.
mlp
=
CohereMLP
(
config
,
quant_config
=
quant_config
,
prefix
=
f
"
{
prefix
}
.mlp"
)
self
.
input_layernorm
=
LayerNorm
(
param_shape
=
(
config
.
hidden_size
),
self
.
input_layernorm
=
LayerNorm
(
param_shape
=
(
config
.
hidden_size
),
eps
=
config
.
layer_norm_eps
)
eps
=
config
.
layer_norm_eps
)
...
...
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