Wait for vLLM update_weight RPCs before unpausing actors in weight sync#1480
Wait for vLLM update_weight RPCs before unpausing actors in weight sync#1480hamishivi merged 4 commits intoallenai:mainallenai/open-instruct:mainfrom MohdElgaar:fix/vllm-update-weight-before-unpauseMohdElgaar/open-instruct:fix/vllm-update-weight-before-unpauseCopy head branch name to clipboard
Conversation
Summary of ChangesHello @MohdElgaar, 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 synchronization issue where the main thread could hang during health checks because vLLM engines were still processing queued weight updates. The change ensures that all vLLM Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
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.
Code Review
This pull request addresses a potential deadlock in the weight synchronization thread by ensuring all vLLM update_weight RPCs are completed before actors are unpaused. The fix involves collecting all ObjectRefs from the weight broadcast results and explicitly waiting for them to finish. The logic is sound and correctly resolves the described issue. I've added one minor suggestion to improve code conciseness.
|
Note: this is only when open-instruct/open_instruct/vllm_utils.py Lines 810 to 817 in c4b10fc |
08f3505 to
a8933de
Compare
hamishivi
left a comment
There was a problem hiding this comment.
Thank you so much for the PR! LGTM!
…ht sync In some instances, should_stop was set to False before all vLLM engine update_weight RPCs had completed. As a result: - vLLM engine(s) never complete the update_weight tasks - check_background_threads.remote() could not be processed - Main thread blocked indefinitely in health_check_fn() Fix: Wait for all engine.update_weight ObjectRefs (returned by broadcast_to_vllm) to complete before calling set_should_stop(False). This guarantees vLLM engines are idle before the health check runs check_background_threads.
|
@MohdElgaar if you add to the changelog and fix the quality checks I'm happy to merge! |
Add CHANGELOG.md entry for PR allenai#1480 and apply ruff format to grpo_fast.py to pass CI checks. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…nc (#1480) * fix: wait for vLLM update_weight RPCs before unpausing actors in weight sync In some instances, should_stop was set to False before all vLLM engine update_weight RPCs had completed. As a result: - vLLM engine(s) never complete the update_weight tasks - check_background_threads.remote() could not be processed - Main thread blocked indefinitely in health_check_fn() Fix: Wait for all engine.update_weight ObjectRefs (returned by broadcast_to_vllm) to complete before calling set_should_stop(False). This guarantees vLLM engines are idle before the health check runs check_background_threads. * fix: add changelog entry and fix ruff formatting Add CHANGELOG.md entry for PR #1480 and apply ruff format to grpo_fast.py to pass CI checks. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Hamish Ivison <hamishivi@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
The main thread could hang in
health_check_fn()oncheck_background_threads.remote()becauseshould_stopwas set to False before all vLLMupdate_weightRPCs finished. vLLM engines stayed busy with queued updates and never processed the health check.Fix: Wait for all
engine.update_weightObjectRefs returned bybroadcast_to_vllm()to complete before callingset_should_stop(False), so vLLM engines are idle before the health check runs.