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
0aa4a596
Commit
0aa4a596
authored
Sep 02, 2023
by
Casper Hansen
Browse files
Fix model references
parent
1df0136e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
awq/models/llama.py
awq/models/llama.py
+5
-6
No files found.
awq/models/llama.py
View file @
0aa4a596
...
@@ -6,8 +6,8 @@ class LlamaAWQForCausalLM(BaseAWQForCausalLM):
...
@@ -6,8 +6,8 @@ class LlamaAWQForCausalLM(BaseAWQForCausalLM):
max_new_tokens_key
=
"max_position_embeddings"
max_new_tokens_key
=
"max_position_embeddings"
@
staticmethod
@
staticmethod
def
fuse_layers
(
awq_
model
:
BaseAWQ
ForCausalLM
):
def
fuse_layers
(
model
:
Llama
ForCausalLM
):
fuser
=
LlamaFuser
(
awq_
model
)
fuser
=
LlamaFuser
(
model
)
fuser
.
fuse_attention
()
fuser
.
fuse_attention
()
fuser
.
fuse_rmsnorm
()
fuser
.
fuse_rmsnorm
()
fuser
.
fuse_mlp
()
fuser
.
fuse_mlp
()
...
@@ -75,9 +75,8 @@ from awq.modules.fused_attn import QuantLlamaAttention
...
@@ -75,9 +75,8 @@ from awq.modules.fused_attn import QuantLlamaAttention
from
transformers.models.llama.modeling_llama
import
LlamaAttention
,
LlamaRMSNorm
,
LlamaMLP
from
transformers.models.llama.modeling_llama
import
LlamaAttention
,
LlamaRMSNorm
,
LlamaMLP
class
LlamaFuser
:
class
LlamaFuser
:
def
__init__
(
self
,
awq_model
:
BaseAWQForCausalLM
):
def
__init__
(
self
,
model
):
self
.
awq_model
=
awq_model
self
.
model
=
model
self
.
model
=
awq_model
.
model
self
.
attention_modules
:
List
[
Tuple
[
str
,
LlamaAttention
]]
=
[
self
.
attention_modules
:
List
[
Tuple
[
str
,
LlamaAttention
]]
=
[
(
name
,
module
)
for
name
,
module
in
self
.
model
.
named_modules
()
(
name
,
module
)
for
name
,
module
in
self
.
model
.
named_modules
()
...
@@ -103,7 +102,7 @@ class LlamaFuser:
...
@@ -103,7 +102,7 @@ class LlamaFuser:
qkv_layer
,
qkv_layer
,
module
.
o_proj
,
module
.
o_proj
,
qkv_layer
.
qweight
.
device
,
qkv_layer
.
qweight
.
device
,
self
.
awq_model
.
model
.
config
.
max_new_tokens
self
.
model
.
config
.
max_new_tokens
)
)
set_module_name
(
self
.
model
,
name
,
attn
)
set_module_name
(
self
.
model
,
name
,
attn
)
...
...
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