Skip to content

Commit

Permalink
Merge pull request #240 from PanQiWei/support-qwen
Browse files Browse the repository at this point in the history
support qwen
  • Loading branch information
PanQiWei committed Aug 8, 2023
2 parents 5981f15 + fe24450 commit 3fb7d1e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions auto_gptq/modeling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
from .codegen import *
from .baichuan import *
from .internlm import *
from .qwen import *
1 change: 1 addition & 0 deletions auto_gptq/modeling/_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"RefinedWeb",
"baichuan",
"internlm",
"qwen",
]
if compare_transformers_version("v4.28.0", op="ge"):
SUPPORTED_MODELS.append("llama")
Expand Down
2 changes: 2 additions & 0 deletions auto_gptq/modeling/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .gpt_bigcode import GPTBigCodeGPTQForCausalLM
from .baichuan import BaiChuanGPTQForCausalLM
from .internlm import InternLMGPTQForCausalLM
from .qwen import QwenGPTQForCausalLM

GPTQ_CAUSAL_LM_MODEL_MAP = {
"bloom": BloomGPTQForCausalLM,
Expand All @@ -30,6 +31,7 @@
"RefinedWeb": RWGPTQForCausalLM,
"baichuan": BaiChuanGPTQForCausalLM,
"internlm": InternLMGPTQForCausalLM,
"qwen": QwenGPTQForCausalLM,
}


Expand Down
16 changes: 16 additions & 0 deletions auto_gptq/modeling/qwen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from ._base import *


class QwenGPTQForCausalLM(BaseGPTQForCausalLM):
layer_type = "QWenBlock"
layers_block_name = "transformer.h"
outside_layer_modules = ["transformer.wte", "transformer.wpe", "transformer.ln_f"]
inside_layer_modules = [
["attn.c_attn"],
["attn.c_proj"],
["mlp.w1", "mlp.w2"],
["mlp.c_proj"]
]


__all__ = ["QwenGPTQForCausalLM"]

0 comments on commit 3fb7d1e

Please sign in to comment.