-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Align GRPO and RLOO initialization #4685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
| from datasets import load_dataset | ||
| from trl import RLOOTrainer | ||
| from trl.rewards import accuracy_reward | ||
| dataset = load_dataset("trl-lib/tldr", split="train") | ||
| def reward_func(completions, **kwargs): | ||
| # Dummy reward function that rewards completions with more unique letters. | ||
| return [float(len(set(completion))) for completion in completions] | ||
| dataset = load_dataset("trl-lib/DeepMath-103K", split="train") | ||
| trainer = RLOOTrainer( | ||
| model="Qwen/Qwen2-0.5B-Instruct", | ||
| reward_funcs=reward_func, | ||
| reward_funcs=accuracy_reward, | ||
| train_dataset=dataset, | ||
| ) | ||
| trainer.train() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #4524
| model_name = model_name.split("/")[-1] | ||
| args = RLOOConfig(f"{model_name}-RLOO") | ||
|
|
||
| # Models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all other changes come from #4577
GRPO recently benefited from some improvements in initialization that were not applied to RLOO. This PR aligns the two initializations.