调用 Xinference OpenAI接口时报错 Model not found in the model list, uid

错误如下, 请不要被错误吓住或蒙蔽双眼, 自己看最下面的报错内容

Traceback (most recent call last):

File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\responses.py", line 259, in call

await wrap(partial(self.listen_for_disconnect, receive))

File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\responses.py", line 255, in wrap

await func()

File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\responses.py", line 232, in listen_for_disconnect

message = await receive()

^^^^^^^^^^^^^^^

File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 555, in receive

await self.message_event.wait()

File "C:\Users\HW\.conda\envs\aibot\Lib\asyncio\locks.py", line 213, in wait

await fut

asyncio.exceptions.CancelledError: Cancelled by cancel scope 25257b8d810

During handling of the above exception, another exception occurred:

  • Exception Group Traceback (most recent call last):

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 401, in run_asgi

| result = await app( # type: ignore[func-returns-value]

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in call

| return await self.app(scope, receive, send)

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\fastapi\applications.py", line 1054, in call

| await super().call(scope, receive, send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\applications.py", line 113, in call

| await self.middleware_stack(scope, receive, send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\middleware\errors.py", line 187, in call

| raise exc

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\middleware\errors.py", line 165, in call

| await self.app(scope, receive, _send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call

| await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app

| raise exc

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app

| await app(scope, receive, sender)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\routing.py", line 715, in call

| await self.middleware_stack(scope, receive, send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\routing.py", line 735, in app

| await route.handle(scope, receive, send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\routing.py", line 288, in handle

| await self.app(scope, receive, send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\routing.py", line 76, in app

| await wrap_app_handling_exceptions(app, request)(scope, receive, send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app

| raise exc

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app

| await app(scope, receive, sender)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\routing.py", line 74, in app

| await response(scope, receive, send)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\responses.py", line 252, in call

| async with anyio.create_task_group() as task_group:

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\anyio\_backends\_asyncio.py", line 763, in aexit

| raise BaseExceptionGroup(

| ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)

+-+---------------- 1 ----------------

| Traceback (most recent call last):

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\responses.py", line 255, in wrap

| await func()

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\starlette\responses.py", line 244, in stream_response

| async for chunk in self.body_iterator:

| File "D:\codes\aibot\ask.py", line 49, in answer_generator

| for chunk in retrieval_chain.stream({"input": f"{request.question}"}):

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 5525, in stream

| yield from self.bound.stream(

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 3407, in stream

| yield from self.transform(iter([input]), config, **kwargs)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 3394, in transform

| yield from self._transform_stream_with_config(

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 2197, in _transform_stream_with_config

| chunk: Output = context.run(next, iterator) # type: ignore

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 3357, in _transform

| yield from final_pipeline

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\passthrough.py", line 576, in transform

| yield from self._transform_stream_with_config(

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 2197, in _transform_stream_with_config

| chunk: Output = context.run(next, iterator) # type: ignore

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\passthrough.py", line 566, in _transform

| yield cast(dict[str, Any], first_map_chunk_future.result())

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\concurrent\futures\_base.py", line 456, in result

| return self.__get_result()

| ^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\concurrent\futures\_base.py", line 401, in __get_result

| raise self._exception

| File "C:\Users\HW\.conda\envs\aibot\Lib\concurrent\futures\thread.py", line 58, in run

| result = self.fn(*self.args, **self.kwargs)

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 3847, in transform

| yield from self._transform_stream_with_config(

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 2197, in _transform_stream_with_config

| chunk: Output = context.run(next, iterator) # type: ignore

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 3832, in _transform

| chunk = AddableDict({step_name: future.result()})

| ^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\concurrent\futures\_base.py", line 449, in result

| return self.__get_result()

| ^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\concurrent\futures\_base.py", line 401, in __get_result

| raise self._exception

| File "C:\Users\HW\.conda\envs\aibot\Lib\concurrent\futures\thread.py", line 58, in run

| result = self.fn(*self.args, **self.kwargs)

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 5561, in transform

| yield from self.bound.transform(

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 3394, in transform

| yield from self._transform_stream_with_config(

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 2197, in _transform_stream_with_config

| chunk: Output = context.run(next, iterator) # type: ignore

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 3357, in _transform

| yield from final_pipeline

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\output_parsers\transform.py", line 64, in transform

| yield from self._transform_stream_with_config(

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 2161, in _transform_stream_with_config

| final_input: Optional[Input] = next(input_for_tracing, None)

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\runnables\base.py", line 1431, in transform

| yield from self.stream(final, config, **kwargs)

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\language_models\chat_models.py", line 420, in stream

| raise e

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_core\language_models\chat_models.py", line 400, in stream

| for chunk in self._stream(messages, stop=stop, **kwargs):

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\langchain_openai\chat_models\base.py", line 658, in _stream

| response = self.client.create(**payload)

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\openai\_utils\_utils.py", line 274, in wrapper

| return func(*args, **kwargs)

| ^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\openai\resources\chat\completions.py", line 815, in create

| return self._post(

| ^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\openai\_base_client.py", line 1277, in post

| return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\openai\_base_client.py", line 954, in request

| return self._request(

| ^^^^^^^^^^^^^^

| File "C:\Users\HW\.conda\envs\aibot\Lib\site-packages\openai\_base_client.py", line 1058, in _request

| raise self._make_status_error_from_response(err.response) from None

| openai.BadRequestError: Error code: 400 - {'detail': '[address=0.0.0.0:12781, pid=304366] Model not found in the model list, uid: qwen2.5-instruct123'}

这里面列出来了找不到model, uid, 在加载模型时, Model UlD, model name by default 可选字段一定要填, 不填的话可能会生成随机的一个ID, 导致调用时找不到模型

重新加载模型, 按如下图示设置名称即可, 使用时使用设置的MODEL UID即可

相关推荐
Heartsuit15 小时前
LLM大语言模型私有化部署-使用Dify的工作流编排打造专属AI搜索引擎
人工智能·dify·ollama·qwen2.5·ai搜索引擎·tavily search·工作流编排
gs801401 个月前
报错 No available slot found for the embedding model
embedding·xinference
obullxl1 个月前
深入解析 Transformers 框架(四):Qwen2.5/GPT 分词流程与 BPE 分词算法技术细节详解
人工智能·gpt·ai·transformers·qwen2.5·bpe
wyh_1112 个月前
windows下xinference无法加载本地大模型问题解决
langchain·xinference
橘长长长2 个月前
Windows10本地部署Dify+Xinference
ai·dify·xinference·glm4
一路追寻2 个月前
使用Ollama测试OpenAI的Swarm多智能体编排框架
llm·openai·agent·swarm·ollama·qwen2.5
ulimpid3 个月前
LLM | Xinference 安装使用(支持CPU、Metal、CUDA推理和分布式部署)
llm·xinference
yingchenwy3 个月前
Qwen2.5 模型使用初体验
linux·qwen2.5
NLP工程化3 个月前
PyCharm 调试 Xinference 遇到问题及解决方案
pycharm·dify·xinference