ubuntu 22.04, RTX3080, cuda 12.1, cudnn 8.9.7,cuda和cudnn的安装参考:https://blog.csdn.net/m0_52111823/article/details/147154526?spm=1001.2014.3001.5501。
-
查看版本对应关系,下载12.1对应的whl包,https://github.com/vllm-project/vllm/releases/download/v0.8.3/vllm-0.8.3+cu121-cp38-abi3-manylinux1_x86_64.whl
-
uv创建基于Python 3.11的虚拟环境,参考https://blog.csdn.net/m0_52111823/article/details/147154513?spm=1001.2014.3001.5502
- 修改
xxx/bin/activate
,提供必要的cuda变量引用。
- 修改
-
开始安装whl包,然后安装
setuptools
包,因为vllm项目默认为没有该包。 -
激活环境,测试命令
python -c "from vllm import LLM, SamplingParams; llm = LLM('facebook/opt-125m'); sampling_params = SamplingParams(temperature=0.8, top_p=0.95); outputs = llm.generate('Hello,', sampling_params); print(outputs[0].outputs[0].text)"