diff --git a/fastchat/serve/base_model_worker.py b/fastchat/serve/base_model_worker.py index c8d3ed9b6..514cc8221 100644 --- a/fastchat/serve/base_model_worker.py +++ b/fastchat/serve/base_model_worker.py @@ -203,7 +203,7 @@ async def api_generate_stream(request: Request): async def api_generate(request: Request): params = await request.json() await acquire_worker_semaphore() - output = worker.generate_gate(params) + output = await asyncio.to_thread(worker.generate_gate, params) release_worker_semaphore() return JSONResponse(output)