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
AutoAWQ
Commits
1aa8aebd
Commit
1aa8aebd
authored
Sep 11, 2023
by
Casper Hansen
Browse files
Remove xformers
parent
dd41a223
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
19 deletions
+2
-19
awq/models/falcon.py
awq/models/falcon.py
+1
-17
setup.py
setup.py
+1
-2
No files found.
awq/models/falcon.py
View file @
1aa8aebd
...
...
@@ -7,8 +7,6 @@ class FalconAWQForCausalLM(BaseAWQForCausalLM):
@
staticmethod
def
fuse_layers
(
model
:
FalconForCausalLM
,
quant_config
:
dict
):
fuser
=
FalconFuser
(
model
)
# fuser.fuse_attention()
# fuser.fuse_layernorm()
@
staticmethod
def
get_model_layers
(
model
:
FalconForCausalLM
):
...
...
@@ -65,11 +63,9 @@ class FalconAWQForCausalLM(BaseAWQForCausalLM):
return
layers
import
torch
import
xformers
from
torch.nn
import
LayerNorm
from
typing
import
List
,
Tuple
from
awq.utils.utils
import
set_module_name
from
xformers.triton.layer_norm
import
FusedLayerNorm
from
awq.modules.fused.attn
import
QuantAttentionFused
class
FalconFuser
:
...
...
@@ -97,15 +93,3 @@ class FalconFuser:
self
.
model
.
config
.
max_new_tokens
)
set_module_name
(
self
.
model
,
name
,
attn
)
\ No newline at end of file
def
fuse_layernorm
(
self
):
xformers
.
triton
.
k_layer_norm
.
_triton_layernorm_fp16_enabled
=
True
for
name
,
module
in
self
.
layernorm_modules
:
norm
=
FusedLayerNorm
(
module
.
weight
.
shape
,
eps
=
module
.
eps
).
to
(
module
.
weight
.
device
)
# copy weights and bias
with
torch
.
no_grad
():
norm
.
weight
=
module
.
weight
norm
.
bias
=
module
.
bias
set_module_name
(
self
.
model
,
name
,
norm
)
\ No newline at end of file
setup.py
View file @
1aa8aebd
...
...
@@ -45,8 +45,7 @@ requirements = [
"attributedict"
,
"protobuf"
,
"torchvision"
,
"tabulate"
,
"xformers"
"tabulate"
]
def
get_include_dirs
():
...
...
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