Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
text-generation-inference
Commits
f5a98375
Unverified
Commit
f5a98375
authored
Jun 20, 2024
by
Daniël de Kok
Committed by
GitHub
Jun 20, 2024
Browse files
Support exl2-quantized Qwen2 models (#2085)
Fixes #2081.
parent
cdbf8028
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
23 deletions
+4
-23
server/text_generation_server/models/custom_modeling/flash_qwen2_modeling.py
...ion_server/models/custom_modeling/flash_qwen2_modeling.py
+4
-23
No files found.
server/text_generation_server/models/custom_modeling/flash_qwen2_modeling.py
View file @
f5a98375
...
...
@@ -40,31 +40,12 @@ def _load_gqa(config, prefix: str, weights):
assert
config
.
hidden_size
%
config
.
num_attention_heads
==
0
assert
config
.
num_attention_heads
%
weights
.
process_group
.
size
()
==
0
weight
=
weights
.
get_multi_weights_col
(
return
TensorParallelColumnLinear
.
load_multi
(
config
,
prefixes
=
[
f
"
{
prefix
}
.q_proj"
,
f
"
{
prefix
}
.k_proj"
,
f
"
{
prefix
}
.v_proj"
],
quantize
=
config
.
quantize
,
dim
=
0
,
)
if
config
.
quantize
not
in
[
"gptq"
,
"awq"
,
"marlin"
]:
weight
=
weight
.
to
(
dtype
=
weights
.
dtype
).
to
(
device
=
weights
.
device
)
head_size
=
config
.
hidden_size
//
config
.
num_attention_heads
num_heads
=
config
.
num_attention_heads
//
weights
.
process_group
.
size
()
num_key_value_heads
=
config
.
num_key_value_heads
//
weights
.
process_group
.
size
()
assert
list
(
weight
.
shape
)
==
[
(
num_heads
+
2
*
num_key_value_heads
)
*
head_size
,
config
.
hidden_size
,
],
f
"
{
list
(
weight
.
shape
)
}
!=
{
[(
num_heads
+
2
*
config
.
num_key_value_heads
)
*
head_size
,
config
.
hidden_size
]
}
"
w
=
[
weights
.
get_sharded
(
f
"
{
p
}
.bias"
,
dim
=
0
)
for
p
in
[
f
"
{
prefix
}
.q_proj"
,
f
"
{
prefix
}
.k_proj"
,
f
"
{
prefix
}
.v_proj"
]
]
bias
=
torch
.
cat
(
w
,
dim
=
0
).
to
(
dtype
=
weights
.
dtype
).
to
(
device
=
weights
.
device
)
return
TensorParallelColumnLinear
(
get_linear
(
weight
,
bias
=
bias
,
quantize
=
config
.
quantize
)
weights
=
weights
,
bias
=
True
,
)
...
...
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