Skip to content

Support setting dist_timeout for prepare_hidden_states.py#96

Merged
sleepcoo merged 5 commits intosgl-project:mainfrom
guoyuhong:fix_timeout
Jul 31, 2025
Merged

Support setting dist_timeout for prepare_hidden_states.py#96
sleepcoo merged 5 commits intosgl-project:mainfrom
guoyuhong:fix_timeout

Conversation

@guoyuhong
Copy link
Contributor

@guoyuhong guoyuhong commented Jul 31, 2025

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:
image

Modifications

Solution: Align Timeout with SGLang's Configuration​​

Since sglang.srt.server_args.ServerArgs already defines --dist-timeout (in seconds), we avoided redundant definitions by ​​reusing this existing parameter​​ in init_process_group. However, --dist-timeout in train_eagle3_offline.py & train_eagle3_online.py is in minutes.
After the fix, large date set works fine:
image

Related Issues

Accuracy Test

Benchmark & Profiling

Checklist

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 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.

@sleepcoo sleepcoo merged commit a56fa04 into sgl-project:main Jul 31, 2025
1 check passed
@guoyuhong guoyuhong deleted the fix_timeout branch July 31, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants