-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
API server支持更好的并发 #1018
API server支持更好的并发 #1018
Conversation
参考 #808 使用pydantic定义请求/相应结构. |
WEB API 使用pydantic定义输入和输出结构后,可以支持chat_stream模式吗? |
这个PR并不能实现真正意义上的单卡并发,多请求排队可能都有问题,所以直接关了。 CHAT_STREAM的话,需要换一下thread pool的执行方式,单个session的流反馈用同步方式来执行。 多卡反而比较好搞,FASTAPI本身是支持多worker模式的,根据卡的数量开worker,注意一下worker初始化阶段通过CUDA_VISABLE_DEVICE或者类似的方式控制一下就可以了。 |
|
“需要换一下thread pool的执行方式,单个session的流反馈用同步方式来执行”这个实例代码是不是可以参考这个“通过ThreadPoolExecutor异步执行model.chat |
还有一个问题请教,FASTAPI本身是支**持多worker模式的,根据卡的数量开worker,注意一下worker初始化阶段通过CUDA_VISABLE_DEVICE或者类似的方式控制一下就可以了。**这个有示例吗?怎么设置比较合理? |
2 similar comments
还有一个问题请教,FASTAPI本身是支**持多worker模式的,根据卡的数量开worker,注意一下worker初始化阶段通过CUDA_VISABLE_DEVICE或者类似的方式控制一下就可以了。**这个有示例吗?怎么设置比较合理? |
还有一个问题请教,FASTAPI本身是支**持多worker模式的,根据卡的数量开worker,注意一下worker初始化阶段通过CUDA_VISABLE_DEVICE或者类似的方式控制一下就可以了。**这个有示例吗?怎么设置比较合理? |
看了一下fastapi/uvicorn的文档,因为没有简单的方法传递workerid信息,
就不能方便的去绑定对应的GPU,看起来也不是很方便。还是前置一个HTTP Server
做负载均衡,根据对应GPU个数,启动worker来的更直接一些吧。
…On Sat, May 27, 2023 at 11:18 PM hellocxj ***@***.***> wrote:
还有一个问题请教,FASTAPI本身是支**持多worker模式的,根据卡的数量开worker,注意一下worker初始化阶段通过CUDA_VISABLE_DEVICE或者类似的方式控制一下就可以了。**这个有示例吗?怎么设置比较合理?
—
Reply to this email directly, view it on GitHub
<#1018 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAY5FYUMCI4RIH7KW22PDXIILKRANCNFSM6AAAAAAYBHMFDA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
请问一下这个问题有解决方案吗?我也遇到了类似的问题,在sse流式输出的时候同步执行时,问题会串到不同人的问题中,从而出现ASGI application的报错,请问一下能否实现stream下不相互干扰的多并发?谢谢! |
请问一下您解决这个问题了吗?感谢! |
通过ThreadPoolExecutor异步执行model.chat
保证多路同时请求能并发响应.