OpenRLHF 빠른 시작 — 설치와 첫 RLVR 실행
OpenRLHF 빠른 시작 — 설치와 첫 RLVR 실행
OpenRLHF는 "먼저 실행하고, 이해하고, 최적화하라"는 순서를 권장해요. NVIDIA PyTorch 컨테이너 안에 설치하는 걸 추천 경로로 잡아요.
출처: https://openrlhf.readthedocs.io/en/latest/quick_start.html
설치
docker run --runtime=nvidia -it --rm --shm-size="10g" --cap-add=SYS_ADMIN -v $PWD:/openrlhf nvcr.io/nvidia/pytorch:25.11-py3 bash
# base image에서 vLLM / flash-attn과 충돌하는 패키지 제거
pip uninstall xgboost transformer_engine flash_attn pynvml opencv-python-headless -y
# pip install (하나 선택)
pip install openrlhf # core only
pip install openrlhf[vllm] # + vLLM 0.19.0 (recommended)
pip install openrlhf[vllm_latest] # + vLLM > 0.19.0
pip install openrlhf[vllm,ring,liger] # + ring-flash-attention + Liger
성능상 vLLM 0.19.0+를 권장하고, Muon 옵티마이저를 쓰려면 DeepSpeed ≥ 0.18.2가 필요해요.
첫 실행 (RLVR with Qwen3-4B)
# 1) 헤드 노드에서 ray 시작
ray start --head --node-ip-address 0.0.0.0 --num-gpus 4
# 2) 학습 작업 제출
ray job submit --address="http://127.0.0.1:8265" --runtime-env-json='{"working_dir": "/openrlhf"}' -- python3 -m openrlhf.cli.train_ppo_ray --actor.model_name_or_path Qwen/Qwen3-4B-Thinking-2507 --reward.remote_url examples/python/math_reward_func.py --data.prompt_dataset zhuzilin/dapo-math-17k