-
Notifications
You must be signed in to change notification settings - Fork 62
Configurable sampling parameter for generator #550
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
Configurable sampling parameter for generator #550
Conversation
Add optional n parameter to Generator.generate() to allow overriding the default sampling_params.n on a per-request basis. Update GRPO rollout to explicitly request n=1 for single trajectory generation.
Updated the logic for modifying the sampling_params.n attribute to use the __replace__ method for better clarity and consistency. Added a new unit test to verify the behavior of the n parameter logic in the Generator class.
|
Hi @gitlost-murali! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Hi @daniellepintz / @felipemello1 / @joecummings Any update on this MR? Do I need to change something in the MR or what are your thoughts on this MR? My overall goal is to integrate multi-turn rollouts. A first step into it would be enable generator have |
|
hey @gitlost-murali , thanks for the PR! I think we can change the API a bit. My understanding is that you want to be able to set the What if we do this instead: you would just need to make sure that the logic in |
|
regarding multiturn, i just put this PR up. Its WIP, but i am hoping to have a working recipe by early next week #567 |
Allows per-request override of any sampling parameter (temperature, top_p, n, etc.) instead of just n. Preserves output_kind=FINAL_ONLY enforcement from post_init logic.
Add test to ensure Generator always overrides output_kind to FINAL_ONLY when initialized with custom sampling_params dict, protecting against accidental removal of this system requirement.
|
Thanks! I updated the code to enable passing custom Amazing! Just read the RFC. Let me know if I can contribute somehow to multi-turn rollouts |
Co-authored-by: Felipe Mello <fmellomascarenhas@gmail.com>
felipemello1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Will merge after CI is green
|
There was a linting issue earlier. Sorry about that |
|
no worries. You might need to handle all the linter issues |
Generatorclass insrc/forge/actors/generator.pynow takes the number of completions (n) to be specified per request, instead of always using the default from the generator's sampling parameters.Generator request flexibility and parameter handling
generatemethod inGeneratornow accepts an optionalnparameter, allowing callers to specify the number of completions to generate per request. Ifnis not provided, the default fromself.sampling_params.nis used.generatecreates modified sampling parameters ifnis overridden, ensuring all downstream code uses the correct value fornand related settings. This includes passing the updated parameters to tokenization, request processing, and child request creation.Unit testing
test_generate_n_parameter_logicto verify that parameter overriding works as expected, including object identity checks and value assertions.Note: This feature is useful when we extend to multi-turn rollouts where we'd generate the first turn for all K rollouts (default n=K). Later, each rollout would branch out differently - making a dedicated generate call for each turn (using generate.route(n=1))