Skip to content
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

GRPO #2625

Closed
Tracked by #2617
qgallouedec opened this issue Jan 23, 2025 · 1 comment · Fixed by #2647
Closed
Tracked by #2617

GRPO #2625

qgallouedec opened this issue Jan 23, 2025 · 1 comment · Fixed by #2647
Assignees

Comments

@qgallouedec
Copy link
Member

No description provided.

@qgallouedec
Copy link
Member Author

from datasets import load_dataset
from trl import GRPOConfig, GRPOTrainer

batch_size = 4
gradient_accumulation_steps = 2
output_dir = f"GRPO-bsz{batch_size}-grad_acc{gradient_accumulation_steps}-fixed"

training_args = GRPOConfig(
    output_dir=output_dir,
    per_device_train_batch_size=batch_size,
    gradient_accumulation_steps=gradient_accumulation_steps,
    logging_steps=2,
)

dummy_dataset = load_dataset("trl-internal-testing/zen", "standard_prompt_only")

def reward_len(prompts, completions):
    return [len(completion) for completion in completions]

trainer = GRPOTrainer(
    model="trl-internal-testing/tiny-Qwen2ForCausalLM-2.5",
    reward_funcs=reward_len,
    args=training_args,
    train_dataset=dummy_dataset["train"],
)

trainer.train()

Image

@qgallouedec qgallouedec linked a pull request Jan 24, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant