参考官方文档
1.环境依赖
# openEuler 22.03
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Tue_Feb_27_16:19:38_PST_2024
Cuda compilation tools, release 12.4, V12.4.99
Build cuda_12.4.r12.4/compiler.33961263_0
2. python依赖
1. 使用conda管理包环境
python开发建议使用venv进行包管理。
conda create -n jason python=3.10
conda activate jason
建议修改pip的源为国内的源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip config set global.trusted-host mirrors.aliyun.com
2. 下载代码
git clone https://github.com/vllm-project/vllm.git
cd vllm
VLLM_USE_PRECOMPILED=1 pip install --editable .
3. 安装依赖
cd vllm
pip install -r requirements/common.txt
pip install -r requirements/build.txt
pip install -r requirements/cuda.txt # 在gpu环境开发必须装
pip install -r requirements/test.txt # 执行测试用例需要依赖的库
4. 源码编译安装wheel
依赖安装完成后,可以进行源码安装了:
cd vllm
VLLM_USE_PRECOMPILED=1 pip install --editable . -v
如果你没有修改cuda code 或者c++ code的话,使用以上命令就可以了,如果需要更多修改的话,可以使用Full Build.
cd vllm
pip install -e . -v
过程中,可能还会依赖一些其他的包,如果遇到缺包的话,补上之后,再进行尝试。
5. 验证vllm
验证import
python -c "import vllm._C"
验证启动vllm
vllm --version
INFO 06-04 14:41:12 [__init__.py:243] Automatically detected platform cuda.
0.8.5.dev1087+g6d18ed2a2
验证单元测试
python -m pytest tests/plugins_tests/test_scheduler_plugins.py::test_scheduler_plugins_v1 -v
============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.10.16, pytest-8.3.5, pluggy-1.6.0 -- /opt/miniconda3/envs/jason/bin/python
cachedir: .pytest_cache
rootdir: /data/huangjch/vllm-main
configfile: pyproject.toml
plugins: anyio-4.9.0
collected 1 item
tests/plugins_tests/test_scheduler_plugins.py::test_scheduler_plugins_v1 PASSED [100%]
=============================================================================================== 1 passed in 16.08s ===============================================================================================
一些问题
- Git必须要安装,否则编译过程也会出错
- 有可能会漏掉一些包,例如
pip install pytest pandas
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。