Skip to content

Commit

Permalink
leave orig layer set by user
Browse files Browse the repository at this point in the history
  • Loading branch information
wangruohui committed Aug 11, 2023
1 parent ee1ccd3 commit bdf8a90
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions deepspeed/module_inject/containers/internlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

# Copyright (c) wangruohui

import sys

from .base import *
from .features import HybridSplitQKVContainer, HybridGatedMLPContainer
from deepspeed.utils.types import ActivationFuncType, NormType
Expand Down Expand Up @@ -122,6 +120,7 @@ def load_params(self, module, sd, weight_quantizer, mp_replace, prefix):


class InternLMLayerPolicy(TransformerPolicy):
_orig_layer_class = None

def __init__(self, client_module, inference=True):
super().__init__(
Expand All @@ -131,12 +130,6 @@ def __init__(self, client_module, inference=True):
)
self.client_module = client_module

from transformers.utils import HF_MODULES_CACHE

sys.path.append(HF_MODULES_CACHE)
from transformers_modules.internlm.modeling_internlm import InternLMDecoderLayer
InternLMLayerPolicy._orig_layer_class = InternLMDecoderLayer

def get_hidden_heads(self):
return self.client_module.self_attn.q_proj.weight.shape[1], \
self.client_module.self_attn.num_heads, \
Expand Down

0 comments on commit bdf8a90

Please sign in to comment.