Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Can't inference with stream=false 0.0.8 #402

Closed
2 tasks done
hatrexltd opened this issue Sep 11, 2023 · 4 comments · Fixed by #405
Closed
2 tasks done

[Bug] Can't inference with stream=false 0.0.8 #402

hatrexltd opened this issue Sep 11, 2023 · 4 comments · Fixed by #405
Assignees

Comments

@hatrexltd
Copy link

hatrexltd commented Sep 11, 2023

Checklist

  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.

Describe the bug

Traceback (most recent call last):
File "/root/miniconda3/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/lib/python3.11/site-packages/fastapi/applications.py", line 276, in call
await super().call(scope, receive, send)
File "/root/miniconda3/lib/python3.11/site-packages/starlette/applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "/root/miniconda3/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in call
raise exc
File "/root/miniconda3/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in call
await self.app(scope, receive, _send)
File "/root/miniconda3/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in call
raise exc
File "/root/miniconda3/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "/root/miniconda3/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call
raise e
File "/root/miniconda3/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "/root/miniconda3/lib/python3.11/site-packages/starlette/routing.py", line 718, in call
await route.handle(scope, receive, send)
File "/root/miniconda3/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/root/miniconda3/lib/python3.11/site-packages/starlette/routing.py", line 69, in app
await response(scope, receive, send)
File "/root/miniconda3/lib/python3.11/site-packages/starlette/responses.py", line 280, in call
await self.background()
File "/root/miniconda3/lib/python3.11/site-packages/starlette/background.py", line 43, in call
await task()
File "/root/miniconda3/lib/python3.11/site-packages/starlette/background.py", line 26, in call
await self.func(*self.args, **self.kwargs)
File "/root/miniconda3/lib/python3.11/site-packages/lmdeploy/serve/openai/api_server.py", line 130, in abort_request
async for _ in VariableInterface.async_engine.generate_openai(
File "/root/miniconda3/lib/python3.11/site-packages/lmdeploy/serve/async_engine.py", line 216, in generate_openai
async for outputs in generator.async_stream_infer(
File "/root/miniconda3/lib/python3.11/site-packages/lmdeploy/turbomind/turbomind.py", line 213, in async_stream_infer
for output in self.stream_infer(*args, **kwargs):
File "/root/miniconda3/lib/python3.11/site-packages/lmdeploy/turbomind/turbomind.py", line 347, in stream_infer
if output[-1].item() == self.eos_id:
~~~~~~^^^^
IndexError: index -1 is out of bounds for dimension 0 with size 0

Reproduction

{
"model": "llama2",
"messages": [
{"role": "user", "content": "Tell me about France"}
],
"max_tokens": 372,
"temperature": 0.7,
"top_p": 1,
"n": 1,
"stream": false
}

Error traceback

No response

Request with stream=true works

@lvhan028
Copy link
Collaborator

#378 brought side effects.

@wangruohui
Copy link
Collaborator

wangruohui commented Sep 12, 2023

Hi @hatrexltd

Can you try change File "/root/miniconda3/lib/python3.11/site-packages/lmdeploy/turbomind/turbomind.py", line 347, in stream_infer as below, and see if it solve your problem?

if len(output)>0 and output[-1].item() == self.eos_id:

@hatrexltd
Copy link
Author

Hi @hatrexltd

Can you try change File "/root/miniconda3/lib/python3.11/site-packages/lmdeploy/turbomind/turbomind.py", line 347, in stream_infer as below, and see if it solve your problem?

if len(output)>0 and output[-1].item() == self.eos_id:

Works. Thanks.

@wangruohui
Copy link
Collaborator

To be fixed by #405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants