由于手上只有4090,所以驱动比较老,如下所示,所以使用的是verl 0.4.1.x的版本(https://github.com/verl-project/verl/tree/v0.4.1.x)
1 2 3 4 5 6 7 8 9 10 11 12 13
| $ nvidia-smi Thu Jan 29 15:55:02 2026 +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 550.67 Driver Version: 550.67 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA GeForce RTX 4090 On | 00000000:00:03.0 Off | Off | | 30% 27C P8 13W / 450W | 1870MiB / 24564MiB | 0% Default | | | | N/A | ...
|
Verl安装
这里使用容器进行安装,使用如下命令拉取容器
1
| docker pull verlai/verl:base-verl0.4-cu124-cudnn9.8-torch2.6-fa2.7.4
|
然后我使用的是vscode,所以可以直接连接进容器中,然后在容器中安装带vllm的verl
最终安装的各版本如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
| root@10-60-189-161:/workspace/verl# pip3 list Package Version Build Editable project location ---------------------------------------- --------------- -------- ------------------------- absl-py 2.1.0 accelerate 1.8.1 aiohappyeyeballs 2.3.5 aiohttp 3.10.1 aiohttp-cors 0.8.1 aiosignal 1.3.1 airportsdata 20250909 annotated-types 0.7.0 antlr4-python3-runtime 4.9.3 anyio 4.4.0 apex 0.1 argon2-cffi 23.1.0 argon2-cffi-bindings 21.2.0 arrow 1.3.0 asciitree 0.3.3 astor 0.8.1 asttokens 2.4.1 astunparse 1.6.3 async-lru 2.0.4 async-timeout 4.0.3 attrs 24.2.0 audioread 3.0.1 av 14.4.0 babel 2.16.0 beautifulsoup4 4.12.3 black 24.8.0 blake3 1.0.8 bleach 6.1.0 blis 0.7.11 blobfile 3.0.0 cachetools 5.4.0 catalogue 2.0.10 certifi 2024.7.4 cffi 1.17.0 cfgv 3.4.0 charset-normalizer 3.3.2 click 8.1.7 cloudpathlib 0.18.1 cloudpickle 3.0.0 cmake 3.30.2 codetiming 1.4.0 colorful 0.5.6 comm 0.2.2 compressed-tensors 0.9.3 confection 0.1.5 contourpy 1.2.1 cuda-bindings 12.9.0 cuda-python 12.5.0 cudf 24.6.0 cugraph 24.6.0 cugraph-dgl 24.6.0 cugraph-equivariant 24.6.0 cugraph-pyg 24.6.0 cugraph-service-client 24.6.0 cugraph-service-server 24.6.0 cuml 24.6.0 cupy-cuda12x 13.2.0 cycler 0.12.1 cymem 2.0.8 Cython 3.0.11 dask 2024.5.1 dask-cuda 24.6.0 dask-cudf 24.6.0 dask-expr 1.1.1 datasets 3.6.0 dbus-python 1.2.18 debugpy 1.8.5 decorator 5.1.1 defusedxml 0.7.1 Deprecated 1.3.1 depyf 0.18.0 dill 0.3.8 diskcache 5.6.3 distlib 0.3.9 distributed 2024.5.1 distributed-ucxx 0.38.0 distro 1.9.0 dm-tree 0.1.8 dnspython 2.7.0 einops 0.8.0 email_validator 2.2.0 entrypoints 0.4 exceptiongroup 1.2.2 execnet 2.1.1 executing 2.0.1 expecttest 0.1.3 fastapi 0.115.14 fastapi-cli 0.0.7 fasteners 0.19 fastjsonschema 2.20.0 fastrlock 0.8.2 filelock 3.20.3 flash_attn 2.7.4.post1 fonttools 4.53.1 fqdn 1.5.1 frozenlist 1.4.1 fsspec 2024.6.1 gast 0.6.0 gguf 0.17.1 gitdb 4.0.12 GitPython 3.1.44 google-api-core 2.25.1 google-auth 2.40.3 googleapis-common-protos 1.70.0 grpcio 1.73.1 h11 0.14.0 hf_transfer 0.1.9 hf-xet 1.1.5 httpcore 1.0.5 httptools 0.6.4 httpx 0.27.0 huggingface-hub 0.33.1 hydra-core 1.3.2 hypothesis 5.35.1 identify 2.6.12 idna 3.7 igraph 0.11.6 importlib_metadata 7.2.1 iniconfig 2.0.0 intel-openmp 2021.4.0 interegular 0.3.3 ipykernel 6.29.5 ipython 8.26.0 isoduration 20.11.0 isort 5.13.2 jedi 0.19.1 Jinja2 3.1.6 jiter 0.12.0 joblib 1.4.2 json5 0.9.25 jsonpointer 3.0.0 jsonschema 4.23.0 jsonschema-specifications 2023.12.1 jupyter_client 8.6.2 jupyter_core 5.7.2 jupyter-events 0.10.0 jupyter-lsp 2.2.5 jupyter_server 2.14.2 jupyter_server_terminals 0.5.3 jupyterlab 4.2.4 jupyterlab_code_formatter 3.0.2 jupyterlab_pygments 0.3.0 jupyterlab_server 2.27.3 jupyterlab-tensorboard-pro 4.0.0 jupytext 1.16.4 kiwisolver 1.4.5 kvikio 24.6.0 langcodes 3.4.0 language_data 1.2.0 lark 1.2.2 lazy_loader 0.4 librmm 24.6.0 librosa 0.10.1 liger_kernel 0.5.10 lightning-thunder 0.2.0.dev0 lightning-utilities 0.11.6 lintrunner 0.12.5 llguidance 0.7.30 llvmlite 0.44.0 lm-format-enforcer 0.10.12 locket 1.0.0 looseversion 1.3.0 lxml 6.0.0 marisa-trie 1.2.0 Markdown 3.7 markdown-it-py 3.0.0 MarkupSafe 2.1.5 mathruler 0.1.0 matplotlib 3.9.2 matplotlib-inline 0.1.7 mdit-py-plugins 0.4.1 mdurl 0.1.2 mistral_common 1.9.0 mistune 3.0.2 mkl 2021.1.1 mkl-devel 2021.1.1 mkl-include 2021.1.1 mock 5.1.0 mpmath 1.3.0 msgpack 1.0.8 msgspec 0.20.0 multidict 6.0.5 multiprocess 0.70.16 murmurhash 1.0.10 mypy-extensions 1.0.0 nbclient 0.10.0 nbconvert 7.16.4 nbformat 5.10.4 nest-asyncio 1.6.0 networkx 3.3 ninja 1.11.1.1 nodeenv 1.9.1 notebook 7.2.1 notebook_shim 0.2.4 numba 0.61.2 numcodecs 0.11.0 numpy 2.2.6 nvfuser 0.2.6a0+1d02b13 nvidia-cublas-cu12 12.4.5.8 nvidia-cuda-cupti-cu12 12.4.127 nvidia-cuda-nvrtc-cu12 12.4.127 nvidia-cuda-runtime-cu12 12.4.127 nvidia-cudnn-cu12 9.1.0.70 nvidia-cudnn-frontend 1.5.2 nvidia-cufft-cu12 11.2.1.3 nvidia-curand-cu12 10.3.5.147 nvidia-cusolver-cu12 11.6.1.9 nvidia-cusparse-cu12 12.3.1.170 nvidia-cusparselt-cu12 0.6.2 nvidia-dali-cuda120 1.40.0 16741769 nvidia-ml-py 12.575.51 nvidia-modelopt 0.15.0 nvidia-nccl-cu12 2.21.5 nvidia-nvimgcodec-cu12 0.3.0.5 nvidia-nvjitlink-cu12 12.4.127 nvidia-nvtx-cu12 12.4.127 nvidia-pyindex 1.0.9 nvtx 0.2.5 nx-cugraph 24.6.0 omegaconf 2.3.0 onnx 1.16.0 openai 2.16.0 opencensus 0.11.4 opencensus-context 0.1.3 opencv-python-headless 4.11.0.86 opentelemetry-api 1.26.0 opentelemetry-exporter-otlp 1.26.0 opentelemetry-exporter-otlp-proto-common 1.26.0 opentelemetry-exporter-otlp-proto-grpc 1.26.0 opentelemetry-exporter-otlp-proto-http 1.26.0 opentelemetry-exporter-prometheus 0.47b0 opentelemetry-proto 1.26.0 opentelemetry-sdk 1.26.0 opentelemetry-semantic-conventions 0.47b0 opentelemetry-semantic-conventions-ai 0.4.13 opt-einsum 3.3.0 optree 0.16.0 orjson 3.10.18 outlines 0.1.11 outlines_core 0.1.26 overrides 7.7.0 packaging 23.2 pandas 2.2.2 pandocfilters 1.5.1 parso 0.8.4 partd 1.4.2 partial-json-parser 0.2.1.1.post7 pathspec 0.12.1 peft 0.15.2 pexpect 4.9.0 pillow 10.4.0 pip 25.1.1 platformdirs 4.2.2 pluggy 1.5.0 ply 3.11 polygraphy 0.49.12 pooch 1.8.2 pre_commit 4.2.0 preshed 3.0.9 prometheus_client 0.20.0 prometheus-fastapi-instrumentator 7.1.0 prompt_toolkit 3.0.47 proto-plus 1.26.1 protobuf 4.25.8 psutil 6.0.0 ptyprocess 0.7.0 PuLP 2.9.0 pure_eval 0.2.3 py-cpuinfo 9.0.0 py-spy 0.4.0 pyarrow 20.0.0 pyasn1 0.6.1 pyasn1_modules 0.4.2 pybind11 2.13.4 pybind11_global 2.13.4 pycocotools 2.0+nv0.8.0 pycountry 24.6.1 pycparser 2.22 pycryptodomex 3.23.0 pydantic 2.11.7 pydantic_core 2.33.2 pydantic-extra-types 2.11.0 pyext 0.7 Pygments 2.18.0 PyGObject 3.42.1 pylatexenc 2.10 pylibcugraph 24.6.0 pylibcugraphops 24.6.0 pylibraft 24.6.0 pylibwholegraph 24.6.0 pynvjitlink 0.2.3 pyparsing 3.1.2 pytest 8.1.1 pytest-flakefinder 1.1.0 pytest-rerunfailures 14.0 pytest-shard 0.1.2 pytest-xdist 3.6.1 python-dateutil 2.9.0.post0 python-dotenv 1.1.1 python-hostlist 1.23.0 python-json-logger 2.0.7 python-multipart 0.0.20 pytz 2023.4 PyYAML 6.0.2 pyzmq 26.1.0 qwen-vl-utils 0.0.11 raft-dask 24.6.0 rapids-dask-dependency 24.6.0a0 ray 2.47.1 referencing 0.35.1 regex 2024.7.24 requests 2.32.3 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rich 13.7.1 rich-toolkit 0.14.7 rmm 24.6.0 rpds-py 0.20.0 rsa 4.9.1 ruff 0.12.1 safetensors 0.5.3 scikit-learn 1.5.1 scipy 1.14.0 Send2Trash 1.8.3 sentencepiece 0.2.0 sentry-sdk 2.32.0 setproctitle 1.3.6 setuptools 70.3.0 shellingham 1.5.4 six 1.16.0 smart-open 7.0.4 smmap 5.0.2 sniffio 1.3.1 sortedcontainers 2.4.0 soundfile 0.12.1 soupsieve 2.6 soxr 0.4.0 spacy 3.7.5 spacy-legacy 3.0.12 spacy-loggers 1.0.5 srsly 2.4.8 stack-data 0.6.3 starlette 0.46.2 sympy 1.13.1 tabulate 0.9.0 tbb 2021.13.1 tblib 3.0.0 tensorboard 2.16.2 tensorboard-data-server 0.7.2 tensordict 0.6.2 tensorrt 10.3.0 terminado 0.18.1 texttable 1.7.0 thinc 8.2.5 threadpoolctl 3.5.0 thriftpy2 0.5.0 tiktoken 0.9.0 tinycss2 1.3.0 tokenizers 0.21.2 tomli 2.0.1 toolz 0.12.1 torch 2.6.0 torchaudio 2.6.0 torchdata 0.11.0 torchvision 0.21.0 tornado 6.2 tqdm 4.66.5 traitlets 5.14.3 transformers 4.53.0 treelite 4.1.2 triton 3.2.0 typer 0.12.4 types-dataclasses 0.6.6 types-python-dateutil 2.9.0.20240316 typing_extensions 4.12.2 typing-inspection 0.4.1 tzdata 2024.1 ucx-py 0.38.0 ucxx 0.38.0 uri-template 1.3.0 urllib3 2.0.7 uvicorn 0.35.0 uvloop 0.21.0 verl 0.4.1 /workspace/verl virtualenv 20.31.2 vllm 0.8.5 wandb 0.20.1 wasabi 1.1.3 watchfiles 1.1.0 wcwidth 0.2.13 weasel 0.4.1 webcolors 24.8.0 webencodings 0.5.1 websocket-client 1.8.0 websockets 15.0.1 Werkzeug 3.0.3 wheel 0.44.0 wrapt 1.16.0 xdoctest 1.0.2 xformers 0.0.29.post2 xgrammar 0.1.18 xxhash 3.5.0 yarl 1.9.4 zarr 2.18.2 zict 3.0.0 zipp 3.19.2
|
Verl示例
- 首先下载数据集到
./data/gsm8k
1
| python3 examples/data_preprocess/gsm8k.py --local_dir ./data/gsm8k
|
- 然后下载模型到本地缓存
/root/.cache/huggingface/hub/models--Qwen--Qwen2.5-0.5B-Instruct/中
1
| python3 -c "import transformers; transformers.pipeline('text-generation', model='Qwen/Qwen2.5-0.5B-Instruct')"
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| PYTHONUNBUFFERED=1 python3 -m verl.trainer.main_ppo \ data.train_files=./data/gsm8k/train.parquet \ data.val_files=./data/gsm8k/test.parquet \ data.train_batch_size=256 \ data.max_prompt_length=512 \ data.max_response_length=256 \ actor_rollout_ref.model.path=Qwen/Qwen2.5-0.5B-Instruct \ actor_rollout_ref.actor.optim.lr=1e-6 \ actor_rollout_ref.actor.ppo_mini_batch_size=64 \ actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=4 \ actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=8 \ actor_rollout_ref.rollout.tensor_model_parallel_size=1 \ actor_rollout_ref.rollout.gpu_memory_utilization=0.4 \ actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=4 \ critic.optim.lr=1e-5 \ critic.model.path=Qwen/Qwen2.5-0.5B-Instruct \ critic.ppo_micro_batch_size_per_gpu=4 \ algorithm.kl_ctrl.kl_coef=0.001 \ trainer.logger=['console'] \ trainer.val_before_train=False \ trainer.default_hdfs_dir=null \ trainer.n_gpus_per_node=1 \ trainer.nnodes=1 \ trainer.save_freq=10 \ trainer.test_freq=10 \ trainer.total_epochs=15 2>&1 | tee verl_demo.log
|
运行结果如下,可以看到确实开始了迭代:

Verl在vscode中的Debug配置
首先需要在vscode中下载Ray Distributed Debugger
然后需要先使用ray start --head来拉起ray集群
然后点击Ray Distributed Debugger插件添加对应ray集群的地址以完成连接
然后需要在需要debug的ray任务的代码中加入breakpoint()关键字

- 然后直接照常运行作业即可,运行到breakpoint时会自动连接到Ray Distributed Debugger,这时点击该debugger按钮即可进行debug


参考资料