Skip to content

Commit

Permalink
refine
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Nov 4, 2024
1 parent 80a27d2 commit 27f3086
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lmdeploy/serve/async_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,12 @@ async def gather():
*[_inner_call(i, generators[i]) for i in range(len(prompts))])

loop = _get_event_loop()
thread = Thread(target=lambda: loop.run_until_complete(gather()))
thread.start()
thread.join()
if loop.is_running():
thread = Thread(target=lambda: loop.run_until_complete(gather()))
thread.start()
thread.join()
else:
loop.run_until_complete(gather())
outputs = outputs[0] if need_list_wrap else outputs
return outputs

Expand Down

0 comments on commit 27f3086

Please sign in to comment.