-
Notifications
You must be signed in to change notification settings - Fork 453
fix idx issue #1082
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
base: main
Are you sure you want to change the base?
fix idx issue #1082
Conversation
Summary of ChangesHello @saurabh111233212, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical 'idx' error that manifested when 'allow_world_padding' was set to 'True' in 'grpo_fast.py'. The issue stemmed from an inconsistency in data padding, where 'vllm_logprobs' were not being padded alongside other sequence components. The fix introduces dummy 'vllm_logprob' entries, filled with NaN values, to ensure all data structures maintain consistent lengths during the padding process, thereby preventing index out-of-bounds exceptions during data collation. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request correctly fixes an IndexError that occurs when allow_world_padding is enabled. The issue was caused by missing padding for vllm_logprobs when creating dummy sequences. The fix adds the necessary padding for packed_sequences.vllm_logprobs, ensuring its length is consistent with other padded sequence data. The change is minimal, targeted, and effectively resolves the bug. The code looks good.
|
@gemini-code-assist is there a way we can make this code unit testable that would let us reproduce the bug in a unit test? |
|
That's an excellent question! Reproducing bugs with unit tests is a best practice for ensuring code stability and preventing regressions. For this specific Here's a general approach you could take:
This approach would allow you to confirm that the padding inconsistency is resolved and that subsequent calculations gracefully handle the padded |
If you don't have this, you'll get a idx error during this line (2006 of grpo_fast.py):
collated_vllm_logprobs.append( collate_fn([per_device_packed_vllm_logprobs[idx] for idx in micro_range], 0) )this only can occur when you set
allow_world_padding Trueexample job of the error here
after the fix: job is here