Langchain-Chatchat icon indicating copy to clipboard operation
Langchain-Chatchat copied to clipboard

[BUG] vllm0.3.3加速Qwen1.5系列模型,报ImportError: cannot import name 'model_schema' from 'pydantic.schema'

Open xqxls opened this issue 9 months ago • 1 comments

2024-05-10 15:14:44 | INFO | stdout | 本地vllm加速模型 /home/xqxls/git/Langchain-Chatchat/venv/lib/python3.11/site-packages/pydantic/_internal/_config.py:334: UserWarning: Valid config keys have changed in V2:

  • 'schema_extra' has been renamed to 'json_schema_extra' warnings.warn(message, UserWarning) /home/xqxls/git/Langchain-Chatchat/venv/lib/python3.11/site-packages/pydantic/_internal/fields.py:160: UserWarning: Field "model_name" has conflict with protected namespace "model".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = (). warnings.warn( Process API Server: Traceback (most recent call last): File "/home/xqxls/anaconda3/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/home/xqxls/anaconda3/lib/python3.11/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/xqxls/git/Langchain-Chatchat/startup.py", line 456, in run_api_server app = create_app(run_mode=run_mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/xqxls/git/Langchain-Chatchat/server/api.py", line 51, in create_app mount_app_routes(app, run_mode=run_mode) File "/home/xqxls/git/Langchain-Chatchat/server/api.py", line 77, in mount_app_routes mount_knowledge_routes(app) File "/home/xqxls/git/Langchain-Chatchat/server/api.py", line 142, in mount_knowledge_routes from server.chat.agent_chat import agent_chat File "/home/xqxls/git/Langchain-Chatchat/server/chat/agent_chat.py", line 15, in from server.agent.custom_agent.ChatGLM3Agent import initialize_glm3_agent File "/home/xqxls/git/Langchain-Chatchat/server/agent/custom_agent/ChatGLM3Agent.py", line 9, in from pydantic.schema import model_schema ImportError: cannot import name 'model_schema' from 'pydantic.schema' (/home/xqxls/git/Langchain-Chatchat/venv/lib/python3.11/site-packages/pydantic/schema.py)

xqxls avatar May 10 '24 07:05 xqxls

The ImportError you're encountering is due to the model_schema function not being available in your current version of Pydantic. This function might have been removed or relocated in newer versions. To resolve this, you might need to either revert to an older version of Pydantic where model_schema was available or adapt your code to work without it, depending on your project's requirements.

For the UserWarnings related to Pydantic configuration and field name conflicts:

  • Update your Pydantic model configurations to use json_schema_extra instead of the deprecated schema_extra.
  • Rename the field model_name in your Pydantic models to avoid conflicts with Pydantic's reserved attributes or methods.

Ensure your Pydantic and FastAPI libraries are up to date and compatible with Python 3.11. Review and adjust your code according to the latest versions of these libraries, paying close attention to deprecated features and breaking changes. After making these changes, thoroughly test your application to confirm everything works as expected.

Details

Sources


About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] avatar May 10 '24 07:05 dosubot[bot]

@xqxls 请问这个问题解决了吗

KrisWongz avatar Jun 04 '24 10:06 KrisWongz