QwenLM / Qwen2.5

Qwen2.5 is the large language model series developed by Qwen team, Alibaba Cloud.
9.3k stars 572 forks source link

运行API服务对话时提示:TypeError: 'NoneType' object is not iterable #74

Closed syusama closed 6 months ago

syusama commented 8 months ago

用 openai_api.py 运行API服务的时候报错,服务可以启成功,但是发送对话时报错 模型选择的是:Qwen1.5-14B-Chat python3 openai_api.py --checkpoint-path D:\projects\Qwen\models\Qwen1.5-14B-Chat --server-port 8052

INFO: 47.90.xxx.xxx:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK ERROR: Exception in ASGI application Traceback (most recent call last): File "D:\projects\Qwen\env\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 408, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\projects\Qwen\env\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in __call__ return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\projects\Qwen\env\Lib\site-packages\fastapi\applications.py", line 292, in __call__ await super().__call__(scope, receive, send) File "D:\projects\Qwen\env\Lib\site-packages\starlette\applications.py", line 122, in __call__ await self.middleware_stack(scope, receive, send) File "D:\projects\Qwen\env\Lib\site-packages\starlette\middleware\errors.py", line 184, in __call__ raise exc File "D:\projects\Qwen\env\Lib\site-packages\starlette\middleware\errors.py", line 162, in __call__ await self.app(scope, receive, _send) File "D:\projects\Qwen\env\Lib\site-packages\starlette\middleware\cors.py", line 83, in __call__ await self.app(scope, receive, send) File "D:\projects\Qwen\env\Lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__ raise exc File "D:\projects\Qwen\env\Lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__ await self.app(scope, receive, sender) File "D:\projects\Qwen\env\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 20, in __call__ raise e File "D:\projects\Qwen\env\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 17, in __call__ await self.app(scope, receive, send) File "D:\projects\Qwen\env\Lib\site-packages\starlette\routing.py", line 718, in __call__ await route.handle(scope, receive, send) File "D:\projects\Qwen\env\Lib\site-packages\starlette\routing.py", line 276, in handle await self.app(scope, receive, send) File "D:\projects\Qwen\env\Lib\site-packages\starlette\routing.py", line 69, in app await response(scope, receive, send) File "D:\projects\Qwen\env\Lib\site-packages\sse_starlette\sse.py", line 267, in __call__ async with anyio.create_task_group() as task_group: File "D:\projects\Qwen\env\Lib\site-packages\anyio\_backends\_asyncio.py", line 597, in __aexit__ raise exceptions[0] File "D:\projects\Qwen\env\Lib\site-packages\sse_starlette\sse.py", line 270, in wrap await func() File "D:\projects\Qwen\env\Lib\site-packages\sse_starlette\sse.py", line 251, in stream_response async for data in self.body_iterator: File "D:\projects\Qwen\Qwen\openai_api.py", line 487, in predict delay_token_num = max([len(x) for x in stop_words]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable

前端是配置的one-api + fastgpt进行问答,请问是哪里出了问题

syusama commented 8 months ago

微信截图_20240222121750

GLY-123 commented 7 months ago

我也是这样,求解决

GLY-123 commented 7 months ago

将open_api.py降级就可以解决了,在qwen官网,找到opwen-api.py,左上角有history,里面找到旧版

GLY-123 commented 7 months ago

将open_api.py降级就可以解决了,在qwen官网,找到opwen-api.py,左上角有history,里面找到旧版

这样好像就是一个假的流式输出

jklj077 commented 6 months ago

The openai_api.py provided in the QwenLM/Qwen repo requires a specific version of sse_starlette. It does not support Qwen1.5 officially and is not longer maintained.

For OpenAI API compatible deployment, please try vLLM or SGLang as the README suggests.