[Frontend] Parallelize preprocessing within the same request for pooling models online serving. (#49153)
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
This commit is contained in:
@@ -17,8 +17,11 @@ from .serving import ServingPooling
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
def pooling(request: Request) -> ServingPooling | None:
|
||||
return request.app.state.serving_pooling
|
||||
def pooling(request: Request) -> ServingPooling:
|
||||
handler = getattr(request.app.state, "serving_pooling", None)
|
||||
if handler is None:
|
||||
raise NotImplementedError("The model does not support Pooling API")
|
||||
return handler
|
||||
|
||||
|
||||
@router.post(
|
||||
@@ -33,7 +36,4 @@ def pooling(request: Request) -> ServingPooling | None:
|
||||
@load_aware_call
|
||||
async def create_pooling(request: PoolingRequest, raw_request: Request):
|
||||
handler = pooling(raw_request)
|
||||
if handler is None:
|
||||
raise NotImplementedError("The model does not support Pooling API")
|
||||
|
||||
return await handler(request, raw_request)
|
||||
|
||||
Reference in New Issue
Block a user