Skip to content

Commit

Permalink
Fixed model_worker generate_gate may blocked main thread (#2540) (#2562
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lvxuan263 authored Oct 16, 2023
1 parent 06092dd commit ff66426
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fastchat/serve/base_model_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit ff66426

Please sign in to comment.