Albert711 commited on
Commit
e6f9ec5
·
verified ·
1 Parent(s): dcb30af

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. .github/PULL_REQUEST_TEMPLATE.md +45 -0
  3. .github/dependabot.yml +9 -0
  4. .github/workflows/checkpoint_converter.yml +96 -0
  5. .github/workflows/dataset.yml +59 -0
  6. .github/workflows/e2e_ascend.yml +54 -0
  7. .github/workflows/e2e_dapo.yml +68 -0
  8. .github/workflows/e2e_eval_aime24.yml +68 -0
  9. .github/workflows/e2e_ppo_trainer.yml +299 -0
  10. .github/workflows/e2e_ppo_trainer_megatron.yml +126 -0
  11. .github/workflows/e2e_prime.yml +68 -0
  12. .github/workflows/e2e_sft.yml +90 -0
  13. .github/workflows/e2e_sppo.yml +61 -0
  14. .github/workflows/model.yml +109 -0
  15. .github/workflows/pre-commit-full.yml +30 -0
  16. .github/workflows/pre-commit.yml +34 -0
  17. .github/workflows/ray_cpu_test.yml +48 -0
  18. .github/workflows/ray_gpu_test.yml +52 -0
  19. .github/workflows/sandbox.yml +51 -0
  20. .github/workflows/sanity.yml +54 -0
  21. .github/workflows/scorecard.yml +66 -0
  22. .github/workflows/secrets_scan.yml +22 -0
  23. .github/workflows/sgl.yml +80 -0
  24. .github/workflows/verl_unit_test.yml +56 -0
  25. .github/workflows/verl_unit_test_gpu.yml +47 -0
  26. .github/workflows/vllm.yml +97 -0
  27. .gitignore +141 -0
  28. .hopeignore +19 -0
  29. .pre-commit-config.yaml +8 -0
  30. .readthedocs.yaml +19 -0
  31. LICENSE +202 -0
  32. Notice.txt +1 -0
  33. README.md +203 -0
  34. README_ZH.md +198 -0
  35. deploy_vllm.sh +40 -0
  36. docker/Apptainerfile.rocm +57 -0
  37. docker/Dockerfile.ngc.vllm +47 -0
  38. docker/Dockerfile.ngc.vllm0.8 +75 -0
  39. docker/Dockerfile.ngc.vllm0.8.sagemaker +46 -0
  40. docker/Dockerfile.rocm +55 -0
  41. docker/Dockerfile.sglang +55 -0
  42. docker/Dockerfile.stage1.megatron +20 -0
  43. docker/Dockerfile.stage2.megatron +37 -0
  44. docker/Dockerfile.vemlp.vllm.te +41 -0
  45. docs/Makefile +20 -0
  46. docs/README.md +19 -0
  47. docs/README_vllm0.7.md +73 -0
  48. docs/README_vllm0.8.md +55 -0
  49. docs/_static/js/runllm-widget.js +14 -0
  50. docs/_static/logo.png +0 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ image/SCOPE_Overview.png filter=lfs diff=lfs merge=lfs -text
