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
6172b158
Commit
6172b158
authored
Aug 15, 2024
by
zhuwenwen
Browse files
修改awq 申请sharememshapce方式
parent
33290303
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
vllm/model_executor/layers/quantization/awq.py
vllm/model_executor/layers/quantization/awq.py
+15
-5
No files found.
vllm/model_executor/layers/quantization/awq.py
View file @
6172b158
...
...
@@ -10,9 +10,18 @@ from vllm.model_executor.layers.quantization.base_config import (
from
vllm.model_executor.utils
import
set_weight_attrs
class
AWQShareWorkSpace
():
awqworkshapcesize
=
2
<<
29
#
awqworkshapce
=
torch
.
zeros
(
awqworkshapcesize
//
2
+
1
,
dtype
=
torch
.
float16
).
cuda
()
class
AWQShareWorkSpace
:
_instance
=
None
def
__new__
(
cls
,
*
args
,
**
kwargs
):
if
cls
.
_instance
is
None
:
cls
.
_instance
=
super
(
AWQShareWorkSpace
,
cls
).
__new__
(
cls
,
*
args
,
**
kwargs
)
cls
.
_instance
.
_initialize
()
return
cls
.
_instance
def
_initialize
(
self
):
self
.
awqworkshapcesize
=
2
<<
29
self
.
awqworkshapce
=
torch
.
zeros
(
self
.
awqworkshapcesize
//
2
+
1
,
dtype
=
torch
.
float16
).
cuda
()
class
AWQConfig
(
QuantizationConfig
):
...
...
@@ -87,6 +96,7 @@ class AWQLinearMethod(LinearMethodBase):
def
__init__
(
self
,
quant_config
:
AWQConfig
):
self
.
quant_config
=
quant_config
self
.
awqsingleton
=
AWQShareWorkSpace
()
def
create_weights
(
self
,
layer
:
torch
.
nn
.
Module
,
input_size_per_partition
:
int
,
...
...
@@ -198,8 +208,8 @@ class AWQLinearMethod(LinearMethodBase):
k
,
self
.
quant_config
.
group_size
,
padding_group
,
AWQShareWorkSpace
.
awqworkshapce
,
AWQShareWorkSpace
.
awqworkshapcesize
)
self
.
awqsingleton
.
awqworkshapce
,
self
.
awqsingleton
.
awqworkshapcesize
)
#下面是采用rocblas的做法
# deqweight=ops.dequant_w4_gemm_colmajor( #shape[n,k/8]--->[n,k]
# qweight,
...
...
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