Skip to content

GPRO: Expand log_completions logic or update docs #2948

@nopepper

Description

@nopepper

Feature request

Currently, the GRPOConfig docstring for log_completions is:

log_completions (bool, optional, defaults to False) — Whether to log the completions during training.

Which is a bit misleading, given that these are only logged when Weights and Biases is active.

Suggestion 1: Change the docs:

log_completions (bool, optional, defaults to False) — If True, will try to log generated (prompt, completion) pairs to wandb, if it's available.

Suggestion 2: Log to wandb if possible, but also log to console. Since rich is a requirement, it could be a rich table:

from rich.console import Console
from rich.panel import Panel
from rich.table import Table
from rich.text import Text

def print_output_sample(prompts: list[str], completions: list[str]):
    """Print out a sample of model completions."""
    console = Console()
    table = Table(show_header=True, header_style="bold white", expand=True, padding=(0, 1, 1, 0))
    table.add_column("Prompt", style="bright_yellow")
    for s, p in zip(source, prediction, strict=True):
        table.add_row(Text(s), Text(p))
    panel = Panel(table, expand=False, title="Output Sample", border_style="bold white")
    console.print(panel)

In that case, it may be useful to let log_completions be an int to specify a custom interval and avoid the console being spammed.

Motivation

It's only right

Your contribution

See suggestions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions