升级至 vLLM >= 0.8

最后更新:05/04/2025.

安装

注意:这个版本的 verl+vLLM 0.8+ 支持使用 FSDP 进行训练,并使用 vLLM 进行 rollout(即生成推理的步骤)。

# Create the conda environment
conda create -n verl python==3.10
conda activate verl

# Install verl
git clone https://github.com/volcengine/verl.git
cd verl
pip3 install -e .

# Install the latest stable version of vLLM
pip3 install vllm==0.8.3

# Install flash-attn
pip3 install flash-attn --no-build-isolation

我们为 verl+vLLM 0.8.3 提供了一个预构建的 Docker 镜像。你可以使用以下命令直接拉取:

docker pull hiyouga/verl:ngc-th2.6.0-cu126-vllm0.8.3-flashinfer0.2.2-cxx11abi0

特性

vLLM 0.8+ 在 verl 中默认支持 cuda graph 和 V1 引擎。要启用这些特性,请记得在 bash 脚本中添加以下行:

actor_rollout_ref.rollout.enforce_eager=False \
actor_rollout_ref.rollout.free_cache_engine=True \

同时,如果存在,请移除该环境变量:

备注

当你直接升级到 vllm >= 0.8 时,一些依赖包的版本可能会发生变化。如果你遇到以下问题:

in <module> from torch.multiprocessing.reductions import ForkingPickler ImportError: cannot import name 'ForkingPickler' from 'torch.multiprocessing.reductions' (/opt/conda/lib/python3.11/site-packages/torch/multiprocessing/reductions.py)

你需要使用命令 pip install tensordict==0.6.2 升级 tensordict 到版本 0.6.2。