| # DSGRPO |
|
|
| This repository contains the DSGRPO training setup built on top of `maxrl`/`verl`. |
| The git repository intentionally does not track model weights, parquet datasets, |
| logs, or checkpoints. Prepare those files under `assets/` on each machine. |
|
|
| ## Repository Layout |
|
|
| ```text |
| DSGRPO/ |
| maxrl/ # training code |
| train_qwen2.5_1.5b_math.sh # 1.5B DSGRPO Slurm job |
| train_qwen2.5_7b_math.sh # 7B DSGRPO Slurm job |
| launch.sh # batch launch helper |
| slurm_reference.sh # local Slurm reference |
| assets/ # local-only models and parquet data, not in git |
| ``` |
|
|
| The training scripts infer `REPO_ROOT` from their own location, so the clone path |
| does not need to be `/home/guanninz/DSGRPO`. |
|
|
| ## 1. Clone |
|
|
| ```bash |
| git clone git@github.com:guanning03/DSGRPO.git |
| cd DSGRPO |
| ``` |
|
|
| ## 2. Create the Python Environment |
|
|
| The Slurm scripts activate a conda environment named `more`. Either create that |
| environment or edit the scripts to use a different env name. |
|
|
| ```bash |
| conda create -n more python=3.10 -y |
| conda activate more |
| |
| pip install --upgrade pip setuptools wheel |
| pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu124 |
| |
| pip install ninja packaging psutil |
| MAX_JOBS=4 pip install flash-attn --no-build-isolation |
| |
| pip install vllm==0.8.4 wandb math-verify huggingface_hub hf_transfer |
| pip install -r maxrl/requirements_sglang.txt |
| pip install -e maxrl |
| ``` |
|
|
| If `flash-attn` fails to build, run the install on a GPU node with the target CUDA |
| toolkit available, lower `MAX_JOBS`, or use a matching prebuilt wheel. |
|
|
| Optional sanity check: |
|
|
| ```bash |
| python - <<'PY' |
| import torch, ray, vllm, verl |
| print("torch", torch.__version__) |
| print("cuda", torch.version.cuda) |
| print("ray", ray.__version__) |
| print("vllm", vllm.__version__) |
| print("verl import ok") |
| PY |
| ``` |
|
|
| ## 3. Prepare Assets |
|
|
| Required for the included jobs: |
|
|
| ```text |
| assets/Qwen2.5-Math-1.5B/config.json |
| assets/Qwen2.5-Math-1.5B/model.safetensors |
| assets/Qwen2.5-Math-7B/config.json |
| assets/Qwen2.5-Math-7B/model-00001-of-00004.safetensors |
| assets/dapo17k_math/train.parquet |
| ``` |
|
|
| Recommended validation files: |
|
|
| ```text |
| assets/math500/test.parquet |
| assets/aime24/test.parquet |
| assets/aime25/test.parquet |
| assets/olympiadbench/test.parquet |
| assets/amc23/test.parquet |
| ``` |
|
|
| The training scripts will use every validation file that exists and will skip |
| missing ones. At least one validation parquet file must exist. |
|
|
| Fastest setup if a working machine already has the assets: |
|
|
| ```bash |
| mkdir -p assets |
| rsync -av --info=progress2 OLD_SERVER:/home/guanninz/DSGRPO/assets/ ./assets/ |
| ``` |
|
|
| Independent model download: |
|
|
| ```bash |
| export HF_HUB_ENABLE_HF_TRANSFER=1 |
| huggingface-cli login |
| |
| huggingface-cli download Qwen/Qwen2.5-Math-1.5B \ |
| --local-dir assets/Qwen2.5-Math-1.5B \ |
| --local-dir-use-symlinks False |
| |
| huggingface-cli download Qwen/Qwen2.5-Math-7B \ |
| --local-dir assets/Qwen2.5-Math-7B \ |
| --local-dir-use-symlinks False |
| ``` |
|
|
| Independent dataset build: |
|
|
| ```bash |
| PYTHONPATH=$PWD/maxrl python maxrl/examples/data_preprocess/dapo.py \ |
| --local_dir assets/dapo17k_math |
| |
| PYTHONPATH=$PWD/maxrl python maxrl/examples/maxrl_data_preprocess/math_500.py \ |
| --local_dir assets/math500 |
| |
| PYTHONPATH=$PWD/maxrl python maxrl/examples/maxrl_data_preprocess/aime25.py \ |
| --local_dir assets/aime25 |
| |
| PYTHONPATH=$PWD/maxrl python maxrl/examples/maxrl_data_preprocess/olympiadbench_amc23.py \ |
| --local_dir assets |
| ``` |
|
|
| For exact reproduction of the current local assets, prefer `rsync` because it |
| also copies `aime24`, `gsm8k`, `polaris`, `openr1`, and other optional parquets. |
|
|
| Asset check: |
|
|
| ```bash |
| test -f assets/Qwen2.5-Math-1.5B/config.json |
| test -f assets/Qwen2.5-Math-7B/config.json |
| test -f assets/dapo17k_math/train.parquet |
| find assets -maxdepth 2 -name 'test.parquet' -print |
| ``` |
|
|
| ## 4. Configure Slurm |
|
|
| The two training scripts currently request: |
|
|
| ```text |
| partition: defq |
| account: ece-research |
| nodes: 1 |
| gpus: 4 |
| cpus: 64 |
| mem: 500G |
| time: 48:00:00 |
| ``` |
|
|
| On another cluster, edit the `#SBATCH` header in: |
|
|
| ```text |
| train_qwen2.5_1.5b_math.sh |
| train_qwen2.5_7b_math.sh |
| ``` |
|
|
| Adjust `--partition`, `--account`, `--gres`, `--cpus-per-task`, and `--mem` to |
| match that cluster. The Python arguments below the header are path-independent. |
|
|
| Use Slurm's dry run before submitting: |
|
|
| ```bash |
| sbatch --test-only train_qwen2.5_1.5b_math.sh 101 0.05 0.05 |
| sbatch --test-only train_qwen2.5_7b_math.sh 101 0.05 0.05 |
| ``` |
|
|
| ## 5. Submit Training |
|
|
| Arguments are: |
|
|
| ```text |
| sbatch SCRIPT DATA_SEED CORRECT_SAMPLE_LOG_PROB_COEF INCORRECT_SAMPLE_LOG_PROB_COEF |
| ``` |
|
|
| Run DSGRPO smoothing with both coefficients set to `0.05`: |
|
|
| ```bash |
| sbatch train_qwen2.5_1.5b_math.sh 101 0.05 0.05 |
| sbatch train_qwen2.5_7b_math.sh 101 0.05 0.05 |
| ``` |
|
|
| Run the full local sweep in `launch.sh`: |
|
|
| ```bash |
| bash launch.sh |
| ``` |
|
|
| Monitor: |
|
|
| ```bash |
| squeue -u $USER |
| tail -f logs/<jobid>_<jobname>.log |
| ``` |
|
|
| Outputs: |
|
|
| ```text |
| logs/ |
| checkpoints/qwen2.5-1.5b-math-dsgrpo-dapo17k/ |
| checkpoints/qwen2.5-7b-math-dsgrpo-dapo17k/ |
| ``` |
|
|
| ## Codex Handoff Prompt |
|
|
| After cloning this repository on a new server, a concise prompt for another Codex: |
|
|
| ```text |
| Please follow README.md to set up this DSGRPO repo on this server. Create/verify |
| the conda env named "more", install dependencies, prepare assets under ./assets, |
| run the asset checks, run sbatch --test-only on both training scripts, and tell |
| me the exact sbatch commands to launch 1.5B and 7B DSGRPO with coefficients |
| 0.05 and 0.05. |
| ``` |
|
|
|
|