README.md 3.78 KB
Newer Older
zhuwenwen's avatar
zhuwenwen committed
1
2
# <div align="center"><strong>vLLM</strong></div>
## 简介
zhuwenwen's avatar
zhuwenwen committed
3
vLLM是一个快速且易于使用的LLM推理和服务库,使用PageAttention高效管理kv内存,Continuous batching传入请求,支持很多Hugging Face模型,如LLaMA & LLaMA-2、Qwen、Chatglm2 & Chatglm3等。
Woosuk Kwon's avatar
Woosuk Kwon committed
4

zhuwenwen's avatar
zhuwenwen committed
5
## 暂不支持的官方功能
gaoqiong's avatar
gaoqiong committed
6
- **量化推理**:目前支持fp16的推理和gptq,awq-int4推理,mralin的权重量化、kv-cache fp8推理方案暂不支持
7
- **模块支持**:目前不支持Sliding window attention
zhuwenwen's avatar
zhuwenwen committed
8
9
10


## 支持模型结构列表
zhuwenwen's avatar
zhuwenwen committed
11
12
13
| 结构 | 模型 | 模型并行 | FP16 |
| :------: | :------: | :------: | :------: |
| LlamaForCausalLM      | LLaMA、LLaMA-2、LLaMA-3、Codellama、deepseek、Yi | Yes | Yes |
zhuwenwen's avatar
zhuwenwen committed
14
| QWenLMHeadModel       | QWen、Qwen-VL                                   | Yes | Yes |
zhuwenwen's avatar
zhuwenwen committed
15
| Qwen2ForCausalLM      | QWen1.5、CodeQwen1.5、QWen2                     | Yes | Yes |
16
| ChatGLMModel          | chatglm2、chatglm3、chatglm4、glm-4v-9b         | Yes | Yes |
zhuwenwen's avatar
zhuwenwen committed
17
| BaiChuanForCausalLM   | Baichuan、Baichuan2                             | Yes | Yes |
zhuwenwen's avatar
zhuwenwen committed
18
19
20
21
22
23
| BloomForCausalLM      | BLOOM                                           | Yes | Yes |
| InternLMForCausalLM   | InternLM                                        | Yes | Yes |
| InternLM2ForCausalLM  | InternLM2                                       | Yes | Yes |
| DeepseekV2ForCausalLM | DeepSeek-V2                                     | Yes | Yes |
| MixtralForCausalLM    | Mixtral-8x7B                                    | Yes | Yes |
| TeleChat12BForCausalLM (#TelechatForCausalLM) | TeleChat-12B            | Yes | Yes |
zhuwenwen's avatar
zhuwenwen committed
24
25


zhuwenwen's avatar
zhuwenwen committed
26
27
28
29
30
31
## 安装
vLLM支持
+ Python 3.8.
+ Python 3.9.
+ Python 3.10.
+ Python 3.11.
32
+ Python 3.12.
Woosuk Kwon's avatar
Woosuk Kwon committed
33

zhuwenwen's avatar
zhuwenwen committed
34
### 使用源码编译方式安装
Woosuk Kwon's avatar
Woosuk Kwon committed
35

zhuwenwen's avatar
zhuwenwen committed
36
37
#### 编译环境准备
提供2种环境准备方式:
Woosuk Kwon's avatar
Woosuk Kwon committed
38

39
1. 基于光源pytorch2.3.0基础镜像环境:镜像下载地址:[https://sourcefind.cn/#/image/dcu/pytorch](https://sourcefind.cn/#/image/dcu/pytorch),根据pytorch2.1.0、python、dtk及系统下载对应的镜像版本。
40

41
2. 基于现有python环境:安装pytorch2.3.0,pytorch whl包下载目录:[https://cancon.hpccube.com:65024/4/main/pytorch](https://cancon.hpccube.com:65024/4/main/pytorch),根据python、dtk版本,下载对应pytorch2.1.0的whl包。安装命令如下:
zhuwenwen's avatar
zhuwenwen committed
42
43
44
45
```shell
pip install torch* (下载的torch的whl包)
pip install setuptools wheel
```
Zhuohan Li's avatar
Zhuohan Li committed
46

zhuwenwen's avatar
zhuwenwen committed
47
48
#### 源码编译安装
```shell
zhuwenwen's avatar
zhuwenwen committed
49
git clone http://developer.hpccube.com/codes/OpenDAS/vllm.git # 根据需要的分支进行切换
Zhuohan Li's avatar
Zhuohan Li committed
50
```
zhuwenwen's avatar
zhuwenwen committed
51
52
53
54
安装依赖:
```shell
pip install -r requirements-rocm.txt
```
zhuwenwen's avatar
zhuwenwen committed
55
56
57
- 提供2种源码编译方式(进入vllm目录):
```
1. 编译whl包并安装
zhuwenwen's avatar
zhuwenwen committed
58
VLLM_INSTALL_PUNICA_KERNELS=1 python setup.py bdist_wheel 
zhuwenwen's avatar
zhuwenwen committed
59
60
cd dist
pip install vllm*
Zhuohan Li's avatar
Zhuohan Li committed
61

zhuwenwen's avatar
zhuwenwen committed
62
2. 源码编译安装
zhuwenwen's avatar
zhuwenwen committed
63
VLLM_INSTALL_PUNICA_KERNELS=1 python3 setup.py install 
zhuwenwen's avatar
zhuwenwen committed
64
```
Zhuohan Li's avatar
Zhuohan Li committed
65

zhuwenwen's avatar
zhuwenwen committed
66
#### 运行基础环境准备
67
1、使用上面基于光源pytorch2.3.0基础镜像环境
zhuwenwen's avatar
zhuwenwen committed
68

69
2、根据pytorch2.3.0、python、dtk及系统下载对应的依赖包:
zhuwenwen's avatar
zhuwenwen committed
70
71
72
- triton:[https://cancon.hpccube.com:65024/4/main/triton](https://cancon.hpccube.com:65024/4/main/triton/)
- xformers:[https://cancon.hpccube.com:65024/4/main/xformers](https://cancon.hpccube.com:65024/4/main/xformers)
- flash_attn: [https://cancon.hpccube.com:65024/4/main/flash_attn](https://cancon.hpccube.com:65024/4/main/flash_attn)
gaoqiong's avatar
gaoqiong committed
73
- lmslim: [https://cancon.hpccube.com:65024/4/main/lmslim](https://cancon.hpccube.com:65024/4/main/lmslim)
zhuwenwen's avatar
zhuwenwen committed
74

zhuwenwen's avatar
zhuwenwen committed
75
76
#### 注意事项
+ 若使用 pip install 下载安装过慢,可添加源:-i https://pypi.tuna.tsinghua.edu.cn/simple/
77

zhuwenwen's avatar
zhuwenwen committed
78
## 验证
79
- python -c "import vllm; print(vllm.\_\_version__)",版本号与官方版本同步,查询该软件的版本号,例如0.6.3.post1;
Woosuk Kwon's avatar
Woosuk Kwon committed
80

zhuwenwen's avatar
zhuwenwen committed
81
82
## Known Issue
-
Woosuk Kwon's avatar
Woosuk Kwon committed
83

zhuwenwen's avatar
zhuwenwen committed
84
85
86
## 参考资料
- [README_ORIGIN](README_ORIGIN.md)
- [https://github.com/vllm-project/vllm](https://github.com/vllm-project/vllm)