Skip to content

Commit

Permalink
add internlm3-dense(turbomind) & chat template
Browse files Browse the repository at this point in the history
  • Loading branch information
irexyc committed Jan 14, 2025
1 parent 46aa4e5 commit 7884556
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lmdeploy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,12 @@ def match(cls, model_path: str) -> Optional[str]:
model_path (str): the model path used for matching.
"""
path = model_path.lower()
if all([c not in path for c in ['internlm2', '8k']]) and \
if all([c not in path for c in ['internlm3', 'internlm2', '8k']]) and \
all([c in path for c in ['internlm', 'chat']]):
return 'internlm'


@MODELS.register_module(name='internlm3')
@MODELS.register_module(name='internlm2')
class InternLM2Chat7B(InternLMChat7B):
"""Chat template and generation parameters of InternLM2-Chat-7B."""
Expand Down Expand Up @@ -490,6 +491,8 @@ def match(cls, model_path: str) -> Optional[str]:
path = model_path.lower()
if 'internlm2' in path and ('chat' in path or 'math' in path):
return 'internlm2'
if 'internlm3' in path and ('chat' in path or 'math' in path):
return 'internlm3'

def messages2prompt(self,
messages,
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/turbomind/deploy/source_model/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def model_info(self):

return dict(
size_per_head=head_dim,
rotary_embedding=hidden_units // attn_head_num,
rotary_embedding=head_dim,
num_layer=num_layer,
norm_eps=norm_eps,
head_num=attn_head_num,
Expand Down
2 changes: 2 additions & 0 deletions lmdeploy/turbomind/supported_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
InternLMForCausalLM='llama',
# internlm2
InternLM2ForCausalLM='internlm2',
# internlm3
InternLM3ForCausalLM='llama',
# llama, llama2, alpaca, vicuna, codellama, ultracm, yi,
# deepseek-coder, deepseek-llm
LlamaForCausalLM='llama',
Expand Down

0 comments on commit 7884556

Please sign in to comment.