Skip to content
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

Add endpoint for file support, purely to speed up processing of input_embeds. #2797

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

RinRin-32
Copy link
Contributor

@RinRin-32 RinRin-32 commented Jan 8, 2025

Motivation

While input_embeds is now supported, I find that for what I'm using it for, normally requesting through /generate wasn't enough. I was spending around 2.5 seconds on average until the request was even handled in tokenizer manager. With this in mind, I suspect that the main issue came around possible overhead and such. To overcome said issue, I figured sending said input_embeds as a file likely would reduce the issue, doing so I managed to shaved off around 2 seconds from my use case.

Please contribute or comment your idea of a proper unit test for this application.

Modifications

Added endpoint in server.py to handle direct file transfer.

Checklist

  • Format your code according to the Contributor Guide.
  • Add unit tests as outlined in the Contributor Guide.
  • Update documentation as needed, including docstrings or example tutorials.

Copy link
Contributor

@merrymercy merrymercy left a comment

Choose a reason for hiding this comment

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

python/sglang/srt/server.py Outdated Show resolved Hide resolved
@RinRin-32
Copy link
Contributor Author

@merrymercy
My use case with this right now is to serve our LLM based service.

It's based on Gemma 2 2b where I launch it with the following

python -m sglang.launch_server --model-path <model-path> --port 30000 --disable-radix --disable-cuda-graph-padding --disable-jump-forward --disable-mla

While it's faster with the new endpoint I can't quit get it as close as how the model can perform on simple implementation. Is there's anything else I can do to get faster response? Perhaps there's something I overlooked while making the changes in this PR, I'm especially curious about whether fastapi implementation made in sglang can be improved.

@RinRin-32 RinRin-32 requested a review from merrymercy January 22, 2025 08:58
@RinRin-32
Copy link
Contributor Author

I skipped checking for param from file name because using the overlap scheduler the sampling params are ignored anyway.

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