Skip to content

Commit

Permalink
fix api_server backend for gradio
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Dec 18, 2023
1 parent a67c249 commit fc0386a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lmdeploy/serve/async_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ async def generate(
finish_reason)
if sequence_end is True and sequence_start is False:
self.end_session(session_id)
elif stop is True:
self.stop_session(session_id)
yield GenOut('', self.id2step[str(session_id)], len(input_ids), 0,
finish_reason)
else:
generator = await self.get_generator(stop, session_id)
with self.safe_run(session_id):
Expand Down
3 changes: 2 additions & 1 deletion lmdeploy/serve/gradio/api_server_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def cancel_restful_func(state_chatbot: gr.State, cancel_btn: gr.Button,
f'{InterFace.api_server_url}/v1/chat/interactive',
session_id=session_id,
request_output_len=0,
stop=True):
stop=True,
interactive_mode=False):
pass
time.sleep(0.5)
messages = []
Expand Down

0 comments on commit fc0386a

Please sign in to comment.