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
2b25b7d2
Unverified
Commit
2b25b7d2
authored
Feb 11, 2025
by
Szymon Ożóg
Committed by
GitHub
Feb 11, 2025
Browse files
Fix initializing GGUF weights for ColumnParallelLinear when using tensor parallel > 1 (#13023)
parent
6c4dbe23
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
vllm/model_executor/layers/linear.py
vllm/model_executor/layers/linear.py
+12
-7
No files found.
vllm/model_executor/layers/linear.py
View file @
2b25b7d2
...
...
@@ -335,6 +335,12 @@ class ColumnParallelLinear(LinearBase):
tp_rank
=
get_tensor_model_parallel_rank
()
output_dim
=
getattr
(
param
,
"output_dim"
,
None
)
is_sharded_weight
=
getattr
(
param
,
"is_sharded_weight"
,
False
)
use_bitsandbytes_4bit
=
getattr
(
param
,
"use_bitsandbytes_4bit"
,
False
)
# bitsandbytes loads the weights of the specific portion
# no need to narrow
is_sharded_weight
=
is_sharded_weight
or
use_bitsandbytes_4bit
# Special case for GGUF
is_gguf_weight
=
getattr
(
param
,
"is_gguf_weight"
,
False
)
is_gguf_weight_type
=
getattr
(
param
,
"is_gguf_weight_type"
,
False
)
...
...
@@ -343,13 +349,12 @@ class ColumnParallelLinear(LinearBase):
# Materialize GGUF UninitializedParameter
if
is_gguf_weight
and
isinstance
(
param
,
UninitializedParameter
):
param
.
materialize
(
loaded_weight
.
shape
,
dtype
=
loaded_weight
.
dtype
)
use_bitsandbytes_4bit
=
getattr
(
param
,
"use_bitsandbytes_4bit"
,
False
)
is_sharded_weight
=
getattr
(
param
,
"is_sharded_weight"
,
False
)
# bitsandbytes loads the weights of the specific portion
# no need to narrow
is_sharded_weight
=
is_sharded_weight
or
use_bitsandbytes_4bit
final_shape
=
list
(
loaded_weight
.
shape
)
if
output_dim
is
not
None
:
tp_size
=
get_tensor_model_parallel_world_size
()
assert
final_shape
[
output_dim
]
%
tp_size
==
0
final_shape
[
output_dim
]
=
final_shape
[
output_dim
]
//
tp_size
param
.
materialize
(
final_shape
,
dtype
=
loaded_weight
.
dtype
)
param_data
=
param
.
data
if
output_dim
is
not
None
and
not
is_sharded_weight
:
...
...
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