Skip to content

Commit

Permalink
support for minicpm3 (#385)
Browse files Browse the repository at this point in the history
* support for minicpm3

* Update auto.py
  • Loading branch information
LDLINGLINGLING authored Sep 10, 2024
1 parent cc9dcc0 commit 06b5c4e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions gptqmodel/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
from .starcoder2 import Starcoder2GPTQ
from .xverse import XverseGPTQ
from .yi import YiGPTQ
from .minicpm3 import MiniCPM3GPTQ
1 change: 1 addition & 0 deletions gptqmodel/models/_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def get_device_by_type(type_value: str):
"starcoder2",
"cohere",
"minicpm",
"minicpm3"
"qwen2_moe",
"dbrx_converted",
"deepseek_v2",
Expand Down
2 changes: 2 additions & 0 deletions gptqmodel/models/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .llama import LlamaGPTQ
from .longllama import LongLlamaGPTQ
from .minicpm import MiniCPMGPTQ
from .minicpm3 import MiniCPM3GPTQ
from .mistral import MistralGPTQ
from .mixtral import MixtralGPTQ
from .moss import MOSSGPTQ
Expand Down Expand Up @@ -75,6 +76,7 @@
"phi3": Phi3GPTQ,
"mpt": MPTGPTQ,
"minicpm": MiniCPMGPTQ,
"minicpm3":MiniCPM3GPTQ,
"qwen2_moe": Qwen2MoeGPTQ,
"dbrx": DbrxGPTQ,
"dbrx_converted": DbrxConvertedGPTQ,
Expand Down
15 changes: 15 additions & 0 deletions gptqmodel/models/minicpm3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from ._base import BaseGPTQModel
class MiniCPM3GPTQ(BaseGPTQModel):
layer_type = "MiniCPM3DecoderLayer"
layers_block_name = "model.layers"
outside_layer_modules = [
"model.embed_tokens",
]
inside_layer_modules = [
["self_attn.q_a_proj","self_attn.kv_a_proj_with_mqa"],
["self_attn.q_b_proj","self_attn.kv_b_proj"],
["self_attn.o_proj"],
["mlp.gate_proj","mlp.up_proj"],
["mlp.down_proj"],
]
__all__ = ["MiniCPM3GPTQForCausalLM"]

0 comments on commit 06b5c4e

Please sign in to comment.