Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
|
||
| # ---- Shuffle (deferred from produce()) ---- | ||
| shuffled = shuffle_sequence_dict(data) | ||
| dataset._data = shuffled |
There was a problem hiding this comment.
Deferred scoring path missing generation and completion metrics
Medium Severity
_compute_deferred_scores logs reward metrics but omits all generation metrics: num_input_tokens_seen, completions/mean_length, completions/clipped_ratio, completions/mean_terminated_length, IS sampling stats, and self._logs for completion logging. The _generate method skips these on background threads, and the streaming path _compute_streaming_group_scores logs them in its is_last_chunk block — but the non-streaming deferred path never recovers them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What does this PR do?
companion PR to huggingface/transformers#44259
we may have to require transformers>v5.3.0, depending on when the companion transformers PR is merged.
alongside #5249, there are significant speedups from this.
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
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
High Risk
Refactors GRPO’s core online rollout/training flow to use transformers
DataProducerwith background-thread prefetch and optional streaming scoring, which is concurrency- and training-correctness sensitive (staleness, synchronization, metrics/state updates). Changes also affect vLLM weight syncing and importance-sampling application paths.Overview
Adds an optional transformers
DataProducer-based rollout pipeline forGRPOTrainer, enabling async rollout prefetching and an optional streaming partial-batch mode that incrementally scores prompt groups and yields micro-batches to overlap reward computation with policy logprob scoring.Introduces
GRPODataProducer/RolloutDatasetand updatesGRPOTrainerto create/wire the producer, handle deferred scoring when rollouts are produced on a background thread (including vLLM sync scheduling viavllm_sync_interval), and bypass the legacy_prepare_inputsbuffering path when the producer is enabled. Adds new config flags (use_data_producer,async_prefetch,prefetch_depth,streaming_partial_batch,streaming_min_groups,vllm_sync_interval) and tightens loss application to only useimportance_sampling_ratiowhen present.Written by Cursor Bugbot for commit 91388df. This will update automatically on new commits. Configure here.