-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
switch to aiohttp post request mode #2273
Conversation
Thanks for the contribution!
|
607a762
to
cd1a262
Compare
Both 1/2 are done. |
cd1a262
to
cbbd682
Compare
fastchat/serve/openai_api_server.py
Outdated
@@ -11,6 +11,7 @@ | |||
import argparse | |||
import json | |||
import logging | |||
import httpx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this still required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found one remaining usage of httpx. Should this be updated?
https://github.com/lm-sys/FastChat/blob/cbbd682692f98118574f3f463d617c3515301a86/fastchat/serve/openai_api_server.py#L580
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found one remaining usage of httpx. Should this be updated?
Here httpx is used as stream, which is a different usage with other place.
I am not sure which aiohttp api should be used here, and how to verify it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. httpx is not a built-in library. Please move it to the second block of import statements.
fastchat/serve/openai_api_server.py
Outdated
@@ -19,7 +20,7 @@ | |||
from fastapi.middleware.cors import CORSMiddleware | |||
from fastapi.responses import StreamingResponse, JSONResponse | |||
from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBearer | |||
import httpx | |||
import aiohttp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Sort the packages alphabetically
- Declare this dependency in
pyproject.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Sort the packages alphabetically
- Declare this dependency in
pyproject.toml
Done
Do you have any performance numbers? |
cbbd682
to
1d56fbe
Compare
Hi, please see the performance data below.
|
Signed-off-by: Lei Wen <[email protected]>
1d56fbe
to
ea56849
Compare
@leiwen83 Thanks! It is merged |
Why are these changes needed?
httpx performance is very poor in fastapi. use aiohttp is much better
Related issue number (if applicable)
#2256
Checks
format.sh
to lint the changes in this PR.