feature(sunjx): implement dynamic sampling strategy in DAPO#40
Closed
Jiaxuan-Sun wants to merge 3 commits intoopendilab:mainfrom
Closed
feature(sunjx): implement dynamic sampling strategy in DAPO#40Jiaxuan-Sun wants to merge 3 commits intoopendilab:mainfrom
Jiaxuan-Sun wants to merge 3 commits intoopendilab:mainfrom
Conversation
PaParaZz1
requested changes
Mar 6, 2026
| if "accuracy" in exp.info: | ||
| metric_values = exp.info["accuracy"] | ||
| else: | ||
| # Fallback: treat reward as binary accuracy |
Member
There was a problem hiding this comment.
raise RuntimeError here, not use fallback
| f"Warning: Dynamic sampling needs more batches, but current implementation " | ||
| f"processes one batch at a time. Proceeding with {num_valid_prompts} valid prompts." | ||
| ) | ||
| break |
Member
There was a problem hiding this comment.
If you add break here, this while loop is not necessary, maybe you can omit it. Maybe you should set continue in the for loop. Only in the case that num_valid_prompts >= target_num_prompts, the following code should be executed
Member
There was a problem hiding this comment.
I think there are bugs in you previous experiment, the current implementation can not accumulate enough data for training when dynamic_sampling is enabled.
| output = self.tokenizer.batch_decode( | ||
| experience.sequences[0].unsqueeze(0), skip_special_tokens=True | ||
| ) | ||
| self.strategy.print("collect phase: experience.sequences w skip_special_tokens: ", output) |
| @@ -369,30 +369,85 @@ def fit( | |||
| f"rand_prompts:\n {rand_prompts}\n , rand_images:{rand_images}\n , rand_references:{rand_references}\n, rand_labels:{rand_labels}\n " # noqa | |||
Member
There was a problem hiding this comment.
you should also add the similar implementation in ppo_trainer.py
Collaborator
|
We have a new PR: #51 |
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.
Implement Dynamic Sampling (DAPO) for GRPO Training
This PR implements the dynamic sampling strategy from DAPO (Decoupled Clip and Dynamic Sampling Policy Optimization) to improve GRPO training efficiency.
Key Features