Add GRPO and Support RLVR for PPO (#6186)

* add grpo, support rlvr

* add grpo, support rlvr

* tested deepseek r1 pipeline

* add ci

* verify grpo r1

* verify grpo r1

* update readme, remove unused code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove path

* clean code

* fix circular import

* fix ci OOM

* fix ci OOM

* skip kto tp, fix qwen generation

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
YeAnbang
2025-02-18 09:43:36 +08:00
committed by GitHub
parent ce0ec40811
commit d20c8ffd97
39 changed files with 1995 additions and 277 deletions

View File

@@ -12,6 +12,27 @@ from torch.utils.data import DataLoader
from colossalai.booster import Plugin
class AnnealingScheduler:
def __init__(self, start, end, warmup_steps=100, annealing_step=2000):
self.start = start
self.end = end
self.warmup_steps = warmup_steps
self.step = 0
self.annealing_step = annealing_step
def get_temperature(self):
if self.step <= self.warmup_steps:
return self.start # Stop annealing after warm-up steps
elif self.step >= self.annealing_step:
return self.end
# Linear annealing
temp = self.start - (self.step / self.annealing_step) * (self.start - self.end)
return temp
def step_forward(self):
self.step += 1
class CycledDataLoader:
"""
A data loader that cycles through the data when it reaches the end.