Support setting dist_timeout for prepare_hidden_states.py#96
Support setting dist_timeout for prepare_hidden_states.py#96sleepcoo merged 5 commits intosgl-project:mainfrom
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @guoyuhong, 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!
I've addressed a common issue encountered when "prepare_hidden_states.py" processes large datasets, where the default NCCL barrier timeout would frequently cause errors. My change allows the "dist_timeout" parameter to be explicitly set for the distributed process group, preventing these timeouts and ensuring large dataset processing completes successfully.
Highlights
- Timeout Configuration: Enabled explicit configuration of the "torch.distributed.init_process_group" timeout in "prepare_hidden_states.py".
- Large Dataset Reliability: Resolved barrier timeout errors during large dataset processing by leveraging the new timeout setting, improving the script's robustness.
- Parameter Alignment: Integrated "args.dist_timeout" (expected in seconds) from "sglang.srt.server_args.ServerArgs" to control the distributed timeout.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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 or fill out our survey to provide feedback.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request addresses a barrier timeout issue during large dataset processing by enabling configuration of dist_timeout in prepare_hidden_states.py. The implementation correctly utilizes the existing --dist-timeout argument from ServerArgs. My feedback focuses on improving maintainability and robustness: I've suggested making the comment about dist_timeout more explicit regarding its unit (seconds) to avoid confusion, and recommended adding validation to ensure the timeout value is positive, preventing potential runtime issues.
Motivation
Problem: Barrier Timeout in Large Dataset Processing
When processing large datasets with

prepare_hidden_states.py, the default NCCL barrier timeout frequently triggers the following error:Modifications
Solution: Align Timeout with SGLang's Configuration
Since

sglang.srt.server_args.ServerArgsalready defines--dist-timeout(in seconds), we avoided redundant definitions by reusing this existing parameter ininit_process_group. However,--dist-timeoutintrain_eagle3_offline.py&train_eagle3_online.pyis in minutes.After the fix, large date set works fine:
Related Issues
Accuracy Test
Benchmark & Profiling
Checklist