[Engine] Fix generate hanging issue after the first call (#1606)

This commit is contained in:
Byron Hsu
2024-10-07 21:26:56 -07:00
committed by GitHub
parent c5325aba75
commit e8613df071
2 changed files with 15 additions and 2 deletions

View File

@@ -691,8 +691,9 @@ class Engine:
lora_path=lora_path,
)
# make it synchronous
return asyncio.run(generate_request(obj, None))
# get the current event loop
loop = asyncio.get_event_loop()
return loop.run_until_complete(generate_request(obj, None))
def shutdown(self):
kill_child_process(os.getpid(), including_parent=False)