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

Add extra_requires to reduce dependencies #580

Merged
merged 13 commits into from
Nov 10, 2023
Merged
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,17 @@ And the request throughput of TurboMind is 30% higher than vLLM.
Install lmdeploy with pip ( python 3.8+) or [from source](./docs/en/build.md)

```shell
pip install lmdeploy
pip install lmdeploy[all]
AllentDan marked this conversation as resolved.
Show resolved Hide resolved
lvhan028 marked this conversation as resolved.
Show resolved Hide resolved
```

> **Note**<br />
> `pip install lmdeploy` can only install the runtime required packages. If users want to run codes from modules like `lmdeploy.lite` and `lmdeploy.serve`, they need to install the extra required packages.
> For instance, running `pip install lmdeploy[lite]` would install extra dependencies for `lmdeploy.lite` module.
>
> - `all`: Install lmdeploy with all dependencies in `requirements.txt`
> - `lite`: Install lmdeploy with extra dependencies in `requirements/lite.txt`
> - `serve`: Install lmdeploy with dependencies in `requirements/serve.txt`

### Deploy InternLM

#### Get InternLM model
Expand Down Expand Up @@ -182,6 +190,7 @@ bash workspace/service_docker_up.sh
Then, you can communicate with the inference server by command line,

```shell
python3 -m pip install tritonclient[grpc]
lmdeploy serve triton_client {server_ip_addresss}:33337
```

Expand Down
10 changes: 9 additions & 1 deletion README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,16 @@ TurboMind 的 output token throughput 超过 2000 token/s, 整体比 DeepSpeed
使用 pip ( python 3.8+) 安装 LMDeploy,或者[源码安装](./docs/zh_cn/build.md)

```shell
pip install lmdeploy
pip install lmdeploy[all]
```

> **Note**<br />
> `pip install lmdeploy`默认安装runtime依赖包,使用lmdeploy的lite和serve功能时,用户需要安装额外依赖包。例如: `pip install lmdeploy[lite]` 会额外安装`lmdeploy.lite`模块的依赖包
>
> - `all`: 安装`lmdeploy`所有依赖包,具体可查看`requirements.txt`
> - `lite`: 额外安装`lmdeploy.lite`模块的依赖包,具体可查看`requirements/lite.txt`
> - `serve`: 额外安装`lmdeploy.serve`模块的依赖包,具体可查看`requirements/serve.txt`

### 部署 InternLM

#### 获取 InternLM 模型
Expand Down Expand Up @@ -182,6 +189,7 @@ bash workspace/service_docker_up.sh
你可以通过命令行方式与推理服务进行对话:

```shell
python3 -m pip install tritonclient[grpc]
lmdeploy serve triton_client {server_ip_addresss}:33337
```

Expand Down
4 changes: 2 additions & 2 deletions docs/en/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It may have been caused by the following reasons.
1. You haven't installed lmdeploy's precompiled package. `_turbomind` is the pybind package of c++ turbomind, which involves compilation. It is recommended that you install the precompiled one.

```shell
pip install lmdeploy
pip install lmdeploy[all]
```

2. If you have installed it and still encounter this issue, it is probably because you are executing turbomind-related command in the root directory of lmdeploy source code. Switching to another directory will fix it
Expand All @@ -26,7 +26,7 @@ pip install lmdeploy

### libnccl.so.2 not found

Make sure you have install lmdeploy (>=v0.0.5) through `pip install lmdeploy`.
Make sure you have install lmdeploy (>=v0.0.5) through `pip install lmdeploy[all]`.

If the issue still exists after lmdeploy installation, add the path of `libnccl.so.2` to environment variable LD_LIBRARY_PATH.

Expand Down
2 changes: 1 addition & 1 deletion docs/en/supported_models/codellama.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Based on the above table, download the model that meets your requirements. Execu

```shell
# install lmdeploy
python3 -m pip install lmdeploy
python3 -m pip install lmdeploy[all]

# convert weight layout
lmdeploy convert codellama /the/path/of/codellama/model
Expand Down
2 changes: 1 addition & 1 deletion docs/en/w4a16.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LMDeploy supports LLM model inference of 4-bit weight, with the minimum requirem
Before proceeding with the inference, please ensure that lmdeploy is installed.

```shell
pip install lmdeploy
pip install lmdeploy[all]
```

## 4-bit LLM model Inference
Expand Down
4 changes: 2 additions & 2 deletions docs/zh_cn/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pip install --upgrade mmengine
1. 您没有安装 lmdeploy 的预编译包。`_turbomind`是 turbomind c++ 的 pybind部分,涉及到编译。推荐您直接安装预编译包。

```
pip install lmdeploy
pip install lmdeploy[all]
```

2. 如果已经安装了,还是出现这个问题,请检查下执行目录。不要在 lmdeploy 的源码根目录下执行 python -m lmdeploy.turbomind.\*下的package,换到其他目录下执行。
Expand All @@ -26,7 +26,7 @@ pip install lmdeploy

### libnccl.so.2 not found

确保通过 `pip install lmdeploy` 安装了 lmdeploy (>=v0.0.5)。
确保通过 `pip install lmdeploy[all]` 安装了 lmdeploy (>=v0.0.5)。

如果安装之后,问题还存在,那么就把`libnccl.so.2`的路径加入到环境变量 LD_LIBRARY_PATH 中。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh_cn/supported_models/codellama.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

```shell
# 安装 lmdeploy
python3 -m pip install lmdeploy
python3 -m pip install lmdeploy[all]

# 转模型格式
lmdeploy convert codellama /path/of/codellama/model
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_cn/w4a16.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LMDeploy 支持 4bit 权重模型的推理,**对 NVIDIA 显卡的最低要求
在推理之前,请确保安装了 lmdeploy

```shell
pip install lmdeploy
pip install lmdeploy[all]
```

## 4bit 权重模型推理
Expand Down
21 changes: 4 additions & 17 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
accelerate
datasets
fastapi
fire
gradio
mmengine
numpy
pybind11
safetensors
sentencepiece
setuptools
shortuuid
tiktoken
torch
transformers>=4.33.0
tritonclient[all]
uvicorn
-r requirements/build.txt
-r requirements/runtime.txt
-r requirements/lite.txt
-r requirements/serve.txt
2 changes: 2 additions & 0 deletions requirements/build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pybind11
setuptools
2 changes: 2 additions & 0 deletions requirements/lite.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
accelerate
lvhan028 marked this conversation as resolved.
Show resolved Hide resolved
datasets
8 changes: 8 additions & 0 deletions requirements/runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fire
mmengine
numpy
safetensors
sentencepiece
tiktoken
torch
transformers>=4.33.0
5 changes: 5 additions & 0 deletions requirements/serve.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fastapi
gradio
pydantic>2.0.0
shortuuid
uvicorn
2 changes: 2 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage
pytest
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ def gen_packages_items():
'lmdeploy': lmdeploy_package_data,
},
include_package_data=True,
install_requires=parse_requirements('requirements.txt'),
setup_requires=parse_requirements('requirements/build.txt'),
tests_require=parse_requirements('requirements/test.txt'),
install_requires=parse_requirements('requirements/runtime.txt'),
extras_require={
'all': parse_requirements('requirements.txt'),
'lite': parse_requirements('requirements/lite.txt'),
'serve': parse_requirements('requirements/serve.txt')
},
has_ext_modules=check_ext_modules,
classifiers=[
'Programming Language :: Python :: 3.8',
Expand Down
Loading