如何将 vllm 与 pytorch 2.2.2 和 python 3.11 一起使用?

问题描述 投票:0回答:1

标题:如何在 pytorch 2.2.2 和 python 3.11 中使用 vllm?

我正在尝试将 vllm 库与 pytorch 2.2.2 和 python 3.11 一起使用。根据 GitHub issues,vllm 0.4.1 似乎支持 python 3.11。

但是,我在安装 vllm 时遇到了 pytorch 版本不兼容的问题。 github问题提到需要从源代码构建才能使用pytorch 2.2,但pip安装的版本仍然使用较旧的pytorch。

我尝试使用 python 3.11 创建一个新的 conda 环境并安装 vllm:

$ conda create -n vllm_test python=3.11
$ conda activate vllm_test
(vllm_test) $ pip install vllm
...
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
vllm 0.4.1 requires torch==2.1.2, but you have torch 2.2.2 which is incompatible.

我还尝试先安装 pytorch 2.2.2,然后安装 vllm:

(vllm_test) $ pip install torch==2.2.2
(vllm_test) $ pip install vllm
...
Building wheels for collected packages: vllm
  Building wheel for vllm (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for vllm (pyproject.toml) did not run successfully.
  │ exit code: 1

有人可以澄清一下目前哪些版本的 vllm、pytorch 和 python 可以一起工作吗?是否有推荐的干净设置来将 vllm 与最新的 pytorch 2.2.2 和 python 3.11 一起使用?

我尝试创建新的 conda 环境,但仍然遇到版本冲突。任何有关正确安装步骤的指导将不胜感激。谢谢!

参考:https://github.com/vllm-project/vllm/issues/2747

python pytorch nlp huggingface-transformers vllm
1个回答
0
投票

从 vllm 0.4.1 开始不支持 PyTorch 2.2.2。您可以使用自定义 PyTorch 版本从源代码构建 vllm,或者等待 vllm 的下一个版本,如此处所述。

您可以使用 pytorch 2.2.1 安装 vllm 0.4.1,如发行版notes中所述。

我已经通过以下步骤对其进行了测试:

conda create -n vllm_test python=3.11 
conda activate vllm_test
pip install torch==2.2.1
pip install vllm
© www.soinside.com 2019 - 2024. All rights reserved.