.github/PULL_REQUEST_TEMPLATE.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Checklist Before Starting
2
+
3
+ - [ ] Search for similar PR(s).
4
+
5
+ ### What does this PR do?
6
+
7
+ > Add one-line overview of what this PR aims to achieve or accomplish.
8
+
9
+ ### High-Level Design
10
+
11
+ > Demonstrate the high-level design if this PR is complex.
12
+
13
+ ### Specific Changes
14
+
15
+ > List the specific changes.
16
+
17
+ ### API
18
+
19
+ > Demonstrate how the API changes if any.
20
+
21
+ ### Usage Example
22
+
23
+ > Provide usage example(s) for easier usage.
24
+
25
+ ```python
26
+ # Add code snippet or script demonstrating how to use this
27
+ ```
28
+
29
+ ### Test
30
+
31
+ > For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluatuion results, etc.
32
+
33
+ ### Additional Info.
34
+
35
+ - **Issue Number**: Fixes issue # or discussion # if any.
36
+ - **Training**: [Note which backend this PR will affect: FSDP, Megatron, both, or none]
37
+ - **Inference**: [Note which backend this PR will affect: vLLM, SGLang, both, or none]
38
+
39
+ ### Checklist Before Submitting
40
+
41
+ - [ ] Read the [Contribute Guide](https://github.com/volcengine/verl?tab=readme-ov-file#contribution-guide).
42
+ - [ ] Apply [pre-commit checks](https://github.com/volcengine/verl?tab=readme-ov-file#code-linting-and-formatting).
43
+ - [ ] Add `[BREAKING]` to the PR title if it breaks any API.
44
+ - [ ] Update the documentation about your changes in the [docs](https://github.com/volcengine/verl/tree/main/docs).
45
+ - [ ] Add CI test(s) if neccessary.
.github/dependabot.yml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ ## Enabled the dependabot to check the dependencies of the project
2
+ ## Dependabot will open pull requests to update dependencies automatically
3
+
4
+ version: 2
5
+ updates:
6
+ - package-ecosystem: pip
7
+ directory: "/"
8
+ schedule:
9
+ interval: weekly
.github/workflows/checkpoint_converter.yml ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: checkpoint_converter
2
+ # latest version: Megatron-LM core_r0.11.0 https://github.com/NVIDIA/Megatron-LM/tree/core_r0.11.0
3
+
4
+ on:
5
+ # Trigger the workflow on push or pull request,
6
+ # but only for the main branch
7
+ push:
8
+ branches:
9
+ - main
10
+ - v0.*
11
+ pull_request:
12
+ branches:
13
+ - main
14
+ - v0.*
15
+ paths:
16
+ - "**/*.py"
17
+ # Entrypoints
18
+ - ".github/workflows/checkpoint_converter.yml"
19
+ - "!examples"
20
+ - "!verl/trainer/main_*.py"
21
+ - "!verl/trainer/fsdp_sft_trainer.py"
22
+ # Recipes
23
+ - "!recipe"
24
+ # FSDP
25
+ - "!verl/workers/**/*dp_*.py"
26
+
27
+
28
+ # Cancel jobs on the same ref if a new one is triggered
29
+ concurrency:
30
+ group: ${{ github.workflow }}-${{ github.ref }}
31
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
32
+
33
+ # Declare permissions just read content.
34
+ permissions:
35
+ contents: read
36
+
37
+ jobs:
38
+ checkpoint_converter:
39
+ runs-on: [L20x8]
40
+ timeout-minutes: 20 # Increase this timeout value as needed
41
+ env:
42
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
43
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
44
+ NO_PROXY: "localhost,127.0.0.1"
45
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
46
+ container:
47
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
48
+ options: --gpus all --shm-size=10g
49
+ steps:
50
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
51
+ with:
52
+ fetch-depth: 0
53
+ - name: Install the current repository
54
+ run: |
55
+ pip3 install -e .[test]
56
+ - name: Running Huggingface to Megatron dist_ckpt converter (Qwen/Qwen2.5-0.5B)
57
+ run: |
58
+ ray stop --force
59
+ python scripts/converter_hf_to_mcore.py --hf_model_path=${HOME}/models/Qwen/Qwen2.5-0.5B --output_path checkpoints/Qwen/Qwen2.5-0.5B
60
+ - name: Running Huggingface to Megatron dist_ckpt converter (deepseek-ai/deepseek-coder-1.3b-instruct)
61
+ run: |
62
+ ray stop --force
63
+ python scripts/converter_hf_to_mcore.py --hf_model_path=${HOME}/models/deepseek-ai/deepseek-coder-1.3b-instruct --output_path checkpoints/deepseek-ai/deepseek-coder-1.3b-instruct
64
+ - name: Clean up
65
+ run: |
66
+ rm -rf checkpoints
67
+ checkpoint_converter_large_moe_models:
68
+ runs-on: [L20x8]
69
+ timeout-minutes: 30 # Increase this timeout value as needed
70
+ env:
71
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
72
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
73
+ NO_PROXY: "localhost,127.0.0.1"
74
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
75
+ HF_ENDPOINT: "https://hf-mirror.com"
76
+ container:
77
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
78
+ options: --gpus all --shm-size=10g
79
+ steps:
80
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
81
+ with:
82
+ fetch-depth: 0
83
+ - name: Install the current repository
84
+ run: |
85
+ pip3 install -e .[test]
86
+ - name: Download Model to Use
87
+ run: |
88
+ huggingface-cli download Qwen/Qwen1.5-MoE-A2.7B-Chat --local-dir ${HOME}/models/Qwen/Qwen1.5-MoE-A2.7B-Chat
89
+ export HF_HUB_OFFLINE=1
90
+ - name: Running Huggingface to Megatron dist_ckpt CPU converter (Qwen/Qwen1.5-MoE-A2.7B-Chat)
91
+ run: |
92
+ ray stop --force
93
+ python scripts/converter_hf_to_mcore.py --hf_model_path=${HOME}/models/Qwen/Qwen1.5-MoE-A2.7B-Chat --output_path checkpoints/Qwen/Qwen1.5-MoE-A2.7B-Chat --use_cpu_initialization
94
+ - name: clean up
95
+ run: |
96
+ rm -rf checkpoints
.github/workflows/dataset.yml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: dataset
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ paths:
14
+ - "verl/utils/**/*.py"
15
+ - .github/workflows/dataset.yml
16
+
17
+ # Cancel jobs on the same ref if a new one is triggered
18
+ concurrency:
19
+ group: ${{ github.workflow }}-${{ github.ref }}
20
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
21
+
22
+ # Declare permissions just read content.
23
+ permissions:
24
+ contents: read
25
+
26
+ jobs:
27
+ ray:
28
+ runs-on: [L20x8]
29
+ timeout-minutes: 10 # Increase this timeout value as needed
30
+ env:
31
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
32
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
33
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
34
+ HF_ENDPOINT: "https://hf-mirror.com"
35
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
36
+ container:
37
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
38
+ options: --gpus all --shm-size=10g
39
+ steps:
40
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41
+ with:
42
+ fetch-depth: 0
43
+ - name: Install the current repository
44
+ run: |
45
+ pip install -e .[test]
46
+ pip install --upgrade "ray>=2.40.0"
47
+ pip install cupy-cuda12x
48
+ - name: Running dataset tests
49
+ run: |
50
+ [ ! -d "$HOME/verl-data" ] && git clone --depth 1 https://github.com/eric-haibin-lin/verl-data ~/verl-data
51
+ python3 examples/data_preprocess/geo3k.py
52
+ pytest -s -x tests/utils/dataset/test_rl_dataset.py
53
+ pytest -s -x tests/utils/dataset/test_sft_dataset.py
54
+ pytest -s -x tests/utils/test_import_utils.py
55
+ # pytest -s -x tests/utils/dataset/test_rm_dataset.py
56
+ - name: Running ray test using cupy (move it to L20 when dockerfile ready)
57
+ run: |
58
+ cd tests/ray_gpu
59
+ pytest -s -x test_rvdz.py
.github/workflows/e2e_ascend.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: e2e_ascend
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ paths:
14
+ - "**/*.py"
15
+ - .github/workflows/e2e_ascend.yml
16
+
17
+ # Cancel jobs on the same ref if a new one is triggered
18
+ concurrency:
19
+ group: ${{ github.workflow }}-${{ github.ref }}
20
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
21
+
22
+ permissions:
23
+ contents: read
24
+
25
+ jobs:
26
+ test:
27
+ name: verl Ascend test (self-host)
28
+ runs-on: [self-hosted, npu-0]
29
+ timeout-minutes: 5 # Increase this timeout value as needed
30
+ container:
31
+ image: quay.io/ascend/cann:8.0.0-910b-ubuntu22.04-py3.10
32
+ volumes:
33
+ - /usr/local/dcmi:/usr/local/dcmi
34
+ - /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
35
+ - /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/
36
+ # Use self-host cache speed up pip and model download
37
+ # - /home/action/actions-runner/_work/cache:/github/home/.cache/
38
+ options: >-
39
+ --device /dev/davinci0
40
+ --device /dev/davinci_manager
41
+ --device /dev/devmm_svm
42
+ --device /dev/hisi_hdc
43
+ --privileged
44
+ --network "host"
45
+ steps:
46
+ - name: Check npu and CANN info
47
+ run: |
48
+ cat /usr/local/Ascend/ascend-toolkit/latest/"$(uname -i)"-linux/ascend_toolkit_install.info
49
+ npu-smi info
50
+ - name: Checkout volcengine/verl repo
51
+ uses: actions/checkout@v4
52
+ - name: Run test
53
+ run: |
54
+ lscpu
.github/workflows/e2e_dapo.yml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: e2e_dapo
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ # Other entrypoints
17
+ - "!examples/**"
18
+ - "!tests/**"
19
+ - "!verl/trainer/main_*.py"
20
+ - "!verl/trainer/fsdp_sft_trainer.py"
21
+ # Other recipes
22
+ - "!recipe/**"
23
+ # Megatron
24
+ - "!verl/workers/**/megatron_*.py"
25
+ # Home
26
+ - "recipe/dapo/src"
27
+ # Entrypoints
28
+ - ".github/workflows/e2e_dapo.yml"
29
+ - "examples/data_preprocess/gsm8k.py"
30
+ - "tests/e2e/run_dapo.sh"
31
+
32
+ # Cancel jobs on the same ref if a new one is triggered
33
+ concurrency:
34
+ group: ${{ github.workflow }}-${{ github.ref }}
35
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
36
+
37
+
38
+ # Declare permissions just read content.
39
+ permissions:
40
+ contents: read
41
+
42
+ jobs:
43
+ e2e_dapo:
44
+ runs-on: [L20x8]
45
+ timeout-minutes: 40 # Increase this timeout value as needed
46
+ env:
47
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
48
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
49
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
50
+ HF_ENDPOINT: "https://hf-mirror.com"
51
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
52
+ container:
53
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
54
+ options: --gpus all --shm-size=10g
55
+ steps:
56
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57
+ with:
58
+ fetch-depth: 0
59
+ - name: Install the current repository
60
+ run: |
61
+ pip3 install --no-deps -e .[test,gpu]
62
+ - name: Prepare GSM8K dataset
63
+ run: |
64
+ python3 examples/data_preprocess/gsm8k.py
65
+ - name: Running the E2E test with the DAPO algorithm
66
+ run: |
67
+ ray stop --force
68
+ bash tests/e2e/run_dapo.sh
.github/workflows/e2e_eval_aime24.yml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: e2e_eval_aime24
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ paths:
14
+ - "**/*.py"
15
+ # Other entrypoints
16
+ - "!examples/**"
17
+ - "!tests/**"
18
+ - "!verl/trainer/main_*.py"
19
+ - "!verl/trainer/fsdp_sft_trainer.py"
20
+ # Other recipes
21
+ - "!recipe/**"
22
+ # Home
23
+ - "recipe/r1"
24
+ - "!recipe/r1/README.md"
25
+ # Entrypoints
26
+ - ".github/workflows/e2e_eval_aime24.yml"
27
+ - "tests/e2e/run_r1_distill_qwen_aime24_eval.sh"
28
+ - "verl/trainer/main_generation.py"
29
+ - "verl/trainer/config/generation.yaml"
30
+
31
+ # Cancel jobs on the same ref if a new one is triggered
32
+ concurrency:
33
+ group: ${{ github.workflow }}-${{ github.ref }}
34
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
35
+
36
+ # Declare permissions just read content.
37
+ permissions:
38
+ contents: read
39
+
40
+ jobs:
41
+ e2e_eval_aime24:
42
+ runs-on: [L20x8]
43
+ timeout-minutes: 40 # Increase this timeout value as needed
44
+ env:
45
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
46
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
47
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
48
+ HF_ENDPOINT: "https://hf-mirror.com"
49
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
50
+ container:
51
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
52
+ options: --gpus all --shm-size=10g
53
+ steps:
54
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
55
+ with:
56
+ fetch-depth: 0
57
+ - name: Install the current repository
58
+ run: |
59
+ pip3 install --no-deps -e .[test,gpu,math]
60
+ pip3 install math-verify
61
+ - name: Prepare aime24 dataset
62
+ run: |
63
+ ray stop --force
64
+ python3 recipe/r1/data_process.py --task aime2024
65
+ - name: Running generation and evaluation in AIME 2024
66
+ run: |
67
+ ray stop --force
68
+ bash tests/e2e/run_r1_distill_qwen_aime24_eval.sh
.github/workflows/e2e_ppo_trainer.yml ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: e2e_ppo_trainer
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ # Other entrypoints
17
+ - "!examples/**"
18
+ - "!tests/**"
19
+ - "!verl/trainer/main_*.py"
20
+ - "!verl/trainer/fsdp_sft_trainer.py"
21
+ # Recipes
22
+ - "!recipe/**"
23
+ # Megatron
24
+ - "!verl/workers/**/megatron_*.py"
25
+ # Entrypoints
26
+ - ".github/workflows/e2e_ppo_trainer.yml"
27
+ - "examples/data_preprocess/gsm8k.py"
28
+ - "examples/data_preprocess/geo3k.py"
29
+ - "tests/e2e/ppo_trainer"
30
+ - "verl/trainer/main_ppo.py"
31
+ - "verl/trainer/config/ppo_trainer.yaml"
32
+
33
+ # Cancel jobs on the same ref if a new one is triggered
34
+ concurrency:
35
+ group: ${{ github.workflow }}-${{ github.ref }}
36
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
37
+
38
+ # Declare permissions just read content.
39
+ permissions:
40
+ contents: read
41
+
42
+ jobs:
43
+ pre_commit_for_ppo:
44
+ runs-on: ubuntu-latest
45
+ strategy:
46
+ matrix:
47
+ python-version: ["3.12"]
48
+ steps:
49
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50
+ - name: Set up Python ${{ matrix.python-version }}
51
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
52
+ with:
53
+ python-version: ${{ matrix.python-version }}
54
+ - name: Set ruff --output-format=github
55
+ run: |
56
+ sed -i 's/--output-format=full/--output-format=github/' .pre-commit-config.yaml
57
+ git add .pre-commit-config.yaml
58
+ - uses: pre-commit/action@v3.0.1
59
+ with:
60
+ extra_args: "" # Overriding default "--all-files"
61
+
62
+ e2e_ppo_trainer_vllm:
63
+ runs-on: [L20x8]
64
+ timeout-minutes: 40 # Increase this timeout value as needed
65
+ env:
66
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
67
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
68
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
69
+ HF_ENDPOINT: "https://hf-mirror.com"
70
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
71
+ container:
72
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
73
+ options: --gpus all --shm-size=10g
74
+ steps:
75
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76
+ with:
77
+ fetch-depth: 0
78
+ - name: Install the current repository
79
+ run: |
80
+ pip3 install --no-deps -e .[test,vllm]
81
+ - name: Prepare GSM8K dataset
82
+ run: |
83
+ ray stop --force
84
+ python3 examples/data_preprocess/gsm8k.py
85
+ # Function RM
86
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using function rm with validation and saving
87
+ run: |
88
+ ray stop --force
89
+ VAL_BEFORE_TRAIN=True TEST_FREQ=1 SAVE_FREQ=1 SAVE_HF_MODEL=True bash tests/e2e/ppo_trainer/run_function_reward.sh
90
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using function rm after resuming
91
+ run: |
92
+ ray stop --force
93
+ RESUME_MODE=auto bash tests/e2e/ppo_trainer/run_function_reward.sh
94
+ - name: Test FSDP checkpoints merging function (Qwen Actor)
95
+ run: |
96
+ exp_name="qwen2.5-0.5b-function-reward-minimal"
97
+ python scripts/model_merger.py --backend fsdp --hf_model_path ~/models/Qwen/Qwen2.5-0.5B --local_dir checkpoints/verl-test/${exp_name}/global_step_1/actor --test --test_hf_dir checkpoints/verl-test/${exp_name}/global_step_1/actor/huggingface
98
+ - name: Running GSM8K E2E without rmpad using function rm
99
+ run: |
100
+ ray stop --force
101
+ RM_PAD=False bash tests/e2e/ppo_trainer/run_function_reward.sh
102
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using function rm (GRPO)
103
+ run: |
104
+ ray stop --force
105
+ ADV_ESTIMATOR=grpo USE_KL=True bash tests/e2e/ppo_trainer/run_function_reward.sh
106
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using function rm (ReMax)
107
+ run: |
108
+ ray stop --force
109
+ ADV_ESTIMATOR=remax USE_KL=True bash tests/e2e/ppo_trainer/run_function_reward.sh
110
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using customized reward function
111
+ run: |
112
+ ray stop --force
113
+ CUSTOM_REWARD_FN=True bash tests/e2e/ppo_trainer/run_function_reward.sh
114
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using function rm with in-reward kl and kl loss
115
+ run: |
116
+ ray stop --force
117
+ USE_KL=True bash tests/e2e/ppo_trainer/run_function_reward.sh
118
+ # Model RM
119
+ - name: Running GRPO GSM8K E2E training tests with FSDP on 8 L20 GPUs (DeepSeek)
120
+ run: |
121
+ ray stop --force
122
+ MODEL_ID=deepseek-ai/deepseek-coder-1.3b-instruct bash tests/e2e/ppo_trainer/run_function_reward.sh
123
+ - name: Running GSM8K E2E with rmpad using model rm
124
+ run: |
125
+ ray stop --force
126
+ bash tests/e2e/ppo_trainer/run_model_reward.sh
127
+ - name: Running GSM8K E2E without rmpad using model rm
128
+ run: |
129
+ ray stop --force
130
+ RM_PAD=False bash tests/e2e/ppo_trainer/run_model_reward.sh
131
+ - name: Running GSM8K E2E with rmpad using model rm and ulysses sp=2
132
+ run: |
133
+ ray stop --force
134
+ SP_SIZE=2 bash tests/e2e/ppo_trainer/run_model_reward.sh
135
+ - name: Running GSM8K E2E with rmpad using model rm and dynamic batch size
136
+ run: |
137
+ ray stop --force
138
+ SEQ_BALANCE=True bash tests/e2e/ppo_trainer/run_model_reward.sh
139
+ - name: Running GSM8K E2E with rmpad using model rm with Liger Kernel enabled
140
+ run: |
141
+ ray stop --force
142
+ LIGER=True bash tests/e2e/ppo_trainer/run_model_reward.sh
143
+
144
+ e2e_ppo_trainer_vllm_vlm:
145
+ runs-on: [L20x8]
146
+ needs: pre_commit_for_ppo
147
+ timeout-minutes: 40 # Increase this timeout value as needed
148
+ env:
149
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
150
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
151
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
152
+ HF_ENDPOINT: "https://hf-mirror.com"
153
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
154
+ container:
155
+ image: hiyouga/verl:ngc-th2.6.0-cu126-vllm0.8.3-flashinfer0.2.2-cxx11abi0
156
+ options: --gpus all --shm-size=50g # Visual dataloader requires large memory
157
+ steps:
158
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
159
+ with:
160
+ fetch-depth: 0
161
+ - name: Install the current repository
162
+ run: |
163
+ pip3 install -e .[test,geo,vllm]
164
+ # Geo3k
165
+ - name: Prepare Geo3k dataset
166
+ run: |
167
+ ray stop --force
168
+ python3 examples/data_preprocess/geo3k.py
169
+ - name: Running Geo3k VLM E2E training tests on 8 L20 GPUs with rmpad using function rm
170
+ run: |
171
+ ray stop --force
172
+ TRAIN_FILES=$HOME/data/geo3k/train.parquet VAL_FILES=$HOME/data/geo3k/test.parquet \
173
+ MAX_PROMPT_LEN=1536 MAX_RESPONSE_LEN=1536 \
174
+ MODEL_ID=Qwen/Qwen2-VL-2B-Instruct \
175
+ ADV_ESTIMATOR=grpo RM_PAD=True USE_KL=True ENABLE_CHUNKED_PREFILL=False \
176
+ bash tests/e2e/ppo_trainer/run_function_reward.sh
177
+
178
+ e2e_ppo_trainer_sglang:
179
+ runs-on: [L20x8]
180
+ needs: pre_commit_for_ppo
181
+ timeout-minutes: 40 # Increase this timeout value as needed
182
+ env:
183
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
184
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
185
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
186
+ HF_ENDPOINT: "https://hf-mirror.com"
187
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
188
+ container:
189
+ image: ocss884/verl-sglang:ngc-th2.6.0-cu126-sglang0.4.6.post1
190
+ options: --gpus all --shm-size=10g
191
+ steps:
192
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
193
+ with:
194
+ fetch-depth: 0
195
+ - name: Install the current repository
196
+ run: |
197
+ pip3 install -e .[test,gpu,sglang] --no-deps
198
+ - name: Prepare gsm8k dataset
199
+ run: |
200
+ ray stop --force
201
+ python3 examples/data_preprocess/gsm8k.py
202
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using function rm and save ckpt
203
+ run: |
204
+ ray stop --force
205
+ ENGINE=sglang bash tests/e2e/ppo_trainer/run_function_reward.sh
206
+
207
+ e2e_ppo_trainer_sglang_async:
208
+ runs-on: [L20x8]
209
+ needs: pre_commit_for_ppo
210
+ timeout-minutes: 40 # Increase this timeout value as needed
211
+ env:
212
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
213
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
214
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
215
+ HF_ENDPOINT: "https://hf-mirror.com"
216
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
217
+ container:
218
+ image: ocss884/verl-sglang:ngc-th2.6.0-cu126-sglang0.4.6.post1
219
+ options: --gpus all --shm-size=10g
220
+ steps:
221
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
222
+ with:
223
+ fetch-depth: 0
224
+ - name: Install the current repository
225
+ run: |
226
+ pip3 install -e .[test,gpu,sglang] --no-deps
227
+ - name: Prepare gsm8k dataset
228
+ run: |
229
+ ray stop --force
230
+ python3 examples/data_preprocess/gsm8k.py
231
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using function rm and save ckpt with sglang async
232
+ run: |
233
+ ray stop --force
234
+ ENGINE=sglang_async bash tests/e2e/ppo_trainer/run_function_reward.sh
235
+
236
+ e2e_ppo_trainer_sglang_async_with_tool:
237
+ runs-on: [L20x8]
238
+ needs: pre_commit_for_ppo
239
+ timeout-minutes: 40 # Increase this timeout value as needed
240
+ env:
241
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
242
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
243
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
244
+ HF_ENDPOINT: "https://hf-mirror.com"
245
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
246
+ container:
247
+ image: ocss884/verl-sglang:ngc-th2.6.0-cu126-sglang0.4.6.post1
248
+ options: --gpus all --shm-size=10g
249
+ steps:
250
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
251
+ with:
252
+ fetch-depth: 0
253
+ - name: Install the current repository
254
+ run: |
255
+ pip3 install -e .[test,gpu,sglang] --no-deps
256
+ - name: Prepare gsm8k dataset with tool
257
+ run: |
258
+ ray stop --force
259
+ python3 examples/data_preprocess/gsm8k_multiturn_w_tool.py --local_dir $HOME/data/gsm8k_verl_sgl_multi_turn_preprocessed
260
+ - name: Running GSM8K with tool E2E training tests on 8 L20 GPUs with rmpad using function rm and save ckpt with sglang async
261
+ run: |
262
+ ray stop --force
263
+ bash tests/e2e/run_gsm8k_fsdp_sgl_multiturn_w_tool.sh
264
+
265
+ e2e_ppo_trainer_sglang_vlm:
266
+ runs-on: [L20x8]
267
+ needs: pre_commit_for_ppo
268
+ timeout-minutes: 40 # Increase this timeout value as needed
269
+ env:
270
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
271
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
272
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
273
+ HF_ENDPOINT: "https://hf-mirror.com"
274
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
275
+ container:
276
+ image: ocss884/verl-sglang:ngc-th2.6.0-cu126-sglang0.4.6.post1
277
+ options: --gpus all --shm-size=50g # Visual dataloader requires large memory
278
+ steps:
279
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
280
+ with:
281
+ fetch-depth: 0
282
+ - name: Install the current repository
283
+ run: |
284
+ pip3 install -e .[test,geo,gpu,sglang]
285
+ # Geo3k
286
+ - name: Prepare Geo3k dataset
287
+ run: |
288
+ ray stop --force
289
+ python3 examples/data_preprocess/geo3k.py
290
+ - name: Running Geo3k VLM E2E training tests on 8 L20 GPUs with rmpad using function rm
291
+ run: |
292
+ ray stop --force
293
+ TRAIN_FILES=$HOME/data/geo3k/train.parquet VAL_FILES=$HOME/data/geo3k/test.parquet \
294
+ MAX_PROMPT_LEN=1536 MAX_RESPONSE_LEN=1536 \
295
+ MODEL_ID=Qwen/Qwen2-VL-2B-Instruct \
296
+ ADV_ESTIMATOR=grpo RM_PAD=True USE_KL=True ENABLE_CHUNKED_PREFILL=False \
297
+ ENGINE=sglang GPU_MEMORY_UTILIZATION=0.6 ACTOR_FSDP_PARAM_OFFLOAD=True \
298
+ ACTOR_FSDP_OPTIMIZER_OFFLOAD=True REF_FSDP_PARAM_OFFLOAD=True \
299
+ bash tests/e2e/ppo_trainer/run_function_reward.sh
.github/workflows/e2e_ppo_trainer_megatron.yml ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: e2e_ppo_trainer_megatron
2
+ # latest version: Megatron-LM core_r0.11.0 https://github.com/NVIDIA/Megatron-LM/tree/core_r0.11.0
3
+
4
+ on:
5
+ # Trigger the workflow on push or pull request,
6
+ # but only for the main branch
7
+ push:
8
+ branches:
9
+ - main
10
+ - v0.*
11
+ pull_request:
12
+ branches:
13
+ - main
14
+ - v0.*
15
+ paths:
16
+ - "**/*.py"
17
+ # Other entrypoints
18
+ - "!examples/**"
19
+ - "!tests/**"
20
+ - "!verl/trainer/main_*.py"
21
+ - "!verl/trainer/fsdp_sft_trainer.py"
22
+ # Recipes
23
+ - "!recipe/**"
24
+ # FSDP
25
+ - "!verl/workers/**/*dp_*.py"
26
+ # Entrypoints
27
+ - ".github/workflows/e2e_ppo_trainer_megatron.yml"
28
+ - "examples/data_preprocess/gsm8k.py"
29
+ - "tests/e2e/run_ppo_trainer_megatron.sh"
30
+ - "verl/trainer/main_ppo.py"
31
+ - "verl/trainer/config/ppo_megatron_trainer.yaml"
32
+
33
+ # Cancel jobs on the same ref if a new one is triggered
34
+ concurrency:
35
+ group: ${{ github.workflow }}-${{ github.ref }}
36
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
37
+
38
+ # Declare permissions just read content.
39
+ permissions:
40
+ contents: read
41
+
42
+ jobs:
43
+ e2e_ppo_trainer_megatron-qwen:
44
+ runs-on: [L20x8]
45
+ timeout-minutes: 30 # Increase this timeout value as needed
46
+ env:
47
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
48
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
49
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
50
+ HF_ENDPOINT: "https://hf-mirror.com"
51
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
52
+ container:
53
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
54
+ options: --gpus all --shm-size=10g
55
+ steps:
56
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57
+ with:
58
+ fetch-depth: 0
59
+ - name: Install the current repository
60
+ run: |
61
+ pip3 install --no-deps -e .[test]
62
+ - name: Prepare GSM8K dataset
63
+ run: |
64
+ python3 examples/data_preprocess/gsm8k.py
65
+ - name: Running GSM8K E2E training tests with 3D parallelism on 8 L20 GPUs with Megatron (Qwen) with validation and saving
66
+ run: |
67
+ ray stop --force
68
+ VAL_BEFORE_TRAIN=True TEST_FREQ=1 SAVE_FREQ=1 bash tests/e2e/run_ppo_trainer_megatron.sh
69
+ - name: Running GSM8K E2E training tests with 3D parallelism on 8 L20 GPUs with Megatron (Qwen) after resuming
70
+ run: |
71
+ ray stop --force
72
+ RESUME_MODE=auto bash tests/e2e/run_ppo_trainer_megatron.sh
73
+ - name: Test Megatron checkpoints merging function (Qwen Actor and Critic)
74
+ run: |
75
+ exp_name="qwen2.5-0.5b-megatron-gsm8k-minimal"
76
+ python scripts/model_merger.py --backend megatron --tie-word-embedding --hf_model_path Qwen/Qwen2.5-0.5B --local_dir checkpoints/verl-test/${exp_name}/global_step_1/actor --test --test_hf_dir checkpoints/verl-test/${exp_name}/global_step_1/actor/huggingface
77
+ python scripts/model_merger.py --backend megatron --is-value-model --hf_model_path Qwen/Qwen2.5-0.5B --local_dir checkpoints/verl-test/${exp_name}/global_step_1/critic --test --test_hf_dir checkpoints/verl-test/${exp_name}/global_step_1/critic/huggingface
78
+ - name: Running GRPO GSM8K E2E training tests with 3D parallelism on 8 L20 GPUs with Megatron (Qwen)
79
+ run: |
80
+ ray stop --force
81
+ ADV_ESTIMATOR=grpo bash tests/e2e/run_ppo_trainer_megatron.sh
82
+ - name: clean up
83
+ run: |
84
+ rm -rf checkpoints
85
+ e2e_ppo_trainer_megatron-deepseek:
86
+ runs-on: [L20x8]
87
+ timeout-minutes: 30 # Increase this timeout value as needed
88
+ env:
89
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
90
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
91
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
92
+ HF_ENDPOINT: "https://hf-mirror.com"
93
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
94
+ container:
95
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
96
+ options: --gpus all --shm-size=10g
97
+ steps:
98
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99
+ with:
100
+ fetch-depth: 0
101
+ - name: Install the current repository
102
+ run: |
103
+ pip3 install --no-deps -e .[test]
104
+ - name: Prepare GSM8K dataset
105
+ run: |
106
+ python3 examples/data_preprocess/gsm8k.py
107
+ - name: Running GSM8K E2E training tests with 3D parallelism on 8 L20 GPUs with Megatron (DeepSeek)
108
+ run: |
109
+ ray stop --force
110
+ SAVE_FREQ=1 MODEL_ID=deepseek-ai/deepseek-coder-1.3b-instruct bash tests/e2e/run_ppo_trainer_megatron.sh
111
+ - name: Running GSM8K E2E training tests with 3D parallelism on 8 L20 GPUs with Megatron (DeepSeek)
112
+ run: |
113
+ ray stop --force
114
+ RESUME_MODE=auto MODEL_ID=deepseek-ai/deepseek-coder-1.3b-instruct bash tests/e2e/run_ppo_trainer_megatron.sh
115
+ - name: Running GRPO GSM8K E2E training tests with 3D parallelism on 8 L20 GPUs with Megatron (Deepseek)
116
+ run: |
117
+ ray stop --force
118
+ ADV_ESTIMATOR=grpo MODEL_ID=deepseek-ai/deepseek-coder-1.3b-instruct bash tests/e2e/run_ppo_trainer_megatron.sh
119
+ - name: Test Megatron checkpoints merging function (DeepSeek Actor and Critic)
120
+ run: |
121
+ exp_name="deepseek-coder-1.3b-instruct-megatron-gsm8k-minimal"
122
+ python scripts/model_merger.py --backend megatron --hf_model_path deepseek-ai/deepseek-coder-1.3b-instruct --local_dir checkpoints/verl-test/${exp_name}/global_step_1/actor --test --test_hf_dir checkpoints/verl-test/${exp_name}/global_step_1/actor/huggingface
123
+ python scripts/model_merger.py --backend megatron --is-value-model --hf_model_path deepseek-ai/deepseek-coder-1.3b-instruct --local_dir checkpoints/verl-test/${exp_name}/global_step_1/critic --test --test_hf_dir checkpoints/verl-test/${exp_name}/global_step_1/critic/huggingface
124
+ - name: clean up
125
+ run: |
126
+ rm -rf checkpoints
.github/workflows/e2e_prime.yml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: e2e_prime
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ # Other entrypoints
17
+ - "!examples/**"
18
+ - "!tests/**"
19
+ - "!verl/trainer/main_*.py"
20
+ - "!verl/trainer/fsdp_sft_trainer.py"
21
+ # Other recipes
22
+ - "!recipe/**"
23
+ # Megatron
24
+ - "!verl/workers/**/megatron_*.py"
25
+ # Home
26
+ - "recipe/prime"
27
+ # Entrypoints
28
+ - ".github/workflows/e2e_prime.yml"
29
+ - "examples/data_preprocess/gsm8k.py"
30
+ - "tests/e2e/run_prime.sh"
31
+
32
+ # Cancel jobs on the same ref if a new one is triggered
33
+ concurrency:
34
+ group: ${{ github.workflow }}-${{ github.ref }}
35
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
36
+
37
+ # Declare permissions just read content.
38
+ permissions:
39
+ contents: read
40
+
41
+ jobs:
42
+ e2e_prime:
43
+ runs-on: [L20x8]
44
+ timeout-minutes: 50 # Increase this timeout value as needed
45
+ env:
46
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
47
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
48
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
49
+ HF_ENDPOINT: "https://hf-mirror.com"
50
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
51
+ container:
52
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
53
+ options: --gpus all --shm-size=10g
54
+ steps:
55
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
56
+ with:
57
+ fetch-depth: 0
58
+ - name: Install the current repository
59
+ run: |
60
+ pip3 install --no-deps -e .[test,gpu]
61
+ - name: Prepare gsm8k dataset
62
+ run: |
63
+ ray stop --force
64
+ python3 examples/data_preprocess/gsm8k.py
65
+ - name: Running GSM8K E2E with prime alg
66
+ run: |
67
+ ray stop --force
68
+ bash tests/e2e/run_prime.sh
.github/workflows/e2e_sft.yml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: e2e_sft
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ # Other entrypoints
17
+ - "!examples/**"
18
+ - "!tests/**"
19
+ - "!verl/trainer/main_*.py"
20
+ - "!verl/trainer/fsdp_sft_trainer.py"
21
+ # Recipes
22
+ - "!recipe/**"
23
+ # Megatron
24
+ - "!verl/workers/**/megatron_*.py"
25
+ # Entrypoints
26
+ - ".github/workflows/e2e_sft.yml"
27
+ - "examples/data_preprocess/gsm8k.py"
28
+ - "tests/e2e/sft"
29
+ - "verl/trainer/fsdp_sft_trainer.py"
30
+ - "verl/trainer/config/sft_trainer.yaml"
31
+
32
+ # Cancel jobs on the same ref if a new one is triggered
33
+ concurrency:
34
+ group: ${{ github.workflow }}-${{ github.ref }}
35
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
36
+
37
+ # Declare permissions just read content.
38
+ permissions:
39
+ contents: read
40
+
41
+ jobs:
42
+ e2e_sft:
43
+ runs-on: [L20x8]
44
+ timeout-minutes: 20 # Increase this timeout value as needed
45
+ env:
46
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
47
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
48
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
49
+ HF_ENDPOINT: "https://hf-mirror.com"
50
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
51
+ container:
52
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
53
+ options: --gpus all --shm-size=10g
54
+ steps:
55
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
56
+ with:
57
+ fetch-depth: 0
58
+ - name: Install the current repository
59
+ run: |
60
+ pip3 install peft
61
+ pip3 install --no-deps -e .[test,gpu]
62
+ - name: Prepare gsm8k dataset
63
+ run: |
64
+ ray stop --force
65
+ python3 examples/data_preprocess/gsm8k.py
66
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with rmpad using function rm
67
+ run: |
68
+ ray stop --force
69
+ bash tests/e2e/sft/run_sft.sh
70
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs w/o rmpad using function rm
71
+ run: |
72
+ ray stop --force
73
+ RM_PAD=False bash tests/e2e/sft/run_sft.sh
74
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with sequence parallism
75
+ run: |
76
+ ray stop --force
77
+ SP_SIZE=2 bash tests/e2e/sft/run_sft.sh
78
+ - name: Check loss difference between sequence parallel vs. default implementation
79
+ run: |
80
+ ray stop --force
81
+ ENTRYPOINT="tests/e2e/sft/test_sp_loss_match.py" SP_SIZE=2 bash tests/e2e/sft/run_sft.sh
82
+ - name: Running GSM8K E2E training tests on 8 L20 GPUs with sequence parallism and liger
83
+ run: |
84
+ ray stop --force
85
+ SP_SIZE=2 LIGER=True bash tests/e2e/sft/run_sft.sh
86
+ - name: Running GSM8K E2E training tests with LoRA
87
+ run: |
88
+ ray stop --force
89
+ LORA_RANK=32 bash tests/e2e/sft/run_sft.sh
90
+ # TODO: multiturn
.github/workflows/e2e_sppo.yml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: e2e_sppo
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ # Home
17
+ - "recipe/sppo"
18
+ # Entrypoints
19
+ - ".github/workflows/e2e_sppo.yml"
20
+ - "examples/data_preprocess/gsm8k.py"
21
+ - "tests/e2e/run_sppo.sh"
22
+ - "!examples"
23
+ - "!verl/trainer/main_*.py"
24
+ - "!verl/trainer/fsdp_sft_trainer.py"
25
+ # Megatron
26
+ - "!verl/workers/**/megatron_*.py"
27
+
28
+ # Declare permissions just read content.
29
+ permissions:
30
+ contents: read
31
+
32
+ jobs:
33
+ e2e_sppo:
34
+ runs-on: [L20x8]
35
+ timeout-minutes: 40 # Increase this timeout value as needed
36
+ env:
37
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
38
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
39
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
40
+ HF_ENDPOINT: "https://hf-mirror.com"
41
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
42
+ container:
43
+ image: ocss884/verl-sglang:ngc-th2.6.0-cu126-sglang0.4.5.post3
44
+ options: --gpus all --shm-size=10g
45
+ steps:
46
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47
+ with:
48
+ fetch-depth: 0
49
+ - name: Install the current repository
50
+ run: |
51
+ pip3 install -e .[test,gpu,sglang] --no-deps
52
+ - name: Prepare MATH dataset
53
+ run: |
54
+ python3 examples/data_preprocess/math_dataset.py --local_dir ./data/math
55
+ - name: Prepare Model checkpoint
56
+ run: |
57
+ huggingface-cli download Qwen/Qwen2.5-0.5B-Instruct --local-dir ./models/Qwen2.5-0.5B-Instruct
58
+ - name: Running the E2E test with the SPPO algorithm
59
+ run: |
60
+ ray stop --force
61
+ bash tests/e2e/run_sppo.sh
.github/workflows/model.yml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: model_rmpad
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "verl/**/*.py"
16
+ # Entrypoints
17
+ - ".github/workflows/model.yml"
18
+ - "tests/utils/checkpoint/test_fsdp_ckpt.py"
19
+ - "tests/models/test_transformers_ulysses.py"
20
+ - "tests/distributed/run_all.sh"
21
+
22
+ # Declare permissions just read content.
23
+ permissions:
24
+ contents: read
25
+
26
+ jobs:
27
+ model_rmpad:
28
+ runs-on: [L20x8]
29
+ timeout-minutes: 20 # Increase this timeout value as needed
30
+ env:
31
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
32
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
33
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
34
+ HF_ENDPOINT: "https://hf-mirror.com"
35
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
36
+ container:
37
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
38
+ options: --gpus all --shm-size=10g
39
+ steps:
40
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41
+ with:
42
+ fetch-depth: 0
43
+ - name: Install the current repository and upgrade to latest transformers/flash_attn
44
+ run: |
45
+ pip3 install --no-deps -e .[test]
46
+ pip3 install --upgrade transformers
47
+ - name: Running rmpad model tests on 8 L20 GPUs + flash_attn 2.5.8
48
+ run: |
49
+ pytest -s tests/models/test_transformer.py
50
+ - name: Running rmpad model tests on 8 L20 GPUs + latest flash_attn
51
+ run: |
52
+ pip3 install --upgrade flash_attn --no-build-isolation
53
+ pytest -s tests/models/test_transformer.py
54
+ - name: Running FSDP rmpad model tests on 8 L20 GPUs + latest flash_attn
55
+ run: |
56
+ STRATEGY=fsdp torchrun --nproc_per_node=8 tests/utils/checkpoint/test_fsdp_ckpt.py
57
+ - name: Running transformers ulysses tests on 8 L20 GPUs + latest transformers
58
+ run: |
59
+ torchrun --nproc_per_node=8 -m pytest tests/models/test_transformers_ulysses.py
60
+ - name: Running transformers ulysses tests on 8 L20 GPUs + transformers 4.49.0
61
+ run: |
62
+ pip3 install transformers==4.49.0
63
+ torchrun --nproc_per_node=8 -m pytest tests/models/test_transformers_ulysses.py
64
+ - name: Running transformers ulysses tests on 8 L20 GPUs + transformers 4.48.0
65
+ run: |
66
+ pip3 install transformers==4.48.0
67
+ torchrun --nproc_per_node=8 -m pytest tests/models/test_transformers_ulysses.py
68
+ - name: Running transformers ulysses tests on 8 L20 GPUs + transformers 4.47.0
69
+ run: |
70
+ pip3 install transformers==4.47.0
71
+ torchrun --nproc_per_node=8 -m pytest tests/models/test_transformers_ulysses.py
72
+ - name: Running transformers ulysses tests on 8 L20 GPUs + transformers 4.46.0
73
+ run: |
74
+ pip3 install transformers==4.46.0
75
+ torchrun --nproc_per_node=8 -m pytest tests/models/test_transformers_ulysses.py
76
+ - name: Running transformers ulysses tests on 8 L20 GPUs + transformers 4.45.0
77
+ run: |
78
+ pip3 install transformers==4.45.0
79
+ torchrun --nproc_per_node=8 -m pytest tests/models/test_transformers_ulysses.py
80
+ - name: Run distributed test
81
+ run: |
82
+ bash tests/distributed/run_all.sh
83
+
84
+ # TODO: Move this back to model_rmpad once FSDP2 is stable.
85
+ # NOTE: List as an independent job to make rerun easier.
86
+ model_rmpad_fsdp2_unstable:
87
+ runs-on: [L20x8]
88
+ timeout-minutes: 20 # Increase this timeout value as needed
89
+ env:
90
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
91
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
92
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
93
+ HF_ENDPOINT: "https://hf-mirror.com"
94
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
95
+ container:
96
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
97
+ options: --gpus all --shm-size=10g
98
+ steps:
99
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
100
+ with:
101
+ fetch-depth: 0
102
+ - name: Install the current repository and upgrade to latest transformers/flash_attn
103
+ run: |
104
+ pip3 install --no-deps -e .[test]
105
+ pip3 install --upgrade transformers
106
+ - name: Running FSDP2 rmpad model tests on 8 L20 GPUs + latest flash_attn
107
+ run: |
108
+ pip3 install --upgrade flash_attn --no-build-isolation
109
+ STRATEGY=fsdp2 torchrun --nproc_per_node=8 tests/utils/checkpoint/test_fsdp_ckpt.py
.github/workflows/pre-commit-full.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: pre-commit-full
2
+
3
+ # Run weekly on Sunday at 00:00 UTC
4
+ on:
5
+ schedule:
6
+ - cron: "0 0 * * 0"
7
+ # Allow manual triggering
8
+ workflow_dispatch:
9
+
10
+ # Declare permissions just read content.
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ pre-commit-full:
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ python-version: ["3.12"]
20
+ steps:
21
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+ - name: Set ruff --output-format=github
27
+ run: |
28
+ sed -i 's/--output-format=full/--output-format=github/' .pre-commit-config.yaml
29
+ git add .pre-commit-config.yaml
30
+ - uses: pre-commit/action@v3.0.1
.github/workflows/pre-commit.yml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # c.f. https://github.com/pre-commit/action?tab=readme-ov-file#using-this-action
2
+ name: pre-commit
3
+
4
+ # No need to avoid / cancel lightweight pre-commit jobs
5
+ on:
6
+ pull_request:
7
+ push:
8
+ branches:
9
+ - main
10
+ - v0.*
11
+
12
+ # Declare permissions just read content.
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ pre-commit:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ python-version: ["3.12"]
22
+ steps:
23
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24
+ - name: Set up Python ${{ matrix.python-version }}
25
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+ - name: Set ruff --output-format=github
29
+ run: |
30
+ sed -i 's/--output-format=full/--output-format=github/' .pre-commit-config.yaml
31
+ git add .pre-commit-config.yaml
32
+ - uses: pre-commit/action@v3.0.1
33
+ with:
34
+ extra_args: "" # Overriding default "--all-files"
.github/workflows/ray_cpu_test.yml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ray_cpu
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "verl/single_controller/*.py"
16
+ - .github/workflows/ray_cpu_test.yml
17
+ - "!recipe/**/*.py"
18
+
19
+ # Cancel jobs on the same ref if a new one is triggered
20
+ concurrency:
21
+ group: ${{ github.workflow }}-${{ github.ref }}
22
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
23
+
24
+ # Declare permissions just read content.
25
+ permissions:
26
+ contents: read
27
+
28
+ jobs:
29
+ ray_cpu:
30
+ runs-on: ubuntu-latest
31
+ timeout-minutes: 10 # Increase this timeout value as needed
32
+ strategy:
33
+ matrix:
34
+ python-version: ["3.10"]
35
+ steps:
36
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37
+ - name: Set up Python ${{ matrix.python-version }}
38
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
39
+ with:
40
+ python-version: ${{ matrix.python-version }}
41
+ - name: Install the current repository
42
+ run: |
43
+ pip install -e .[test]
44
+ pip install --upgrade "ray>=2.40.0"
45
+ - name: Running ray tests that can be tested on CPU machines
46
+ run: |
47
+ cd tests/ray_cpu
48
+ pytest -s -x --ignore=test_check_worker_alive.py .
.github/workflows/ray_gpu_test.yml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ray_gpu
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "verl/single_controller/*.py"
16
+ - .github/workflows/ray_gpu_test.yml
17
+ - "!recipe/**/*.py"
18
+
19
+ # Cancel jobs on the same ref if a new one is triggered
20
+ concurrency:
21
+ group: ${{ github.workflow }}-${{ github.ref }}
22
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
23
+
24
+ # Declare permissions just read content.
25
+ permissions:
26
+ contents: read
27
+
28
+ jobs:
29
+ ray_gpu:
30
+ runs-on: [L20x8]
31
+ timeout-minutes: 10 # Increase this timeout value as needed
32
+ env:
33
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
34
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
35
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
36
+ HF_ENDPOINT: "https://hf-mirror.com"
37
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
38
+ container:
39
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
40
+ options: --gpus all --shm-size=10g
41
+ steps:
42
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
43
+ with:
44
+ fetch-depth: 0
45
+ - name: Install the current repository
46
+ run: |
47
+ pip install -e .[test]
48
+ pip install --upgrade "ray>=2.40.0"
49
+ - name: Running ray tests that need 8 GPUs
50
+ run: |
51
+ cd tests/ray_gpu
52
+ pytest -s -x --ignore=test_rvdz.py .
.github/workflows/sandbox.yml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: sandbox
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ - .github/workflows/sandbox.yml
17
+
18
+ # Cancel jobs on the same ref if a new one is triggered
19
+ concurrency:
20
+ group: ${{ github.workflow }}-${{ github.ref }}
21
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
22
+
23
+ # Declare permissions just read content.
24
+ permissions:
25
+ contents: read
26
+
27
+ jobs:
28
+ sandbox:
29
+ runs-on: [L20x8]
30
+ timeout-minutes: 10 # Increase this timeout value as needed
31
+ env:
32
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
33
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
34
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
35
+ HF_ENDPOINT: "https://hf-mirror.com"
36
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
37
+ container:
38
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
39
+ options: --gpus all --shm-size=10g
40
+ steps:
41
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42
+ with:
43
+ fetch-depth: 0
44
+ - name: Install the current repository
45
+ run: |
46
+ pip3 install -e .[test,prime]
47
+ pip3 install vllm==0.5.4
48
+ - name: Running sandbox tests on 8 L20 GPUs
49
+ run: |
50
+ cd tests/sandbox
51
+ pytest -s -x .
.github/workflows/sanity.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: sanity
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ - .github/workflows/sanity.yml
17
+
18
+ # Cancel jobs on the same ref if a new one is triggered
19
+ concurrency:
20
+ group: ${{ github.workflow }}-${{ github.ref }}
21
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
22
+
23
+ # Declare permissions just read content.
24
+ permissions:
25
+ contents: read
26
+
27
+ jobs:
28
+ sanity:
29
+ runs-on: ubuntu-latest
30
+ timeout-minutes: 5 # Increase this timeout value as needed
31
+ strategy:
32
+ matrix:
33
+ python-version: ["3.10"]
34
+ steps:
35
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36
+ - name: Set up Python ${{ matrix.python-version }}
37
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
38
+ with:
39
+ python-version: ${{ matrix.python-version }}
40
+ - name: Install the current repository
41
+ run: |
42
+ pip install -e .[test]
43
+ - name: Run sanity test
44
+ run: |
45
+ pytest -s -x tests/sanity
46
+ - name: Run license test
47
+ run: |
48
+ python3 tests/sanity/check_license.py --directory .
49
+ - name: Assert naming convention
50
+ run: |
51
+ if grep -rIn --exclude-dir=.git --exclude-dir=.github --exclude-dir=venv --exclude-dir=__pycache__ 'veRL' .; then
52
+ echo "Please use verl instead of veRL in the codebase"
53
+ exit 1
54
+ fi
.github/workflows/scorecard.yml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This workflow uses actions that are not certified by GitHub. They are provided
2
+ # by a third-party and are governed by separate terms of service, privacy
3
+ # policy, and support documentation.
4
+
5
+ name: Scorecard supply-chain security
6
+ on:
7
+ # For Branch-Protection check. Only the default branch is supported. See
8
+ # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9
+ branch_protection_rule:
10
+ # To guarantee Maintained check is occasionally updated. See
11
+ # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12
+ schedule:
13
+ - cron: "27 7 * * 1"
14
+ push:
15
+ branches:
16
+ - main
17
+ - v0.*
18
+
19
+ # Declare default permissions as read only.
20
+ permissions: read-all
21
+
22
+ jobs:
23
+ analysis:
24
+ name: Scorecard analysis
25
+ runs-on: ubuntu-latest
26
+ permissions:
27
+ # Needed to upload the results to code-scanning dashboard.
28
+ security-events: write
29
+ # Needed to publish results and get a badge (see publish_results below).
30
+ id-token: write
31
+ # Uncomment the permissions below if installing in a private repository.
32
+ # contents: read
33
+ # actions: read
34
+
35
+ steps:
36
+ - name: "Checkout code"
37
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
38
+ with:
39
+ persist-credentials: false
40
+
41
+ - name: "Run analysis"
42
+ uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
43
+ with:
44
+ results_file: results.sarif
45
+ results_format: sarif
46
+ # (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
47
+ # - you want to enable the Branch-Protection check on a *public* repository, or
48
+ # - you are installing Scorecard on a *private* repository
49
+ # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
50
+ # repo_token: ${{ secrets.SCORECARD_TOKEN }}
51
+
52
+ # Public repositories:
53
+ # - Publish results to OpenSSF REST API for easy access by consumers
54
+ # - Allows the repository to include the Scorecard badge.
55
+ # - See https://github.com/ossf/scorecard-action#publishing-results.
56
+ # For private repositories:
57
+ # - `publish_results` will always be set to `false`, regardless
58
+ # of the value entered here.
59
+ publish_results: true
60
+
61
+ # Upload the results to GitHub's code scanning dashboard (optional).
62
+ # Commenting out will disable upload of results to your repo's Code Scanning dashboard
63
+ - name: "Upload to code-scanning"
64
+ uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 #v3.28.9
65
+ with:
66
+ sarif_file: results.sarif
.github/workflows/secrets_scan.yml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ on:
2
+ push:
3
+ branches:
4
+ - main
5
+ - v0.*
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
17
+ with:
18
+ fetch-depth: 0
19
+ - name: Secret Scanning
20
+ uses: trufflesecurity/trufflehog@7dc056a193116ba8d82154bf0549381c8fb8545c # v3.88.14
21
+ with:
22
+ extra_args: --results=verified,unknown
.github/workflows/sgl.yml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: sgl
2
+
3
+ on:
4
+ workflow_dispatch: # Manual
5
+ # Trigger the workflow on push or pull request,
6
+ # but only for the main branch
7
+ push:
8
+ branches:
9
+ - main
10
+ - v0.2.x
11
+ paths:
12
+ - "**/*.py"
13
+ - .github/workflows/vllm.yml
14
+ pull_request:
15
+ branches:
16
+ - main
17
+ - v0.2.x
18
+ paths:
19
+ - "**/*.py"
20
+ # Other entrypoints
21
+ - "!examples/**"
22
+ - "!tests/**"
23
+ - "!verl/trainer/main_*.py"
24
+ - "!verl/trainer/fsdp_sft_trainer.py"
25
+ # FSDP
26
+ - "!verl/workers/**/*dp_*.py"
27
+ # Megatron
28
+ - "!verl/workers/**/megatron_*.py"
29
+ # vLLM
30
+ - "!**/*vllm*"
31
+ # Recipes
32
+ - "!recipe/**"
33
+ # Entrypoints
34
+ - ".github/workflows/sgl.yml"
35
+ - "tests/rollout/*sglang*"
36
+ - "tests/rollout/async_rollout_utils.py"
37
+
38
+ # Cancel jobs on the same ref if a new one is triggered
39
+ concurrency:
40
+ group: ${{ github.workflow }}-${{ github.ref }}
41
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
42
+
43
+ # Declare permissions just read content.
44
+ permissions:
45
+ contents: read
46
+
47
+ jobs:
48
+ sgl:
49
+ runs-on: [L20x8]
50
+ timeout-minutes: 20 # Increase this timeout value as needed
51
+ env:
52
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
53
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
54
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
55
+ HF_ENDPOINT: "https://hf-mirror.com"
56
+ HF_HUB_ENABLE_HF_TRANSFER: 1
57
+ SGL_DISABLE_TP_MEMORY_INBALANCE_CHECK: "True"
58
+ container:
59
+ image: ocss884/verl-sglang:ngc-th2.6.0-cu126-sglang0.4.6.post1
60
+ options: --gpus all --shm-size=10g
61
+ steps:
62
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
63
+ with:
64
+ fetch-depth: 0
65
+ - name: Install the current repository
66
+ run: |
67
+ pip3 install hf_transfer
68
+ pip3 install -e .[test,gpu,sglang] --no-deps
69
+ - name: Test the latest SGLang
70
+ run: |
71
+ cd tests/workers/rollout
72
+ torchrun --nnodes=1 --nproc_per_node=4 $(which pytest) -s test_sglang_spmd.py
73
+ - name: Test the latest SGLang async
74
+ run: |
75
+ cd tests/workers/rollout
76
+ torchrun --nnodes=1 --nproc_per_node=2 $(which pytest) -s test_sglang_async_spmd.py
77
+ - name: Test the latest SGLang Rollout async with tool
78
+ run: |
79
+ cd tests/workers/rollout
80
+ torchrun --nnodes=1 --nproc_per_node=2 $(which pytest) -s test_sglang_async_rollout_w_tools.py
.github/workflows/verl_unit_test.yml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: verl_unit_test
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ - .github/workflows/verl_unit_test.yml
17
+ - "!recipe/**/*.py"
18
+
19
+ # Cancel jobs on the same ref if a new one is triggered
20
+ concurrency:
21
+ group: ${{ github.workflow }}-${{ github.ref }}
22
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
23
+
24
+ # Declare permissions just read content.
25
+ permissions:
26
+ contents: read
27
+
28
+ jobs:
29
+ verl_unit_test:
30
+ runs-on: ubuntu-latest
31
+ timeout-minutes: 10 # Increase this timeout value as needed
32
+ strategy:
33
+ matrix:
34
+ python-version: ["3.10"]
35
+ steps:
36
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37
+ - name: Set up Python ${{ matrix.python-version }}
38
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
39
+ with:
40
+ python-version: ${{ matrix.python-version }}
41
+ - name: Install the current repository
42
+ run: |
43
+ pip install -e .[test]
44
+ - name: Running test protocol.py
45
+ run: |
46
+ cd tests
47
+ pytest -s -x test_protocol.py
48
+ - name: running utils tests
49
+ run: |
50
+ cd tests/utils
51
+ pytest -s -x --ignore=dataset/ --ignore=checkpoint/ --ignore=test_flops_counter.py --ignore=test_torch_functional.py .
52
+ cd -
53
+ - name: Running trainer tests
54
+ run: |
55
+ cd tests/trainer
56
+ pytest -s -x .
.github/workflows/verl_unit_test_gpu.yml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: verl_unit_test_gpu
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ - .github/workflows/verl_unit_test_gpu.yml
17
+ - "!recipe/**/*.py"
18
+
19
+ # Cancel jobs on the same ref if a new one is triggered
20
+ concurrency:
21
+ group: ${{ github.workflow }}-${{ github.ref }}
22
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
23
+
24
+ # Declare permissions just read content.
25
+ permissions:
26
+ contents: read
27
+
28
+ jobs:
29
+ verl_unit_test_gpu:
30
+ runs-on: [L20x8]
31
+ timeout-minutes: 20 # Increase this timeout value as needed
32
+ container:
33
+ image: whatcanyousee/verl:ngc-cu124-vllm0.8.3-sglang0.4.5-mcore0.12.0-te2.2
34
+ options: --gpus all --shm-size=10g
35
+ steps:
36
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37
+ - name: Set up Python ${{ matrix.python-version }}
38
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
39
+ with:
40
+ python-version: ${{ matrix.python-version }}
41
+ - name: Install the current repository
42
+ run: |
43
+ pip install -e .[test]
44
+ - name: Running utils tests
45
+ run: |
46
+ cd tests/verl/utils
47
+ pytest -s -x test_torch_functional.py
.github/workflows/vllm.yml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: vllm
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the main branch
6
+ push:
7
+ branches:
8
+ - main
9
+ - v0.*
10
+ pull_request:
11
+ branches:
12
+ - main
13
+ - v0.*
14
+ paths:
15
+ - "**/*.py"
16
+ # Other entrypoints
17
+ - "!examples/**"
18
+ - "!tests/**"
19
+ - "!verl/trainer/main_*.py"
20
+ - "!verl/trainer/fsdp_sft_trainer.py"
21
+ # Recipes
22
+ - "!recipe/**"
23
+ # FSDP
24
+ - "!verl/workers/**/*dp_*.py"
25
+ # Megatron
26
+ - "!verl/workers/**/megatron_*.py"
27
+ # SGLang
28
+ - "!**/*sglang*"
29
+ # Entrypoints
30
+ - ".github/workflows/vllm.yml"
31
+ - "tests/e2e/generation"
32
+ - "tests/rollout"
33
+ - "verl/trainer/main_generation.py"
34
+ - "verl/trainer/config/generation.yaml"
35
+
36
+ # Cancel jobs on the same ref if a new one is triggered
37
+ concurrency:
38
+ group: ${{ github.workflow }}-${{ github.ref }}
39
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
40
+
41
+ # Declare permissions just read content.
42
+ permissions:
43
+ contents: read
44
+
45
+ jobs:
46
+ vllm:
47
+ runs-on: [L20x8]
48
+ timeout-minutes: 60 # Increase this timeout value as needed
49
+ env:
50
+ HTTP_PROXY: ${{ secrets.PROXY_HTTP }}
51
+ HTTPS_PROXY: ${{ secrets.PROXY_HTTPS }}
52
+ NO_PROXY: "localhost,127.0.0.1,hf-mirror.com"
53
+ HF_ENDPOINT: "https://hf-mirror.com"
54
+ HF_HUB_ENABLE_HF_TRANSFER: "0" # This is more stable
55
+ container:
56
+ image: whatcanyousee/verl:vemlp-th2.4.0-cu124-vllm0.6.3-ray2.10-te2.0-megatron0.11.0-v0.0.6
57
+ options: --gpus all --shm-size=10g
58
+ steps:
59
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60
+ with:
61
+ fetch-depth: 0
62
+ - name: Install the current repository
63
+ run: |
64
+ pip3 install -e .[test]
65
+ pip3 install vllm==0.5.4
66
+ - name: Download Model to Use
67
+ run: |
68
+ huggingface-cli download Qwen/Qwen2.5-0.5B-Instruct
69
+ huggingface-cli download 'Qwen/Qwen2-7B-Instruct'
70
+ huggingface-cli download 'deepseek-ai/deepseek-llm-7b-chat'
71
+ export HF_HUB_OFFLINE=1
72
+ # Disable requests to avoid network errors
73
+ - name: Running vllm tests on 8 L20 GPUs
74
+ run: |
75
+ cd tests/workers/rollout
76
+ torchrun --standalone --nnodes=1 --nproc_per_node=8 $(which pytest) -s test_vllm_hf_loader.py
77
+ - name: Test the latest vLLM
78
+ run: |
79
+ pip3 install --upgrade vllm==0.7.3
80
+ cd tests/workers/rollout
81
+ torchrun --standalone --nnodes=1 --nproc_per_node=4 $(which pytest) -s test_vllm_spmd.py
82
+ - name: Run Qwen 0.5B generation test
83
+ run: |
84
+ cd tests/e2e/generation
85
+ export OUTPUT_PATH="${HOME}/data/gen/qwen_05_gen_test.parquet"
86
+ MODEL_ID=Qwen/Qwen2.5-0.5B-Instruct NGPUS_PER_NODE=4 GEN_TP=2 bash ./run_gen_qwen05.sh
87
+ rm -rf "${OUTPUT_PATH}"
88
+ - name: Run Qwen 0.5B generation test when world_size == 1
89
+ run: |
90
+ cd tests/e2e/generation
91
+ export OUTPUT_PATH="${HOME}/data/gen/qwen_05_gen_test.parquet"
92
+ MODEL_ID=Qwen/Qwen2.5-0.5B-Instruct NGPUS_PER_NODE=1 GEN_TP=1 bash ./run_gen_qwen05.sh
93
+ rm -rf "${OUTPUT_PATH}"
94
+ - name: Running multi-turn rollout tests on 8 L20 GPUs
95
+ run: |
96
+ pip3 install --upgrade vllm==0.8.3 tensordict==0.7.2
97
+ python3 tests/workers/rollout/test_vllm_multi_turn.py
.gitignore ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ **/*.pt
3
+ **/checkpoints
4
+ **/wget-log
5
+ **/_build/
6
+ **/*.ckpt
7
+ **/outputs
8
+ **/*.tar.gz
9
+ **/playground
10
+ **/wandb
11
+
12
+ # Byte-compiled / optimized / DLL files
13
+ __pycache__/
14
+ *.py[cod]
15
+ *$py.class
16
+ dataset/*
17
+ tensorflow/my_graph/*
18
+ .idea/
19
+ # C extensions
20
+ *.so
21
+
22
+ # Distribution / packaging
23
+ .Python
24
+ env/
25
+ build/
26
+ develop-eggs/
27
+ dist/
28
+ downloads/
29
+ eggs/
30
+ .eggs/
31
+ lib/
32
+ lib64/
33
+ parts/
34
+ sdist/
35
+ var/
36
+ tmp/
37
+ *.egg-info/
38
+ .installed.cfg
39
+ *.egg
40
+
41
+ # PyInstaller
42
+ # Usually these files are written by a python script from a template
43
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
44
+ *.manifest
45
+ *.spec
46
+
47
+ # Installer logs
48
+ pip-log.txt
49
+ pip-delete-this-directory.txt
50
+
51
+ # Unit test / coverage reports
52
+ htmlcov/
53
+ .tox/
54
+ .coverage
55
+ .coverage.*
56
+ .cache
57
+ nosetests.xml
58
+ coverage.xml
59
+ *,cover
60
+ .hypothesis/
61
+
62
+ # Translations
63
+ *.mo
64
+ *.pot
65
+
66
+ # Django stuff:
67
+ *.log
68
+ local_settings.py
69
+
70
+ # Flask stuff:
71
+ instance/
72
+ .webassets-cache
73
+
74
+ # Scrapy stuff:
75
+ .scrapy
76
+
77
+ # Sphinx documentation
78
+ docs/_build/
79
+
80
+ # PyBuilder
81
+ target/
82
+
83
+ # IPython Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # pyenv
87
+ .python-version
88
+
89
+ # celery beat schedule file
90
+ celerybeat-schedule
91
+
92
+ # dotenv
93
+ .env
94
+
95
+ # virtualenv
96
+ venv/
97
+ .venv/
98
+ ENV/
99
+
100
+ # Spyder project settings
101
+ .spyderproject
102
+
103
+ # Rope project settings
104
+ .ropeproject
105
+
106
+ # vscode
107
+ .vscode
108
+
109
+ # Mac
110
+ .DS_Store
111
+
112
+ # vim
113
+ *.swp
114
+
115
+ # ckpt
116
+ *.lock
117
+
118
+ # data
119
+ *.parquet
120
+ data/*
121
+
122
+
123
+ # local logs
124
+ logs
125
+ log
126
+ outputs
127
+
128
+ # md
129
+ distillation_system_design.md
130
+ on_policy_distillation_implementation_report.md
131
+
132
+ # hope
133
+ *.hope
134
+
135
+ # ray
136
+ temp_ray/*
137
+
138
+ logs/*.eggroll
139
+
140
+ exp1_results/*
141
+ exp2_results/*
.hopeignore ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ data/*
2
+ *.hope
3
+ *.shell
4
+ temp_ray/*
5
+ logs/*.eggroll
6
+ .claude/*
7
+ .github/*
8
+ docker/*
9
+ docs/*
10
+ examples/*
11
+ hope_auto_generate/*
12
+ logs/*
13
+ recipe/*
14
+ scripts/*
15
+ tests/*
16
+ verl.egg-info/*
17
+
18
+ exp1_results/*
19
+ exp2_results/*
.pre-commit-config.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: "v0.11.4"
4
+ hooks:
5
+ - id: ruff
6
+ args: ["--fix", "--show-fixes", "--output-format=full"]
7
+ exclude: ^.*\.(ipynb)$
8
+ - id: ruff-format
.readthedocs.yaml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-22.04
8
+ tools:
9
+ python: "3.11"
10
+ rust: "1.70"
11
+
12
+ sphinx:
13
+ configuration: docs/conf.py
14
+
15
+ python:
16
+ install:
17
+ - requirements: docs/requirements-docs.txt
18
+ - method: pip
19
+ path: .
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
Notice.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Copyright 2023-2024 Bytedance Ltd. and/or its affiliates
README.md ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1 align="center">
2
+ SCOPE: Signal-Calibrated On-Policy Distillation Enhancement with Dual-Path Adaptive Weighting
3
+ </h1>
4
+
5
+ <div align="center">
6
+ <a href='https://arxiv.org/pdf/2604.10688'><img src='https://img.shields.io/badge/arXiv-2604.10688-red?logo=arXiv'></a> &nbsp;
7
+ <a href="https://huggingface.co/papers/2604.10688"><img src='https://img.shields.io/badge/HuggingFace-SCOPE-FF9B9E?logo=huggingface'></img></a> &nbsp;
8
+ <a href="https://github.com/machine981/SCOPE"><img src="https://img.shields.io/badge/GitHub-SCOPE-94c320?logo=github"></a> &nbsp;
9
+ <br>
10
+ </div>
11
+
12
+ ![SCOPE Overview](image/SCOPE_Overview.png)
13
+
14
+ ---
15
+
16
+ ## 🔥 News
17
+
18
+ - **[2026.04]** SCOPE model weights released on Hugging Face!
19
+ - 🤗 [SCOPE-Qwen3-1.7B](https://huggingface.co/Machine981/SCOPE-Qwen3-1.7B)
20
+ - 🤗 [SCOPE-Deepseek-R1-Distill-Qwen-1.5B](https://huggingface.co/Machine981/SCOPE-Deepseek-R1-Distill-Qwen-1.5B)
21
+ - **[2026.04]** Paper released on arXiv!
22
+
23
+ ## 📖 Overview
24
+
25
+ On-Policy Distillation (OPD) alleviates alignment gaps by introducing dense, token-level KL supervision from a teacher model, but typically applies this supervision uniformly across all rollouts, ignoring fundamental differences in signal quality.
26
+
27
+ **Existing OPD Limitations:**
28
+ - **Diversity degradation**: Correct paths are reinforced equally, reducing exploration at the capability boundary
29
+ - **Rectification inefficiency**: Noisy teacher signals mislead incorrect trajectories
30
+
31
+ **SCOPE Solution:**
32
+ We propose Signal-Calibrated On-Policy Distillation Enhancement (SCOPE), a dual-path adaptive training framework that routes on-policy rollouts by correctness into two complementary supervision paths.
33
+
34
+ ---
35
+
36
+ ## 📝 Abstract
37
+
38
+ On-Policy Distillation (OPD) alleviates this by introducing dense, token-level KL supervision from a teacher model, but typically applies this supervision uniformly across all rollouts, ignoring fundamental differences in signal quality. We propose Signal-Calibrated On-Policy Distillation Enhancement (SCOPE), a dual-path adaptive training framework that routes on-policy rollouts by correctness into two complementary supervision paths. For incorrect trajectories, SCOPE performs teacher-perplexity-weighted KL distillation to prioritize instances where the teacher demonstrates genuine corrective capability, while down-weighting unreliable guidance. For correct trajectories, it applies student-perplexity-weighted MLE to concentrate reinforcement on low-confidence samples at the capability boundary rather than over-reinforcing already mastered ones. Both paths employ a group-level normalization to adaptively calibrate weight distributions, accounting for the intrinsic difficulty variance across prompts. Extensive experiments on six reasoning benchmarks show that SCOPE achieves an average relative improvement of 11.42% in Avg@32 and 7.30% in Pass@32 over competitive baselines, demonstrating its consistent effectiveness.
39
+
40
+ ---
41
+
42
+ ## 🏆 Key Contributions
43
+
44
+ - **Empirical analysis of signal quality heterogeneity in OPD:** Uncovers that teacher and student perplexity reliably predict corrective capability on incorrect trajectories and capability-boundary samples on correct ones.
45
+
46
+ - **The SCOPE dual-path adaptive framework:** Routes rollouts by correctness, directing incorrect trajectories to teacher-perplexity-weighted OPD and correct trajectories to student-perplexity-weighted MLE.
47
+
48
+ - **Extensive experimental validation:** Achieves 11.42% Avg@32 and 7.30% Pass@32 relative improvement over baselines on six reasoning benchmarks.
49
+
50
+ ---
51
+
52
+ ## 📖 Method
53
+
54
+ ### SCOPE Framework
55
+
56
+ SCOPE is a dual-path adaptive training framework that routes on-policy rollouts by correctness into two complementary supervision paths:
57
+
58
+ | Path | Trajectories | Method | Objective |
59
+ |------|-------------|--------|-----------|
60
+ | **Student Path** | Correct (Ω_c) | Perplexity-weighted MLE | Reinforce unconventional valid paths at capability boundary |
61
+ | **Teacher Path** | Incorrect (Ω_w) | Perplexity-weighted KL distillation | Filter out context-induced noise, prioritize reliable guidance |
62
+
63
+ ### Weight Formulation
64
+
65
+ **Student-guided weight (for correct trajectories Ω_c):**
66
+
67
+ $$w_i^{stu} = \frac{\text{PPL}_S(y_i|x)^{1/\tau}}{\sum_{j \in \Omega_c} \text{PPL}_S(y_j|x)^{1/\tau}}$$
68
+
69
+ Amplifies "unconventional valid paths" at the capability boundary using perplexity-based weighting.
70
+
71
+ **Teacher-guided weight (for incorrect trajectories Ω_w):**
72
+
73
+ $$w_i^{tea} = \frac{\text{PPL}_T(y_i|x)^{-1/\tau}}{\sum_{j \in \Omega_w} \text{PPL}_T(y_j|x)^{-1/\tau}}$$
74
+
75
+ Filters "context-induced noise" by down-weighting high teacher perplexity instances.
76
+
77
+ ### Key Insight
78
+
79
+ Within each prompt's trajectory group, SCOPE applies **group-level perplexity-based normalization** to adaptively calibrate weight distributions, accounting for the intrinsic difficulty variance across prompts.
80
+
81
+ ### Overall Objective
82
+
83
+ The combined SCOPE objective jointly optimizes:
84
+
85
+ $$\mathcal{L}_{SCOPE} = \sum_{i \in \Omega_c} w_i^{stu} \cdot \mathcal{L}_{MLE} + \sum_{i \in \Omega_w} w_i^{tea} \cdot \mathcal{L}_{OPD}$$
86
+
87
+ ---
88
+
89
+ ## 📊 Main Results
90
+
91
+ ### Mathematical Reasoning (Teacher: Skywork-OR1-Math-7B → Student: DeepSeek-R1-Distill-Qwen-1.5B)
92
+
93
+ | Benchmark | Avg@32 | Pass@32 | vs OPD |
94
+ | --------- | ------ | ------- | ------ |
95
+ | AIME24 | 42.7 | 77.9 | +6.22% |
96
+ | AIME25 | 30.4 | 50.9 | +5.19% |
97
+ | AMC23 | 80.9 | 97.2 | +6.59% |
98
+ | MATH500 | 89.8 | 97.9 | +0.90% |
99
+ | Minerva | 37.8 | 55.1 | +8.31% |
100
+ | Olympiad | 49.7 | 70.9 | +10.69% |
101
+
102
+ **Key findings:**
103
+ - **11.42%** relative improvement in Avg@32
104
+ - **7.30%** relative improvement in Pass@32
105
+ - **+5.54%** average improvement over standard OPD across benchmarks
106
+
107
+ ---
108
+
109
+ ## ⚡ Quick Start
110
+
111
+ ### 1. Install Dependencies
112
+
113
+ ```bash
114
+ pip install -r requirements.txt
115
+ pip install -e . # install verl itself
116
+ ```
117
+
118
+ ### 2. Deploy VLLM Service
119
+
120
+ ```bash
121
+ bash deploy_vllm.sh
122
+ ```
123
+
124
+ **Key configurations in `deploy_vllm.sh`**:
125
+
126
+ | Parameter | Description | Default |
127
+ | --------- | ----------- | ------- |
128
+ | `model_name_or_path` | Model path | `./Models/Skywork-OR1-7B` |
129
+ | `served_model_name` | Model name in API | `Skywork-OR1-7B` |
130
+ | `--api-key` | API authentication key | `xxx` (must match `verl/utils/api_interface.py`) |
131
+
132
+ ### 3. Configure Experiment Scripts
133
+
134
+ Set the following in `run_experiment_distill_1_5b.sh`:
135
+
136
+ ```bash
137
+ TEACHER_MODEL_NAME=Skywork-OR1-7B # Must match served_model_name in deploy_vllm.sh
138
+ IP_POOL="['xx.xxx.x.xx','...']" # VLLM service node IP list
139
+ ```
140
+
141
+ **API Key Consistency**: The `--api-key` in `deploy_vllm.sh` must match the `api_key` in `verl/utils/api_interface.py`.
142
+
143
+ ### 4. Run Training
144
+
145
+ ```bash
146
+ bash run_experiment_distill_1_5b.sh
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 🔧 Training Parameters
152
+
153
+ ### Model Configuration
154
+
155
+ | Parameter | Description | Default |
156
+ | --------- | ----------- | ------- |
157
+ | `POLICY_MODEL_PATH` | Student model path | `DeepSeek-R1-Distill-Qwen-1.5B` |
158
+ | `TEACHER_MODEL_NAME` | Teacher model name (as registered in VLLM) | `Skywork-OR1-7B` |
159
+ | `IP_POOL` | VLLM service node IP list | `['xx.xxx.x.xx','...']` |
160
+
161
+ ### Data Configuration
162
+
163
+ | Parameter | Description | Default |
164
+ | --------- | ----------- | ------- |
165
+ | `TRAIN_DATA` | Training data path | `./verl-distillation-ori/data/deepmath_new/deepmath_new_train.parquet` |
166
+ | `VAL_DATA` | Validation data path | `./verl-distillation-ori/data/aime/test.parquet` |
167
+ | `MAX_PROMPT_LENGTH` | Max prompt length | `2048` |
168
+ | `MAX_RESPONSE_LENGTH` | Max response length | `12288` |
169
+
170
+ ### SCOPE Dual-Path Configuration
171
+
172
+ | Parameter | Description | Default |
173
+ | --------- | ----------- | ------- |
174
+ | `USE_SCOPE_DUAL_PATH_WEIGHTING` | Enable SCOPE dual-path weighting | `True` |
175
+ | `SCOPE_TAU` | Weight temperature parameter | `1` |
176
+ | `SCOPE_USE_SEQ_WEIGHTS` | Use sequence-level weights | `True` |
177
+ | `USE_STUDENT_PATH_WEIGHTS` | Use student path weights | `True` |
178
+ | `USE_TEACHER_PATH_WEIGHTS` | Use teacher path weights | `True` |
179
+ | `STUDENT_PATH_PPL_POSITIVE` | Student path: higher PPL → higher weight | `True` |
180
+ | `TEACHER_PATH_PPL_POSITIVE` | Teacher path: higher PPL → lower weight | `False` |
181
+
182
+ ---
183
+
184
+ ## 🤝 Acknowledgements
185
+
186
+ This work builds upon [verl](https://github.com/volcengine/verl) and the on-policy distillation paradigm, with appreciation for their contributions to the research community.
187
+
188
+ ## 🔗 Citation
189
+
190
+ If you find our work useful, please consider citing:
191
+
192
+ ```bibtex
193
+ @article{scope2026,
194
+ title={SCOPE: Signal-Calibrated On-Policy Distillation Enhancement with Dual-Path Adaptive Weighting},
195
+ author={Zheng, Binbin and Ma, Xing and Liang, Yiheng and Ruan, Jingqing and Fu, Xiaoliang and Lin, Kepeng and Zhu, Benchang and Zeng, Ke and Cai, Xunliang},
196
+ journal={arXiv preprint arXiv:2604.10688},
197
+ year={2026}
198
+ }
199
+ ```
200
+
201
+ ## 📝 License
202
+
203
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
README_ZH.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1 align="center">
2
+ SCOPE: Signal-Calibrated On-Policy Distillation Enhancement with Dual-Path Adaptive Weighting
3
+ </h1>
4
+
5
+ <div align="center">
6
+ <a href='https://arxiv.org/pdf/2604.10688'><img src='https://img.shields.io/badge/arXiv-2604.10688-red?logo=arXiv'></a> &nbsp;
7
+ <a href="https://huggingface.co/papers/2604.10688"><img src='https://img.shields.io/badge/HuggingFace-SCOPE-FF9B9E?logo=huggingface'></img></a> &nbsp;
8
+ <a href="https://github.com/machine981/SCOPE"><img src="https://img.shields.io/badge/GitHub-SCOPE-94c320?logo=github"></a> &nbsp;
9
+ <br>
10
+ </div>
11
+
12
+ ![SCOPE Overview](image/SCOPE_Overview.png)
13
+
14
+ ---
15
+
16
+ ## 🔥 新闻
17
+
18
+ - **[2026.04]** SCOPE 模型权重已发布!
19
+ - 🤗 [SCOPE-Qwen3-1.7B](https://huggingface.co/Machine981/SCOPE-Qwen3-1.7B)
20
+ - 🤗 [SCOPE-Deepseek-R1-Distill-Qwen-1.5B](https://huggingface.co/Machine981/SCOPE-Deepseek-R1-Distill-Qwen-1.5B)
21
+ - **[2026.04]** 论文已在 arXiv 发布!
22
+
23
+ ---
24
+
25
+ ## 📖 概述
26
+
27
+ 在线蒸馏(On-Policy Distillation, OPD)通过引入教师模型提供的密集 token 级 KL 监督来缓解对齐差距,但通常对所有在线 rollout 均匀应用这种监督,忽视了信号质量的根本差异。
28
+
29
+ **现有 OPD 的局限性:**
30
+ - **多样性退化**:正确路径被同等强化,减少了能力边界的探索
31
+ - **纠正效率低下**:嘈杂的教师信号误导错误轨迹
32
+
33
+ **SCOPE 解决方案:**
34
+ 我们提出了信号校准在线蒸馏增强(SCOPE),一种双路径自适应训练框架,将在线 rollout 按正确性路由到两条互补的监督路径。
35
+
36
+ ---
37
+
38
+ ## 📝 摘要
39
+
40
+ 在线蒸馏(OPD)通过引入教师模型提供的密集 token 级 KL 监督来缓解对齐差距,但通常对所有在线 rollout 均匀应用这种监督,忽视了信号质量的根本差异。我们提出了信号校准在线蒸馏增强(SCOPE),一种双路径自适应训练框架,将在线 rollout 按正确性路由到两条互补的监督路径。对于错误轨迹,SCOPE 执行教师困惑度加权的 KL 蒸馏,优先选择教师表现出真正纠正能力的样本,同时降低不可靠指导的权重。对于正确轨迹,它应用学生困惑度加权的 MLE,将强化集中在能力边界上的低置信度样本,而不是过度强化已掌握的样本。两条路径都采用组级归一化来自适应校准权重分布,考虑了跨提示的固有难度差异。在六个推理基准上的广泛实验表明,SCOPE 在 Avg@32 上实现了 11.42% 的平均相对提升,在 Pass@32 上实现了 7.30% 的平均相对提升,展示了其持续的有效性。
41
+
42
+ ---
43
+
44
+ ## 🏆 主要贡献
45
+
46
+ - **对 OPD 信号质量异质性的实证分析:** 揭示了教师和学生困惑度可可靠地预测错误轨迹上的纠正能力和正确轨迹上能力边界的样本。
47
+
48
+ - **SCOPE 双路径自适应框架:** 按正确性路由 rollout,将错误轨迹导向教师困惑度加权的 OPD,将正确轨迹导向学生困惑度加权的 MLE。
49
+
50
+ - **广泛的实验验证:** 在六个推理基准上相比基线在 Avg@32 上实现 11.42% 的相对提升,在 Pass@32 上实现 7.30% 的相对提升。
51
+
52
+ ---
53
+
54
+ ## 📖 方法
55
+
56
+ ### SCOPE 框架
57
+
58
+ SCOPE 是一个双路径自适应训练框架,将在线 rollout 按正确性路由到两条互补的监督路径:
59
+
60
+ | 路径 | 轨迹 | 方法 | 目标 |
61
+ |------|------|------|------|
62
+ | **学生路径** | 正确 (Ω_c) | 困惑度加权的 MLE | 强化能力边界上非常规有效路径 |
63
+ | **教师路径** | 错误 (Ω_w) | 困惑度加权的 KL 蒸馏 | 过滤上下文诱导的噪声,优先选择可靠指导 |
64
+
65
+ ### 权重公式
66
+
67
+ **学生引导权重(用于正确轨迹 Ω_c):**
68
+
69
+ $$w_i^{stu} = \frac{\text{PPL}_S(y_i|x)^{1/\tau}}{\sum_{j \in \Omega_c} \text{PPL}_S(y_j|x)^{1/\tau}}$$
70
+
71
+ 使用基于困惑度的加权放大"能力边界的非常规有效路径"。
72
+
73
+ **教师引导权重(用于错误轨迹 Ω_w):**
74
+
75
+ $$w_i^{tea} = \frac{\text{PPL}_T(y_i|x)^{-1/\tau}}{\sum_{j \in \Omega_w} \text{PPL}_T(y_j|x)^{-1/\tau}}$$
76
+
77
+ 通过降低高教师困惑度实例的权重来过滤"上下文诱导的噪声"。
78
+
79
+ ### 关键洞察
80
+
81
+ 在每个提示的轨迹组内,SCOPE 应用**组级基于困惑度的归一化**来自适应校准权重分布,考虑了跨提示的固有难度差异。
82
+
83
+ ### 总体目标
84
+
85
+ 联合优化组合的 SCOPE 目标:
86
+
87
+ $$\mathcal{L}_{SCOPE} = \sum_{i \in \Omega_c} w_i^{stu} \cdot \mathcal{L}_{MLE} + \sum_{i \in \Omega_w} w_i^{tea} \cdot \mathcal{L}_{OPD}$$
88
+
89
+ ---
90
+
91
+ ## 📊 主要结果
92
+
93
+ ### 数学推理 (Teacher: Skywork-OR1-Math-7B → Student: DeepSeek-R1-Distill-Qwen-1.5B)
94
+
95
+ | Benchmark | Avg@32 | Pass@32 | vs OPD |
96
+ | --------- | ------ | ------- | ------ |
97
+ | AIME24 | 42.7 | 77.9 | +6.22% |
98
+ | AIME25 | 30.4 | 50.9 | +5.19% |
99
+ | AMC23 | 80.9 | 97.2 | +6.59% |
100
+ | MATH500 | 89.8 | 97.9 | +0.90% |
101
+ | Minerva | 37.8 | 55.1 | +8.31% |
102
+ | Olympiad | 49.7 | 70.9 | +10.69% |
103
+
104
+ **关键发现:**
105
+ - **11.42%** Avg@32 相对提升
106
+ - **7.30%** Pass@32 相对提升
107
+ - 相比标准 OPD 在各���准上平均 **+5.54%** 提升
108
+
109
+ ---
110
+
111
+ ## ⚡ 快速开始
112
+
113
+ ### 1. 部署 VLLM 服务
114
+
115
+ ```bash
116
+ bash deploy_vllm.sh
117
+ ```
118
+
119
+ **`deploy_vllm.sh` 关键配置**:
120
+
121
+ | 参数 | 说明 | 默认值 |
122
+ | --------- | ----------- | ------- |
123
+ | `model_name_or_path` | 模型路径 | `./Models/Skywork-OR1-7B` |
124
+ | `served_model_name` | API 服务中的模型名称 | `Skywork-OR1-7B` |
125
+ | `--api-key` | API 认证密钥 | `xxx`(需与 `verl/utils/api_interface.py` 中的 key 保持一致) |
126
+
127
+ ### 2. 配置实验脚本
128
+
129
+ 在 `run_experiment_distill_1_5b.sh` 中设置:
130
+
131
+ ```bash
132
+ TEACHER_MODEL_NAME=Skywork-OR1-7B # 必须与 deploy_vllm.sh 中的 served_model_name 一致
133
+ IP_POOL="['xx.xxx.x.xx','...']" # VLLM 服务节点 IP 列表
134
+ ```
135
+
136
+ **API Key 一致性**:`deploy_vllm.sh` 中的 `--api-key` 必须与 `verl/utils/api_interface.py` 中的 `api_key` 保持一致。
137
+
138
+ ### 3. 运行训练
139
+
140
+ ```bash
141
+ bash run_experiment_distill_1_5b.sh
142
+ ```
143
+
144
+ ---
145
+
146
+ ## 🔧 训练参数
147
+
148
+ ### 模型配置
149
+
150
+ | 参数 | 说明 | 默认值 |
151
+ | --------- | ----------- | ------- |
152
+ | `POLICY_MODEL_PATH` | 学生模型路径 | `DeepSeek-R1-Distill-Qwen-1.5B` |
153
+ | `TEACHER_MODEL_NAME` | 教师模型名称(VLLM 服务中注册的名字) | `Skywork-OR1-7B` |
154
+ | `IP_POOL` | VLLM 服务节点 IP 列表 | `['xx.xxx.x.xx','...']` |
155
+
156
+ ### 数据配置
157
+
158
+ | 参数 | 说明 | 默认值 |
159
+ | --------- | ----------- | ------- |
160
+ | `TRAIN_DATA` | 训练数据路径 | `./verl-distillation-ori/data/deepmath_new/deepmath_new_train.parquet` |
161
+ | `VAL_DATA` | 验证数据路径 | `./verl-distillation-ori/data/aime/test.parquet` |
162
+ | `MAX_PROMPT_LENGTH` | 最大提示长度 | `2048` |
163
+ | `MAX_RESPONSE_LENGTH` | 最大回复长度 | `12288` |
164
+
165
+ ### SCOPE 双路径配置
166
+
167
+ | 参数 | 说明 | 默认值 |
168
+ | --------- | ----------- | ------- |
169
+ | `USE_SCOPE_DUAL_PATH_WEIGHTING` | 启用 SCOPE 双路径加权 | `True` |
170
+ | `SCOPE_TAU` | 加权温度参数 | `1` |
171
+ | `SCOPE_USE_SEQ_WEIGHTS` | 使用序列级权重 | `True` |
172
+ | `USE_STUDENT_PATH_WEIGHTS` | 使用学生路径权重 | `True` |
173
+ | `USE_TEACHER_PATH_WEIGHTS` | 使用教师路径权重 | `True` |
174
+ | `STUDENT_PATH_PPL_POSITIVE` | 学生路径:PPL 越高权重越高 | `True` |
175
+ | `TEACHER_PATH_PPL_POSITIVE` | 教师路径:PPL 越高权重越低 | `False` |
176
+
177
+ ---
178
+
179
+ ## 🤝 致谢
180
+
181
+ 本工作基于 [verl](https://github.com/volcengine/verl) 和在线蒸馏范式构建,感谢他们对研究社区的贡献。
182
+
183
+ ## 🔗 引用
184
+
185
+ 如果我们的工作对您有帮助,请考虑引用:
186
+
187
+ ```bibtex
188
+ @article{scope2026,
189
+ title={SCOPE: Signal-Calibrated On-Policy Distillation Enhancement with Dual-Path Adaptive Weighting},
190
+ author={Zheng, Binbin and Ma, Xing and Liang, Yiheng and Ruan, Jingqing and Fu, Xiaoliang and Lin, Kepeng and Zhu, Benchang and Zeng, Ke and Cai, Xunliang},
191
+ journal={arXiv preprint arXiv:2604.10688},
192
+ year={2026}
193
+ }
194
+ ```
195
+
196
+ ## 📝 许可证
197
+
198
+ 本项目采用 MIT 许可证。详见 [LICENSE](LICENSE) 文件。
deploy_vllm.sh ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html#
2
+ # https://www.cnblogs.com/badwood316/p/18187990
3
+ export PATH="./condas/conda0430/bin:$PATH"
4
+
5
+ export VLLM_ALLOW_LONG_MAX_MODEL_LEN=1
6
+
7
+ which python
8
+
9
+ model_name_or_path=./Models/Skywork-OR1-7B
10
+ served_model_name=Skywork-OR1-7B
11
+
12
+ NNODES=`python parse_env.py nnodes`
13
+ MASTER_ADDR=`python parse_env.py master_addr`
14
+ GPUS_PER_NODE=`python parse_env.py nproc_per_node`
15
+ NODE_RANK=`python parse_env.py node_rank`
16
+ WORLD_SIZE=$(($NNODES*$GPUS_PER_NODE))
17
+
18
+
19
+ tensor_parallel_size=$GPUS_PER_NODE
20
+
21
+ echo $model_name_or_path
22
+ echo $served_model_name
23
+
24
+ python3 ./verl-distillation-ori/verl/utils/low_gpu_utilization_vllm.py &
25
+
26
+ python3 -m vllm.entrypoints.openai.api_server \
27
+ --model ${model_name_or_path} \
28
+ --api-key xxx \
29
+ --tensor-parallel-size ${tensor_parallel_size} \
30
+ --served-model-name ${served_model_name} \
31
+ --enable-chunked-prefill \
32
+ --gpu-memory-utilization 0.6 \
33
+ --max_num_batched_tokens 4096 \
34
+ --max-model-len 34000 \
35
+ --max-logprobs 30
36
+
37
+ sleep 10
38
+
39
+ # # 启动服务
40
+ echo "服务已部署,访问地址为:http://$(hostname -I | awk '{print $1}'):8000"
docker/Apptainerfile.rocm ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Bootstrap: docker
2
+
3
+ # Support - Traing: fsdp; Inference: vllm
4
+ # FROM: rocm/vllm:rocm6.2_mi300_ubuntu20.04_py3.9_vllm_0.6.4
5
+ # Support - Traing: fsdp; Inference: vllm, sglang
6
+ FROM lmsysorg/sglang:v0.4.5-rocm630
7
+
8
+ %environment
9
+ export PYTORCH_ROCM_ARCH="gfx90a;gfx942"
10
+
11
+ export HIPCC_COMPILE_FLAGS_APPEND="--amdgpu-target=gfx90a;gfx942 -D__HIP_PLATFORM_AMD__"
12
+ export CFLAGS="-D__HIP_PLATFORM_AMD__"
13
+ export CXXFLAGS="-D__HIP_PLATFORM_AMD__"
14
+
15
+ %post
16
+ # Create source directory
17
+ mkdir -p /opt/src
18
+
19
+ # Uninstall and reinstall vllm
20
+ pip uninstall -y vllm
21
+ cd /opt/src
22
+ git clone -b v0.6.3 https://github.com/vllm-project/vllm.git
23
+ cd vllm
24
+ MAX_JOBS=$(nproc) python3 setup.py install
25
+ cd /opt
26
+ rm -rf /opt/src/vllm
27
+
28
+ # Install dependencies
29
+ pip install "tensordict<0.6" --no-deps
30
+ pip install accelerate \
31
+ codetiming \
32
+ datasets \
33
+ dill \
34
+ hydra-core \
35
+ liger-kernel \
36
+ numpy \
37
+ pandas \
38
+ peft \
39
+ "pyarrow>=15.0.0" \
40
+ pylatexenc \
41
+ "ray[data,train,tune,serve]" \
42
+ torchdata \
43
+ transformers \
44
+ wandb \
45
+ orjson \
46
+ pybind11
47
+
48
+ # Clone and install verl from GitHub
49
+ cd /opt
50
+ git clone https://github.com/volcengine/verl.git
51
+ cd verl
52
+ # Uncomment to use a specific version
53
+ # git checkout v0.3.0.post0
54
+ pip install -e . --no-deps
55
+
56
+ # Install torch_memory_saver
57
+ pip install git+https://github.com/ExtremeViscent/torch_memory_saver.git --no-deps
docker/Dockerfile.ngc.vllm ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # docker buildx build --platform linux/x86_64 -t "verlai/verl:ngc-th2.4.0-cu124-vllm0.6.3-ray2.4-te1.7-v0.0.6" -f docker/Dockerfile.ngc.vllm . --builder cloud-verlai-verl-builder --progress=plain --push
2
+ FROM nvcr.io/nvidia/pytorch:24.05-py3
3
+
4
+ # uninstall nv-pytorch fork
5
+ RUN pip3 uninstall pytorch-quantization \
6
+ pytorch-triton \
7
+ torch \
8
+ torch-tensorrt \
9
+ torchvision \
10
+ xgboost transformer_engine flash_attn \
11
+ apex megatron-core -y
12
+
13
+ RUN pip3 install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu124
14
+
15
+ # =============== Megatron dependencies (optional) =================
16
+ # install apex, set MAX_JOBS to avoid OOMs
17
+ RUN MAX_JOBS=4 pip3 install -v --disable-pip-version-check --no-cache-dir --no-build-isolation \
18
+ --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" \
19
+ git+https://github.com/NVIDIA/apex
20
+ # =============== End of Megatron dependencies (optional) =================
21
+
22
+ RUN pip3 install --no-cache-dir \
23
+ accelerate \
24
+ codetiming \
25
+ datasets \
26
+ dill \
27
+ hydra-core \
28
+ numpy \
29
+ 'pandas' \
30
+ 'peft' \
31
+ 'pyarrow>=15.0.0' \
32
+ 'pybind11' \
33
+ 'pylatexenc' \
34
+ 'ray>=2.10' \
35
+ 'tensordict<0.6' \
36
+ 'transformers' \
37
+ 'vllm==0.6.3.post1' \
38
+ 'wandb'
39
+
40
+ # full dependencies
41
+ RUN pip3 install pytest pre-commit py-spy pyext liger-kernel
42
+
43
+ # =============== Megatron dependencies (optional) =================
44
+ # install Transformer Engine, which requires FA 2.5.8. Do it in a separate step for docker cache
45
+ RUN MAX_JOBS=4 NINJA_FLAGS="-j4" pip3 install flash-attn==2.5.8 --no-cache-dir --no-build-isolation
46
+ RUN MAX_JOBS=1 NINJA_FLAGS="-j1" TE_BUILD_WITH_NINJA=0 pip3 install git+https://github.com/eric-haibin-lin/TransformerEngine.git@v1.7.0
47
+ # =============== End of Megatron dependencies (optional) =================
docker/Dockerfile.ngc.vllm0.8 ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Start from the NVIDIA official image (ubuntu-22.04 + cuda-12.6 + python-3.10)
2
+ # https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel-24-08.html
3
+ FROM nvcr.io/nvidia/pytorch:24.08-py3
4
+
5
+ # Define environments
6
+ ENV MAX_JOBS=32
7
+ ENV VLLM_WORKER_MULTIPROC_METHOD=spawn
8
+ ENV DEBIAN_FRONTEND=noninteractive
9
+ ENV NODE_OPTIONS=""
10
+ ENV PIP_ROOT_USER_ACTION=ignore
11
+ ENV HF_HUB_ENABLE_HF_TRANSFER="1"
12
+
13
+ # Define installation arguments
14
+ ARG APT_SOURCE=https://mirrors.tuna.tsinghua.edu.cn/ubuntu/
15
+ ARG PIP_INDEX=https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
16
+
17
+ # Set apt source
18
+ RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
19
+ { \
20
+ echo "deb ${APT_SOURCE} jammy main restricted universe multiverse"; \
21
+ echo "deb ${APT_SOURCE} jammy-updates main restricted universe multiverse"; \
22
+ echo "deb ${APT_SOURCE} jammy-backports main restricted universe multiverse"; \
23
+ echo "deb ${APT_SOURCE} jammy-security main restricted universe multiverse"; \
24
+ } > /etc/apt/sources.list
25
+
26
+ # Install systemctl
27
+ RUN apt-get update && \
28
+ apt-get install -y -o Dpkg::Options::="--force-confdef" systemd && \
29
+ apt-get clean
30
+
31
+ # Install tini
32
+ RUN apt-get update && \
33
+ apt-get install -y tini && \
34
+ apt-get clean
35
+
36
+ # Change pip source
37
+ RUN pip config set global.index-url "${PIP_INDEX}" && \
38
+ pip config set global.extra-index-url "${PIP_INDEX}" && \
39
+ python -m pip install --upgrade pip
40
+
41
+ # Uninstall nv-pytorch fork
42
+ RUN pip uninstall -y torch torchvision torchaudio \
43
+ pytorch-quantization pytorch-triton torch-tensorrt \
44
+ xgboost transformer_engine flash_attn apex megatron-core grpcio
45
+
46
+ # Install torch-2.6.0+cu124 + vllm-0.8.3
47
+ # torch-2.6.0+cu124: cxx11abi=False
48
+ # torch-2.6.0+cu126: cxx11abi=True
49
+ # see https://github.com/flashinfer-ai/flashinfer/issues/911
50
+ RUN pip install --no-cache-dir "vllm==0.8.3" "torch==2.6.0" "torchvision==0.21.0" "torchaudio==2.6.0" "tensordict==0.6.2" torchdata \
51
+ "transformers[hf_xet]>=4.51.0" accelerate datasets peft hf-transfer \
52
+ "numpy<2.0.0" "pyarrow>=15.0.0" pandas \
53
+ ray[default] codetiming hydra-core pylatexenc qwen-vl-utils wandb dill pybind11 liger-kernel mathruler \
54
+ pytest py-spy pyext pre-commit ruff
55
+
56
+ # Install flash-attn-2.7.4.post1 (cxx11abi=False)
57
+ RUN wget -nv https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl && \
58
+ pip install --no-cache-dir flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
59
+
60
+ # Install flashinfer-0.2.2.post1+cu124 (cxx11abi=False)
61
+ # vllm-0.8.3 does not support flashinfer>=0.2.3
62
+ # see https://github.com/vllm-project/vllm/pull/15777
63
+ RUN wget -nv https://github.com/flashinfer-ai/flashinfer/releases/download/v0.2.2.post1/flashinfer_python-0.2.2.post1+cu124torch2.6-cp38-abi3-linux_x86_64.whl && \
64
+ pip install --no-cache-dir flashinfer_python-0.2.2.post1+cu124torch2.6-cp38-abi3-linux_x86_64.whl
65
+
66
+ # Fix packages
67
+ RUN pip uninstall -y pynvml nvidia-ml-py && \
68
+ pip install --no-cache-dir --upgrade "nvidia-ml-py>=12.560.30" "fastapi[standard]>=0.115.0" "optree>=0.13.0" "pydantic>=2.9" "grpcio>=1.62.1"
69
+
70
+ # Install verl
71
+ RUN pip install --no-cache-dir verl[vllm] -U
72
+
73
+ # Reset pip config
74
+ RUN pip config unset global.index-url && \
75
+ pip config unset global.extra-index-url
docker/Dockerfile.ngc.vllm0.8.sagemaker ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Using a pre-built image from AWS DLC which contains the current version of python (3.10) and supported cuda version (12.1)
2
+ FROM 763104351884.dkr.ecr.us-east-1.amazonaws.com/huggingface-pytorch-training:2.1.0-transformers4.36.0-gpu-py310-cu121-ubuntu20.04
3
+
4
+ # uninstall nv-pytorch fork
5
+ RUN pip3 uninstall -y pytorch-quantization \
6
+ pytorch-triton torch torch-tensorrt torchvision \
7
+ xgboost transformer_engine flash_attn apex megatron-core
8
+
9
+ # Define environments
10
+ ENV MAX_JOBS=32
11
+ ENV VLLM_WORKER_MULTIPROC_METHOD=spawn
12
+ ENV DEBIAN_FRONTEND=noninteractive
13
+ ENV NODE_OPTIONS=""
14
+ ENV HF_HUB_ENABLE_HF_TRANSFER="1"
15
+
16
+ # Install systemctl
17
+ RUN apt-get update && \
18
+ apt-get install -y -o Dpkg::Options::="--force-confdef" systemd && \
19
+ apt-get clean
20
+
21
+ # Install tini
22
+ RUN apt-get update && \
23
+ apt-get install -y tini && \
24
+ apt-get clean
25
+
26
+ # Install torch-2.6.0 + vllm-0.8.2
27
+ RUN pip install --no-cache-dir vllm==0.8.2 torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 tensordict torchdata==0.11.0 \
28
+ transformers>=4.49.0 accelerate datasets peft hf-transfer \
29
+ ray[default] codetiming hydra-core pandas pyarrow>=15.0.0 pylatexenc qwen-vl-utils wandb dill pybind11 liger-kernel mathruler \
30
+ pytest pre-commit py-spy pyext ruff
31
+
32
+ # Install flash_attn-2.7.4.post1
33
+ RUN pip uninstall -y transformer-engine flash-attn && \
34
+ pip install flash-attn==2.7.4.post1 --no-build-isolation
35
+
36
+ # Fix cv2
37
+ RUN pip uninstall -y pynvml nvidia-ml-py && \
38
+ pip install --no-cache-dir nvidia-ml-py>=12.560.30 opencv-python-headless==4.8.0.74 fastapi==0.115.6 && \
39
+ pip install --no-cache-dir --upgrade optree>=0.13.0
40
+
41
+ # Install verl
42
+ RUN pip install --no-cache-dir verl[vllm] -U
43
+
44
+ # Reset pip config
45
+ RUN pip config unset global.index-url && \
46
+ pip config unset global.extra-index-url
docker/Dockerfile.rocm ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build the docker in the repo dir:
2
+ # docker build -f docker/Dockerfile.rocm -t verl-rocm:03.04.2015 .
3
+ # docker images # you can find your built docker
4
+
5
+
6
+ # Support - Traing: fsdp; Inference: vllm
7
+ # FROM rocm/vllm:rocm6.2_mi300_ubuntu20.04_py3.9_vllm_0.6.4
8
+ # Support - Traing: fsdp; Inference: vllm, sglang
9
+ FROM lmsysorg/sglang:v0.4.6.post1-rocm630
10
+
11
+ # Set working directory
12
+ # WORKDIR $PWD/app
13
+
14
+ # Set environment variables
15
+ ENV PYTORCH_ROCM_ARCH="gfx90a;gfx942"
16
+
17
+ ENV HIPCC_COMPILE_FLAGS_APPEND="--amdgpu-target=gfx90a;gfx942 -D__HIP_PLATFORM_AMD__"
18
+ ENV CFLAGS="-D__HIP_PLATFORM_AMD__"
19
+ ENV CXXFLAGS="-D__HIP_PLATFORM_AMD__"
20
+
21
+ # Install vllm
22
+ RUN pip uninstall -y vllm && \
23
+ rm -rf vllm && \
24
+ git clone -b v0.6.3 https://github.com/vllm-project/vllm.git && \
25
+ cd vllm && \
26
+ MAX_JOBS=$(nproc) python3 setup.py install && \
27
+ cd .. && \
28
+ rm -rf vllm
29
+
30
+ # Copy the entire project directory
31
+ COPY . .
32
+
33
+ # Install dependencies
34
+ RUN pip install "tensordict<0.6" --no-deps && \
35
+ pip install accelerate \
36
+ codetiming \
37
+ datasets \
38
+ dill \
39
+ hydra-core \
40
+ liger-kernel \
41
+ numpy \
42
+ pandas \
43
+ peft \
44
+ "pyarrow>=15.0.0" \
45
+ pylatexenc \
46
+ "ray[data,train,tune,serve]>=2.45.0" \
47
+ torchdata \
48
+ transformers \
49
+ wandb \
50
+ orjson \
51
+ pybind11 && \
52
+ pip install -e . --no-deps
53
+
54
+ # Install torch_memory_saver
55
+ RUN pip install git+https://github.com/ExtremeViscent/torch_memory_saver.git --no-deps
docker/Dockerfile.sglang ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Start from the NVIDIA official image (ubuntu-22.04 + python-3.10)
2
+ # https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel-24-08.html
3
+ FROM nvcr.io/nvidia/pytorch:24.08-py3
4
+
5
+ # Define environments
6
+ ENV MAX_JOBS=32
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+ ENV NODE_OPTIONS=""
9
+
10
+ # Define installation arguments
11
+ ARG APT_SOURCE=https://mirrors.ustc.edu.cn/ubuntu/
12
+
13
+ # Set apt source
14
+ RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
15
+ { \
16
+ echo "deb ${APT_SOURCE} jammy main restricted universe multiverse"; \
17
+ echo "deb ${APT_SOURCE} jammy-updates main restricted universe multiverse"; \
18
+ echo "deb ${APT_SOURCE} jammy-backports main restricted universe multiverse"; \
19
+ echo "deb ${APT_SOURCE} jammy-security main restricted universe multiverse"; \
20
+ } > /etc/apt/sources.list
21
+
22
+ # Install systemctl
23
+ RUN apt-get update && \
24
+ apt-get install -y -o Dpkg::Options::="--force-confdef" systemd && \
25
+ apt-get clean
26
+
27
+ # Install tini
28
+ RUN apt-get update && \
29
+ apt-get install -y tini && \
30
+ apt-get clean
31
+
32
+ # Change pip source
33
+ ARG PIP_INDEX=https://mirrors.aliyun.com/pypi/simple/
34
+
35
+ RUN pip config set global.index-url "${PIP_INDEX}" && \
36
+ pip config set global.extra-index-url "${PIP_INDEX}" && \
37
+ python -m pip install --upgrade pip
38
+
39
+ # Install sglang-0.4.6.post1 and torch-memory-saver
40
+ RUN pip install "sglang[all]==0.4.6.post1" --no-cache-dir --find-links https://flashinfer.ai/whl/cu124/torch2.6/flashinfer-python && pip install torch-memory-saver --no-cache-dir
41
+
42
+ # Install torch-2.6.0
43
+ RUN pip install --no-cache-dir torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 tensordict torchdata \
44
+ transformers>=4.49.0 accelerate datasets peft hf_transfer \
45
+ ray[default] codetiming hydra-core pandas pyarrow>=15.0.0 pylatexenc qwen-vl-utils wandb liger-kernel \
46
+ pytest pre-commit py-spy pyext
47
+
48
+ # Install flash_attn-2.7.4.post1
49
+ RUN pip uninstall -y transformer-engine flash-attn && \
50
+ wget -v https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl && \
51
+ pip install --no-cache-dir flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
52
+
53
+ # Fix cv2
54
+ RUN pip uninstall -y pynvml nvidia-ml-py && \
55
+ pip install --no-cache-dir nvidia-ml-py>=12.560.30 opencv-python-headless==4.8.0.74 fastapi==0.115.6
docker/Dockerfile.stage1.megatron ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM hiyouga/verl:ngc-th2.6.0-cu126-vllm0.8.3-flashinfer0.2.2-cxx11abi0
2
+
3
+ # Define environments
4
+ ENV MAX_JOBS=64
5
+
6
+ RUN apt-get update && \
7
+ apt-get install -y aria2
8
+
9
+ # 1. Reinstall CUDA 12.4
10
+ RUN aria2c https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin && \
11
+ mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
12
+
13
+ RUN aria2c --always-resume=true --max-tries=99999 https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda-repo-ubuntu2204-12-4-local_12.4.1-550.54.15-1_amd64.deb && \
14
+ dpkg -i cuda-repo-ubuntu2204-12-4-local_12.4.1-550.54.15-1_amd64.deb && \
15
+ cp /var/cuda-repo-ubuntu2204-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/ && \
16
+ apt-get update && \
17
+ apt-get -y install cuda-toolkit-12-4 && \
18
+ rm cuda-repo-ubuntu2204-12-4-local_12.4.1-550.54.15-1_amd64.deb && \
19
+ update-alternatives --set cuda /usr/local/cuda-12.4 && \
20
+ rm -rf /usr/local/cuda-12.6
docker/Dockerfile.stage2.megatron ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM whatcanyousee/verl:ngc-th2.6.0-cu124-vllm0.8.3
2
+
3
+ # Define environments
4
+ ENV MAX_JOBS=64
5
+
6
+ RUN apt-get update && \
7
+ apt-get install -y aria2 libfreeimage3 libfreeimage-dev zlib1g
8
+
9
+ # 4. Install Sglang
10
+ RUN pip install --no-deps "sglang[all]>=0.4.5.post3"
11
+
12
+ # 5. Install cudnn
13
+ RUN aria2c --max-tries=9999 https://developer.download.nvidia.com/compute/cudnn/9.8.0/local_installers/cudnn-local-repo-ubuntu2204-9.8.0_1.0-1_amd64.deb && \
14
+ dpkg -i cudnn-local-repo-ubuntu2204-9.8.0_1.0-1_amd64.deb && \
15
+ cp /var/cudnn-local-repo-ubuntu2204-9.8.0/cudnn-*-keyring.gpg /usr/share/keyrings/ && \
16
+ apt-get update && \
17
+ apt-get -y install cudnn-cuda-12 && \
18
+ rm cudnn-local-repo-ubuntu2204-9.8.0_1.0-1_amd64.deb
19
+
20
+ RUN pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple nvidia-cudnn-cu12==9.8.0.87
21
+
22
+ # 6. Install Apex
23
+ RUN git clone https://github.com/NVIDIA/apex.git && \
24
+ cd apex && \
25
+ pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
26
+
27
+ # 7. Install TransformerEngine
28
+ RUN export NVTE_FRAMEWORK=pytorch && pip3 install --no-deps git+https://github.com/NVIDIA/TransformerEngine.git@v2.2
29
+
30
+ # 8. Install Megatron-LM
31
+ RUN pip3 install --no-deps git+https://github.com/NVIDIA/Megatron-LM.git@core_r0.12.0
32
+
33
+ # 9. Fix opencv
34
+ RUN pip install opencv-python
35
+
36
+ RUN pip install opencv-fixer && \
37
+ python -c "from opencv_fixer import AutoFix; AutoFix()"
docker/Dockerfile.vemlp.vllm.te ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # docker buildx build --platform linux/x86_64 -t "verlai/verl:$TAG" -f docker/$FILE .
2
+
3
+ # the one in docker.io is an alias for the one veturbo
4
+ # FROM vemlp-cn-beijing.cr.volces.com/veturbo/pytorch:2.4-cu124
5
+ FROM docker.io/haibinlin/verl:v0.0.5-th2.4.0-cu124-base
6
+
7
+ # only config pip index with https://pypi.tuna.tsinghua.edu.cn/simple if needed
8
+ # unset for now
9
+ RUN pip3 config unset global.index-url
10
+
11
+ # transformers 4.47.0 contains the following bug:
12
+ # AttributeError: 'Gemma2Attention' object has no attribute '_flash_attn_uses_top_left_mask'
13
+ RUN pip3 install --no-cache-dir \
14
+ torch==2.4.0 \
15
+ accelerate \
16
+ codetiming \
17
+ dill \
18
+ hydra-core \
19
+ numpy \
20
+ pybind11 \
21
+ tensordict \
22
+ "transformers <= 4.46.0"
23
+
24
+ RUN pip3 install --no-cache-dir flash-attn==2.7.0.post2 --no-build-isolation
25
+
26
+ # vllm depends on ray
27
+ RUN pip3 install --no-cache-dir vllm==0.6.3 ray==2.10
28
+
29
+ # install apex
30
+ RUN MAX_JOBS=4 pip3 install -v --disable-pip-version-check --no-cache-dir --no-build-isolation \
31
+ --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" \
32
+ git+https://github.com/NVIDIA/apex
33
+
34
+ # install Transformer Engine
35
+ # - flash-attn pinned to 2.5.3 by TransformerEngine, switch to eric-haibin-lin/TransformerEngine.git@v1.7.0 to relax version req
36
+ # - install with: MAX_JOBS=1 NINJA_FLAGS="-j1" TE_BUILD_WITH_NINJA=0 to avoid OOM
37
+ # - cudnn is required by TransformerEngine
38
+ # RUN CUDNN_PATH=/opt/conda/lib/python3.11/site-packages/nvidia/cudnn \
39
+ # pip3 install git+https://github.com/eric-haibin-lin/TransformerEngine.git@v1.7.0
40
+ RUN MAX_JOBS=1 NINJA_FLAGS="-j1" pip3 install flash-attn==2.5.3 --no-cache-dir --no-build-isolation
41
+ RUN MAX_JOBS=1 NINJA_FLAGS="-j1" pip3 install git+https://github.com/NVIDIA/TransformerEngine.git@v1.7
docs/Makefile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line.
5
+ SPHINXOPTS =
6
+ SPHINXBUILD = sphinx-build
7
+ SPHINXPROJ = verl
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
docs/README.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # verl documents
2
+
3
+ ## Build the docs
4
+
5
+ ```bash
6
+ # Install dependencies.
7
+ pip install -r requirements-docs.txt
8
+
9
+ # Build the docs.
10
+ make clean
11
+ make html
12
+ ```
13
+
14
+ ## Open the docs with your browser
15
+
16
+ ```bash
17
+ python -m http.server -d _build/html/
18
+ ```
19
+ Launch your browser and navigate to http://localhost:8000 to view the documentation.
docs/README_vllm0.7.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Upgrading to vllm >= 0.7
2
+
3
+ Note: verl+vllm 0.8.3 is now stable. Please see ``docs/README_vllm0.8.md`` for upgrade guide.
4
+
5
+ ## Installation
6
+
7
+ Note: At time of writing, verl+vllm 0.7.x supports **FSDP** for training and **vLLM** for rollout.
8
+
9
+ ```
10
+ # Create the conda environment
11
+ conda create -n verl python==3.10
12
+ conda activate verl
13
+
14
+ # Install verl
15
+ git clone https://github.com/volcengine/verl.git
16
+ cd verl
17
+ pip3 install -e .
18
+
19
+ # Install the latest stable version of vLLM
20
+ pip3 install vllm==0.7.3
21
+
22
+ # Install flash-attn
23
+ pip3 install flash-attn --no-build-isolation
24
+
25
+ ```
26
+
27
+ Note that if you are installing lower versions of vLLM (0.7.0, 0.7.1, 0.7.2), you need to make some tiny patches manually on vllm (/path/to/site-packages/vllm after installation) after the above steps:
28
+
29
+ - vllm/distributed/parallel_state.py: Remove the assertion below:
30
+
31
+ ```
32
+ if (world_size
33
+ != tensor_model_parallel_size * pipeline_model_parallel_size):
34
+ raise RuntimeError(
35
+ f"world_size ({world_size}) is not equal to "
36
+ f"tensor_model_parallel_size ({tensor_model_parallel_size}) x "
37
+ f"pipeline_model_parallel_size ({pipeline_model_parallel_size})")
38
+
39
+ ```
40
+
41
+ - vllm/executor/uniproc_executor.py: change `local_rank = rank` to `local_rank = int(os.environ["LOCAL_RANK"])`
42
+ - vllm/model_executor/model_loader/weight_utils.py: remove the `torch.cuda.empty_cache()` in `pt_weights_iterator`
43
+
44
+ ## Features
45
+
46
+ ### Use cuda graph
47
+
48
+ After installation, examples using FSDP as training backends can be used. By default, the `enforce_eager` is set to True, which disables the cuda graph. To enjoy cuda graphs and the sleep mode of vLLM>=0.7, add the following lines to the bash script:
49
+
50
+ ```
51
+ actor_rollout_ref.rollout.enforce_eager=False \
52
+ actor_rollout_ref.rollout.free_cache_engine=False \
53
+
54
+ ```
55
+
56
+ For a typical job like examples/ppo_trainer/run_qwen2-7b_seq_balance.sh, the rollout generation time is 115 seconds with vLLM0.6.3, while it is 85 seconds with vLLM0.7.0. By enabling the cudagraph, the generation duration is further reduced to 62 seconds.
57
+
58
+ **Note:** Currently, if the `n` is greater than 1 in `SamplingParams` in vLLM>=0.7, there is a potential performance issue on the stability of rollout generation time (Some iterations would see generation time bursts) using vLLM's V0 Engine.
59
+
60
+ ### Use vLLM V1 Engine
61
+
62
+ Using the vLLM V1 engine can avoid instability issues and achieve additional performance improvements. To use the V1 engine, you can first uninstall the previously installed vLLM and then follow the steps below to install the newer version.
63
+
64
+ ```
65
+ git clone https://github.com/vllm-project/vllm.git
66
+ cd vllm
67
+ git checkout 2275784
68
+ sed -i "903a\ data_parallel_size = world_size // pipeline_model_parallel_size // tensor_model_parallel_size" ./vllm/distributed/parallel_state.py
69
+ VLLM_USE_PRECOMPILED=1 pip install --editable .
70
+ ```
71
+
72
+ Then you can enable the V1 engine by setting `export VLLM_USE_V1=1`. In some benchmark tests, the V1 engine demonstrates a 1.5x speed improvement over the vLLM V0 engine.
73
+ The stable support of the vLLM V1 engine is available on verl main.
docs/README_vllm0.8.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Upgrading to vLLM >= 0.8
2
+
3
+ ## Installation
4
+
5
+ Note: This version of verl+vLLM 0.8+ supports **FSDP** for training and **vLLM** for rollout.
6
+
7
+ ```bash
8
+ # Create the conda environment
9
+ conda create -n verl python==3.10
10
+ conda activate verl
11
+
12
+ # Install verl
13
+ git clone https://github.com/volcengine/verl.git
14
+ cd verl
15
+ pip3 install -e .
16
+
17
+ # Install the latest stable version of vLLM
18
+ pip3 install vllm==0.8.3
19
+
20
+ # Install flash-attn
21
+ pip3 install flash-attn --no-build-isolation
22
+
23
+ ```
24
+
25
+ We have a pre-built docker image for verl+vLLM 0.8.3. You can direct import it with the following command:
26
+
27
+ ```bash
28
+ docker pull hiyouga/verl:ngc-th2.6.0-cu126-vllm0.8.3-flashinfer0.2.2-cxx11abi0
29
+ ```
30
+
31
+ ## Features
32
+
33
+ vLLM 0.8+ supports cuda graph and V1 engine by default in verl. To enable these features, remember to add the following lines to the bash script:
34
+
35
+ ```bash
36
+ actor_rollout_ref.rollout.enforce_eager=False \
37
+ actor_rollout_ref.rollout.free_cache_engine=False \
38
+ ```
39
+
40
+ and also **remove** the environment variable if it exists:
41
+
42
+ ```bash
43
+ # If you are using vllm<=0.6.3, you might need to set the following environment variable to avoid bugs:
44
+ # export VLLM_ATTENTION_BACKEND=XFORMERS
45
+ ```
46
+
47
+ ## Notes
48
+
49
+ When you just directly upgrade vllm>=0.8, some dependency packages may undergo version changes. If you encounter the following problems:
50
+
51
+ ```bash
52
+ 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)
53
+ ```
54
+
55
+ You need to upgrade `tensordict` to version 0.6.2 using the command `pip install tensordict==0.6.2`.
docs/_static/js/runllm-widget.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener("DOMContentLoaded", function () {
2
+ var script = document.createElement("script");
3
+ script.type = "module";
4
+ script.id = "runllm-widget-script";
5
+ script.src = "https://widget.runllm.com";
6
+ script.setAttribute("version", "stable");
7
+ script.setAttribute("crossorigin", "true");
8
+ script.setAttribute("runllm-keyboard-shortcut", "Mod+j");
9
+ script.setAttribute("runllm-name", "verl Chatbot");
10
+ script.setAttribute("runllm-position", "TOP_RIGHT");
11
+ script.setAttribute("runllm-assistant-id", "679");
12
+ script.async = true;
13
+ document.head.appendChild(script);
14
+ });
docs/_static/logo.png ADDED