Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MODEL]Add internlm2 support #182

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gptqmodel/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
from .starcoder2 import Starcoder2GPTQ
from .xverse import XverseGPTQ
from .yi import YiGPTQ
from .internlm2 import InternLM2GPTQ
1 change: 1 addition & 0 deletions gptqmodel/models/_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def get_device_by_type(type_value: str):
"RefinedWeb",
"baichuan",
"internlm",
"internlm2",
"qwen",
"xverse",
"deci",
Expand Down
2 changes: 2 additions & 0 deletions gptqmodel/models/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from .starcoder2 import Starcoder2GPTQ
from .xverse import XverseGPTQ
from .yi import YiGPTQ
from .internlm2 import InternLM2GPTQ

MODEL_MAP = {
"bloom": BloomGPTQ,
Expand All @@ -55,6 +56,7 @@
"falcon": RWGPTQ,
"baichuan": BaiChuanGPTQ,
"internlm": InternLMGPTQ,
"internlm2": InternLM2GPTQ,
"qwen": QwenGPTQ,
"mistral": MistralGPTQ,
"Yi": YiGPTQ,
Expand Down
14 changes: 14 additions & 0 deletions gptqmodel/models/internlm2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from .base import BaseGPTQModel


class InternLM2GPTQ(BaseGPTQModel):
base_modules = ["model.tok_embeddings", "model.norm"]

layers_node = "model.layers"
layer_type = "InternLM2DecoderLayer"
layer_modules = [
["attention.wqkv", "attention.wo"],

["feed_forward.w1", "feed_forward.w3"],
["feed_forward.w2"],
]