Skip to content

Commit

Permalink
add cli to list the supported model names (#639)
Browse files Browse the repository at this point in the history
* update

* resolve comment
  • Loading branch information
RunningLeon authored Nov 3, 2023
1 parent 6e91e5c commit 1bbc6e0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ LMDeploy is a toolkit for compressing, deploying, and serving LLM, developed by

## Supported Models

`LMDeploy` has two inference backends, `Pytorch` and `TurboMind`.
`LMDeploy` has two inference backends, `Pytorch` and `TurboMind`. You can run `lmdeploy list` to check the supported model names.

### TurboMind

Expand Down
2 changes: 1 addition & 1 deletion README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ LMDeploy 由 [MMDeploy](https://github.com/open-mmlab/mmdeploy) 和 [MMRazor](ht

## 支持的模型

`LMDeploy` 支持 `TurboMind``Pytorch` 两种推理后端
`LMDeploy` 支持 `TurboMind``Pytorch` 两种推理后端。运行`lmdeploy list`可查看支持模型列表

### TurboMind

Expand Down
24 changes: 24 additions & 0 deletions lmdeploy/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,30 @@ def convert(self,
quant_path=quant_path,
group_size=group_size)

def list(self, engine: str = 'turbomind'):
"""List supported model names.
Examples 1:
lmdeploy list
Examples 2:
lmdeploy list --engine pytorch
Args:
engine (str): The backend for the model to run. Choice from
['turbomind', 'pytorch'].
"""
assert engine in ['turbomind', 'pytorch']
if engine == 'pytorch':
model_names = ['llama', 'llama2', 'internlm-7b']
elif engine == 'turbomind':
from lmdeploy.model import MODELS
model_names = list(MODELS.module_dict.keys())
model_names = [n for n in model_names if n.lower() not in ['base']]
model_names.sort()
print('Supported model names:')
print('\n'.join(model_names))


def run():
"""The entry point of running LMDeploy CLI."""
Expand Down

0 comments on commit 1bbc6e0

Please sign in to comment.