Skip to content

Conversation

@yeahdongcn
Copy link

Motivation

When running examples/runtime/engine/launch_engine.py on the musa platform, I encountered the following error:

Loading safetensors checkpoint shards:   0% Completed | 0/4 [00:00<?, ?it/s]
Loading safetensors checkpoint shards:  25% Completed | 1/4 [00:00<00:01,  2.06it/s]
Loading safetensors checkpoint shards:  50% Completed | 2/4 [00:00<00:00,  2.18it/s]
Loading safetensors checkpoint shards:  75% Completed | 3/4 [00:01<00:00,  3.19it/s]
Loading safetensors checkpoint shards: 100% Completed | 4/4 [00:01<00:00,  3.63it/s]
Loading safetensors checkpoint shards: 100% Completed | 4/4 [00:01<00:00,  3.12it/s]

Capturing batches (bs=1 avail_mem=3.99 GB): 100%|████████████████████████████| 23/23 [01:32<00:00,  4.04s/it]
Traceback (most recent call last):
  File "/ws/examples/runtime/engine/launch_engine.py", line 17, in <module>
    # The __main__ condition is necessary here because we use "spawn" to create subprocesses
  File "/ws/examples/runtime/engine/launch_engine.py", line 10, in main
    trust_remote_code=True,
  File "/ws/python/sglang/srt/entrypoints/engine.py", line 204, in generate
    loop = asyncio.get_event_loop()
  File "/usr/local/lib/python3.10/dist-packages/uvloop/__init__.py", line 206, in get_event_loop
    raise RuntimeError(
RuntimeError: There is no current event loop in thread 'MainThread'.

It turned out to be an issue related to uvloop: MagicStack/uvloop#702

Modifications

Pin uvloop to 0.21.0.

Accuracy Tests

N/A

Benchmarking and Profiling

N/A

Checklist

Signed-off-by: Xiaodong Ye <[email protected]>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yeahdongcn, 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 addresses a RuntimeError related to the uvloop library, specifically "There is no current event loop in thread 'MainThread'", which occurred during the execution of an example script on the musa platform. The fix involves explicitly setting the uvloop dependency to version 0.21.0 in the project's dependency configuration files, ensuring stability and preventing the reported event loop issue.

Highlights

  • Dependency Pinning: Pinning the uvloop dependency to version 0.21.0 across all pyproject.toml files to resolve a RuntimeError encountered when running examples/runtime/engine/launch_engine.py on the musa platform.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. 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

  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 correctly pins uvloop to version 0.21.0 to resolve a runtime error, as described. The change is applied consistently across all relevant pyproject.toml configuration files. I've added one comment regarding dependency management that could improve long-term maintainability, but it's a suggestion for future work and doesn't block this important fix.

"transformers==4.57.1",
"uvicorn",
"uvloop",
"uvloop==0.21.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While pinning uvloop here and in the other pyproject*.toml files correctly fixes the issue, I've noticed that many dependencies are duplicated across pyproject.toml, pyproject_cpu.toml, and pyproject_xpu.toml. This increases maintenance overhead, as any dependency update needs to be manually synchronized across multiple files (as was done in this PR).

To improve maintainability, I suggest refactoring to centralize the common dependencies. The approach in pyproject_other.toml, which uses a [project.optional-dependencies].runtime_common group, is a good example of how this could be structured. Adopting a similar pattern for all configurations would make dependency management much easier.

This is a suggestion for a future improvement and does not need to be addressed in this PR.

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.

1 participant