Skip to content

Commit

Permalink
fix semaphore
Browse files Browse the repository at this point in the history
  • Loading branch information
lzhangzz committed Dec 25, 2024
1 parent 8fa85dc commit 3f07733
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lmdeploy/turbomind/turbomind.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ def __init__(self):

async def acquire(self):
if self.val:
self.val = 0
return
self.fut = self.loop.create_future()
await self.fut
Expand Down Expand Up @@ -578,11 +579,11 @@ async def async_stream_infer(self,
try:
while True:
await sem.acquire()

state = shared_state.consume()

status, seq_len = state.status, state.seq_len

if status == 7:
if status in [7, 8]: # finish / canceled
finish, status = True, 0
elif status:
yield self._get_error_output()
Expand Down

0 comments on commit 3f07733

Please sign in to comment.