Skip to content

Commit

Permalink
dense for gptq
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Jan 14, 2025
1 parent 9c13834 commit 9aaf0b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lmdeploy/lite/apis/gptq.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ def auto_gptq(model: str,
from auto_gptq.modeling._const import SUPPORTED_MODELS

from ..modeling.internlm2_gptq import InternLM2GPTQForCausalLM
from ..modeling.internlm3_gptq import InternLM3GPTQForCausalLM
SUPPORTED_MODELS.append('internlm2')
GPTQ_CAUSAL_LM_MODEL_MAP.update(dict(internlm2=InternLM2GPTQForCausalLM))
SUPPORTED_MODELS.append('internlm3')
GPTQ_CAUSAL_LM_MODEL_MAP.update(dict(internlm3=InternLM3GPTQForCausalLM))

pretrained_model_dir = model
quantized_model_dir = work_dir
Expand Down
14 changes: 14 additions & 0 deletions lmdeploy/lite/modeling/internlm3_gptq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) OpenMMLab. All rights reserved.
from auto_gptq.modeling import BaseGPTQForCausalLM


class InternLM3GPTQForCausalLM(BaseGPTQForCausalLM):
layer_type = 'InternLM3DecoderLayer'
layers_block_name = 'model.layers'
outside_layer_modules = ['model.embed_tokens', 'model.norm']
inside_layer_modules = [
['self_attn.k_proj', 'self_attn.v_proj', 'self_attn.q_proj'],
['self_attn.o_proj'],
['mlp.up_proj', 'mlp.gate_proj'],
['mlp.down_proj'],
]

0 comments on commit 9aaf0b9

Please sign in to comment.