Skip to content

refactor(async_rollout_worker): renamed tool variables to mirror grpo_trainer.py#5332

Merged
qgallouedec merged 1 commit into
huggingface:mainfrom
casinca:async-grpo-refactor
Mar 21, 2026
Merged

refactor(async_rollout_worker): renamed tool variables to mirror grpo_trainer.py#5332
qgallouedec merged 1 commit into
huggingface:mainfrom
casinca:async-grpo-refactor

Conversation

@casinca

@casinca casinca commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This is a small refactor following @qgallouedec #5330 (comment) in my previous PR.

To harmonize async_rollout_worker.py with grpo_trainer.py tool variables:

_build_messages_suffix_ids → _get_tool_suffix_ids
messages → tool_messages
template_messages → dummy_messages
prefix_and_messages_ids → full_ids
tool_suffix_ids → suffix_ids

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.


Note

Low Risk
Pure refactor limited to tool-message suffix tokenization and variable renames; behavior should be unchanged but could affect tool-call prompting if the suffix slicing logic is accidentally altered.

Overview
Refactors AsyncRolloutWorker tool-call handling to mirror grpo_trainer.py naming and structure.

Renames _build_messages_suffix_ids to _get_tool_suffix_ids and consistently renames related locals (messagestool_messages, template_messagesdummy_messages, prefix_and_messages_idsfull_ids, tool_suffix_idssuffix_ids) while keeping the same suffix-ID computation and call site in _generate_one.

Written by Cursor Bugbot for commit 0da28b1. This will update automatically on new commits. Configure here.

@qgallouedec qgallouedec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@qgallouedec qgallouedec merged commit e923a9a into huggingface:main Mar 21, 2026
4 checks passed
@casinca casinca deleted the async-grpo-refactor branch March 22, 2026 16:59
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 this pull request may close these issues.

3 participants