Qwen2-VL部署pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for

Qwen2-VL部署报错及解决办法

 部署阿里云团队的Qwen2-VL大模型发生报错如下:

模型为GPTQ-int8     计算卡为P40Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int8 · Hugging Faceicon-default.png?t=O83Ahttps://huggingface.co/Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int8

 虚拟环境各py包如下:

(qwen2vl) PS C:\Users\Administrator> pip list
Package                       Version
----------------------------- ------------
accelerate                    0.34.2
aiofiles                      23.2.1
aiohappyeyeballs              2.4.0
aiohttp                       3.10.5
aiosignal                     1.3.1
altair                        5.4.1
annotated-types               0.7.0
anyio                         4.4.0
async-timeout                 4.0.3
attrs                         24.2.0
auto_gptq                     0.7.1+cu118
autoawq                       0.2.6
autoawq_kernels               0.0.7
av                            13.0.0
certifi                       2024.8.30
charset-normalizer            3.3.2
click                         8.1.7
colorama                      0.4.6
coloredlogs                   15.0.1
contourpy                     1.3.0
cycler                        0.12.1
datasets                      2.21.0
dill                          0.3.8
einops                        0.8.0
exceptiongroup                1.2.2
fastapi                       0.114.1
ffmpy                         0.4.0
filelock                      3.13.1
fonttools                     4.53.1
frozenlist                    1.4.1
fsspec                        2024.2.0
gekko                         1.2.1
gradio                        4.29.0
gradio_client                 0.16.1
h11                           0.14.0
httpcore                      1.0.5
httpx                         0.27.2
huggingface-hub               0.24.6
humanfriendly                 10.0
idna                          3.8
importlib_resources           6.4.5
intel-openmp                  2021.4.0
Jinja2                        3.1.3
jsonschema                    4.23.0
jsonschema-specifications     2023.12.1
kiwisolver                    1.4.7
markdown-it-py                3.0.0
MarkupSafe                    2.1.5
matplotlib                    3.9.2
mdurl                         0.1.2
mkl                           2021.4.0
mpmath                        1.3.0
multidict                     6.1.0
multiprocess                  0.70.16
narwhals                      1.6.4
networkx                      3.2.1
ninja                         1.11.1.1
numpy                         1.26.3
optimum                       1.22.0
orjson                        3.10.7
packaging                     24.1
pandas                        2.2.2
peft                          0.12.0
pillow                        10.2.0
pip                           24.2
protobuf                      5.28.0
psutil                        6.0.0
pyarrow                       17.0.0
pydantic                      2.9.1
pydantic_core                 2.23.3
pydub                         0.25.1
Pygments                      2.18.0
pyparsing                     3.1.4
pyreadline3                   3.4.3
python-dateutil               2.9.0.post0
python-multipart              0.0.9
pytz                          2024.2
PyYAML                        6.0.2
qwen-vl-utils                 0.0.2
referencing                   0.35.1
regex                         2024.7.24
requests                      2.32.3
rich                          13.8.1
rouge                         1.0.1
rpds-py                       0.20.0
ruff                          0.6.4
safetensors                   0.4.5
semantic-version              2.10.0
sentencepiece                 0.2.0
setuptools                    72.1.0
shellingham                   1.5.4
six                           1.16.0
sniffio                       1.3.1
starlette                     0.38.5
sympy                         1.12
tbb                           2021.13.1
tokenizers                    0.19.1
tomlkit                       0.12.0
torch                         2.3.1+cu118
torchaudio                    2.3.1+cu118
torchvision                   0.18.1+cu118
tqdm                          4.66.5
transformers                  4.45.0.dev0
transformers-stream-generator 0.0.4
typer                         0.12.5
typing_extensions             4.12.2
tzdata                        2024.1
urllib3                       2.2.2
uvicorn                       0.30.6
websockets                    11.0.3
wheel                         0.43.0
xxhash                        3.5.0
yarl                          1.11.1
zstandard                     0.23.0

发生报错具体如下:

(qwen2vl) PS D:\3\Qwen2-VL-main> python web_demo_mm.py
Unrecognized keys in `rope_scaling` for 'rope_type'='default': {'mrope_section'}
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\exllama.py:12: UserWarning: AutoAWQ could not load ExLlama kernels extension. Details: DLL load failed while importing exl_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load ExLlama kernels extension. Details: {ex}")
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\exllamav2.py:13: UserWarning: AutoAWQ could not load ExLlamaV2 kernels extension. Details: DLL load failed while importing exlv2_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load ExLlamaV2 kernels extension. Details: {ex}")
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\gemm.py:14: UserWarning: AutoAWQ could not load GEMM kernels extension. Details: DLL load failed while importing awq_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load GEMM kernels extension. Details: {ex}")
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\gemv.py:11: UserWarning: AutoAWQ could not load GEMV kernels extension. Details: DLL load failed while importing awq_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load GEMV kernels extension. Details: {ex}")
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\gemv_fast.py:10: UserWarning: AutoAWQ could not load GEMVFast kernels extension. Details: DLL load failed while importing awq_v2_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load GEMVFast kernels extension. Details: {ex}")
CUDA extension not installed.
CUDA extension not installed.
`Qwen2VLRotaryEmbedding` can now be fully parameterized by passing the model config through the `config` argument. All other arguments will be removed in v4.46
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\transformers\modeling_utils.py:4732: FutureWarning: `_is_quantized_training_enabled` is going to be deprecated in transformers 4.39.0. Please use `model.hf_quantizer.is_trainable` instead
  warnings.warn(
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:06<00:00,  2.30s/it] 
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\type_adapter.py", line 270, in _init_core_attrs
    self._core_schema = _getattr_no_parents(self._type, '__pydantic_core_schema__')
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\type_adapter.py", line 112, in _getattr_no_parents
    raise AttributeError(attribute)
AttributeError: __pydantic_core_schema__

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 406, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\fastapi\applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\middleware\errors.py", line 187, in __call__
    raise exc
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\middleware\errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\gradio\route_utils.py", line 713, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\gradio\route_utils.py", line 729, in simple_response
    await self.app(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\starlette\routing.py", line 73, in app
    response = await f(request)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\fastapi\routing.py", line 291, in app
    solved_result = await solve_dependencies(
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\fastapi\dependencies\utils.py", line 639, in solve_dependencies
    ) = await request_body_to_args(  # body_params checked above
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\fastapi\dependencies\utils.py", line 813, in request_body_to_args
    fields_to_extract = get_cached_model_fields(first_field.type_)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\fastapi\_compat.py", line 657, in get_cached_model_fields
    return get_model_fields(model)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\fastapi\_compat.py", line 284, in get_model_fields
    return [
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\fastapi\_compat.py", line 285, in <listcomp>
    ModelField(field_info=field_info, name=name)
  File "<string>", line 6, in __init__
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\fastapi\_compat.py", line 110, in __post_init__
    self._type_adapter: TypeAdapter[Any] = TypeAdapter(
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\type_adapter.py", line 257, in __init__
    self._init_core_attrs(rebuild_mocks=False)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\type_adapter.py", line 135, in wrapped
    return func(self, *args, **kwargs)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\type_adapter.py", line 277, in _init_core_attrs
    self._core_schema = _get_schema(self._type, config_wrapper, parent_depth=self._parent_depth)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\type_adapter.py", line 95, in _get_schema
    schema = gen.generate_schema(type_)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 655, in generate_schema
    schema = self._generate_schema_inner(obj)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 908, in _generate_schema_inner
    return self._annotated_schema(obj)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 2028, in _annotated_schema
    schema = self._apply_annotations(source_type, annotations)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 2107, in _apply_annotations
    schema = get_inner_schema(source_type)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_schema_generation_shared.py", line 83, in __call__
    schema = self._handler(source_type)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 2189, in new_handler
    schema = metadata_get_schema(source, get_inner_schema)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 2185, in <lambda>
    lambda source, handler: handler(source)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_schema_generation_shared.py", line 83, in __call__
    schema = self._handler(source_type)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 2088, in inner_handler
    schema = self._generate_schema_inner(obj)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 929, in _generate_schema_inner
    return self.match_type(obj)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 1029, in match_type
    return self._match_generic_type(obj, origin)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 1058, in _match_generic_type
    return self._union_schema(obj)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 1378, in _union_schema
    choices.append(self.generate_schema(arg))
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 655, in generate_schema
    schema = self._generate_schema_inner(obj)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 929, in _generate_schema_inner
    return self.match_type(obj)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 1038, in match_type
    return self._unknown_type_schema(obj)
  File "D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\pydantic\_internal\_generate_schema.py", line 558, in _unknown_type_schema
    raise PydanticSchemaGenerationError(
pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'starlette.requests.Request'>. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.

If you got this error by calling handler(<some type>) within `__get_pydantic_core_schema__` then you likely need to call `handler.generate_schema(<some type>)` since we do not call `__get_pydantic_core_schema__` on `<some type>` otherwise to avoid infinite recursion.

For further information visit https://errors.pydantic.dev/2.9/u/schema-for-unknown-type

参考github教程说明:PydanticSchemaGenerationError for class starlette.requests.Request · Issue #2783 · bmaltais/kohya_ss (github.com)icon-default.png?t=O83Ahttps://github.com/bmaltais/kohya_ss/issues/2783

只需要更换一个gradio版本即可。

It's temporary solution but, you can modify the requirements.txt file to downgrade the gradio package to version 3.50.2.

gradio==3.50.2
pip install gradio==3.50.2

最终可以成功正常运行Qwen2-VL

(qwen2vl) PS D:\3\Qwen2-VL-main> python web_demo_mm.py
Unrecognized keys in `rope_scaling` for 'rope_type'='default': {'mrope_section'}
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\exllama.py:12: UserWarning: AutoAWQ could not load ExLlama kernels extension. Details: DLL load failed while importing exl_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load ExLlama kernels extension. Details: {ex}")
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\exllamav2.py:13: UserWarning: AutoAWQ could not load ExLlamaV2 kernels extension. Details: DLL load failed while importing exlv2_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load ExLlamaV2 kernels extension. Details: {ex}")
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\gemm.py:14: UserWarning: AutoAWQ could not load GEMM kernels extension. Details: DLL load failed while importing awq_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load GEMM kernels extension. Details: {ex}")
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\gemv.py:11: UserWarning: AutoAWQ could not load GEMV kernels extension. Details: DLL load failed while importing awq_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load GEMV kernels extension. Details: {ex}")
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\awq\modules\linear\gemv_fast.py:10: UserWarning: AutoAWQ could not load GEMVFast kernels extension. Details: DLL load failed while importing awq_v2_ext: 找不到指定的模块。
  warnings.warn(f"AutoAWQ could not load GEMVFast kernels extension. Details: {ex}")
CUDA extension not installed.
CUDA extension not installed.
`Qwen2VLRotaryEmbedding` can now be fully parameterized by passing the model config through the `config` argument. All other arguments will be removed in v4.46
D:\ProgramData\anaconda3\envs\qwen2vl\lib\site-packages\transformers\modeling_utils.py:4732: FutureWarning: `_is_quantized_training_enabled` is going to be deprecated in transformers 4.39.0. Please use `model.hf_quantizer.is_trainable` instead
  warnings.warn(
Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:05<00:00,  1.86s/it]
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
IMPORTANT: You are using gradio version 3.50.2, however version 4.29.0 is available, please upgrade.
--------

 

关于提示词,需要尽可能的详细,

读取图像,解答这个题干和对应的题目,尝试给出对应的解答过程和答案给我。

12.8252GB约为当前所需的显存

但如果提示词不恰当(过于简略,则可能会导致Qwen2-VL大模型发生误判)最终还有可能会爆显存。

PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> # 1. 导航到项目目录 PS C:\Users\Administrator\Desktop> cd E:\AI_System PS E:\AI_System> PS E:\AI_System> # 2. 激活虚拟环境(只需执行一次) PS E:\AI_System> venv\Scripts\activate (venv) PS E:\AI_System> (venv) PS E:\AI_System> # 3. 运行环境接口测试 (venv) PS E:\AI_System> python agent\environment_interface.py 2025-08-27 23:21:48,031 - CoreConfig - INFO - 📂 从 E:\AI_System\config\default.json 加载配置: { "LOG_DIR": "E:/AI_System/logs", "CONFIG_DIR": "E:/AI_System/config", "MODEL_CACHE_DIR": "E:/AI_System/model_cache", "AGENT_NAME": "\u5c0f\u84dd", "DEFAULT_USER": "\u7ba1\u7406\u5458", "MAX_WORKERS": 4, "AGENT_RESPONSE_TIMEOUT": 30.0, "MODEL_BASE_PATH": "E:/AI_Models", "MODEL_PATHS": { "TEXT_BASE": "E:/AI_Models/Qwen2-7B", "TEXT_CHAT": "E:/AI_Models/deepseek-7b-chat", "MULTIMODAL": "E:/AI_Models/deepseek-vl2", "IMAGE_GEN": "E:/AI_Models/sdxl", "YI_VL": "E:/AI_Models/yi-vl", "STABLE_DIFFUSION": "E:/AI_Models/stable-diffusion-xl-base-1.0" }, "NETWORK": { "HOST": "0.0.0.0", "FLASK_PORT": 8000, "GRADIO_PORT": 7860 }, "DATABASE": { "DB_HOST": "localhost", "DB_PORT": 5432, "DB_NAME": "ai_system", "DB_USER": "ai_user", "DB_PASSWORD": "secure_password_here" }, "SECURITY": { "SECRET_KEY": "generated-secret-key-here" }, "ENVIRONMENT": { "ENV": "dev", "LOG_LEVEL": "DEBUG", "USE_GPU": true }, "DIRECTORIES": { "DEFAULT_MODEL": "E:/AI_Models/Qwen2-7B", "WEB_UI_DIR": "E:/AI_System/web_ui", "AGENT_DIR": "E:/AI_System/agent", "PROJECT_ROOT": "E:/AI_System" } } 2025-08-27 23:21:48,031 - CoreConfig - INFO - 📂 从 E:\AI_System\config\local.json 加载配置: {} 2025-08-27 23:21:48,032 - CoreConfig - INFO - 🌐 从 E:\AI_System\.env 加载环境变量 2025-08-27 23:21:48,032 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_ROOT=E:\AI_System 2025-08-27 23:21:48,032 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DIRECTORIES__PROJECT_ROOT=E:\AI_System 2025-08-27 23:21:48,032 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DIRECTORIES__AGENT_DIR=E:\AI_System\agent 2025-08-27 23:21:48,032 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DIRECTORIES__WEB_UI_DIR=E:\AI_System\web_ui 2025-08-27 23:21:48,032 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DIRECTORIES__DEFAULT_MODEL=E:\AI_Models\Qwen2-7B 2025-08-27 23:21:48,032 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_ENVIRONMENT__LOG_LEVEL=DEBUG 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DATABASE__DB_HOST=localhost 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DATABASE__DB_PORT=5432 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DATABASE__DB_NAME=ai_system 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DATABASE__DB_USER=ai_user 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_DATABASE__DB_PASSWORD=****** 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_SECURITY__SECRET_KEY=****** 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_MODEL_PATHS__TEXT_BASE=E:\AI_Models\Qwen2-7B 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_MODEL_PATHS__TEXT_CHAT=E:\AI_Models\deepseek-7b-chat 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_MODEL_PATHS__MULTIMODAL=E:\AI_Models\deepseek-vl2 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_MODEL_PATHS__IMAGE_GEN=E:\AI_Models\sdxl 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_MODEL_PATHS__YI_VL=E:\AI_Models\yi-vl 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_MODEL_PATHS__STABLE_DIFFUSION=E:\AI_Models\stable-diffusion-xl-base-1.0 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_NETWORK__HOST=0.0.0.0 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_NETWORK__FLASK_PORT=8000 2025-08-27 23:21:48,033 - CoreConfig - INFO - 🔄 环境变量覆盖: AI_SYSTEM_NETWORK__GRADIO_PORT=7860 2025-08-27 23:21:48,034 - CoreConfig - WARNING - ⚠️ 模型路径不存在: STABLE_DIFFUSION = E:/AI_Models/stable-diffusion-xl-base-1.0 2025-08-27 23:21:48,034 - CoreConfig - INFO - ✅ 配置系统初始化完成 2025-08-27 23:21:48,416 - EnvironmentInterface - INFO - ✅ 初始化环境模块: EnvironmentInterface 2025-08-27 23:21:48,416 - EnvironmentInterface - INFO - ✅ 初始化环境模块: EnvironmentInterface Traceback (most recent call last): File "E:\AI_System\agent\environment_interface.py", line 198, in <module> env = EnvironmentInterface(config=config) File "E:\AI_System\agent\environment_interface.py", line 78, in __init__ self.workspace_root = self._resolve_workspace_path(self.base_dir) AttributeError: 'EnvironmentInterface' object has no attribute '_resolve_workspace_path' (venv) PS E:\AI_System> (venv) PS E:\AI_System> # 确认文件存在 (venv) PS E:\AI_System> dir agent\environment_interface.py Directory: E:\AI_System\agent Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 2025/8/27 23:18 6972 environment_interface.py (venv) PS E:\AI_System> (venv) PS E:\AI_System> python --version Python 3.10.10 (venv) PS E:\AI_System> # 应该显示 Python 3.x (venv) PS E:\AI_System> # 检查虚拟环境中的包 (venv) PS E:\AI_System> pip list Package Version ------------------------- ------------ accelerate 0.27.2 aiofiles 23.2.1 aiohttp 3.9.3 aiosignal 1.4.0 altair 5.5.0 annotated-types 0.7.0 ansicon 1.89.0 anyio 4.10.0 async-timeout 4.0.3 attrs 25.3.0 bidict 0.23.1 blessed 1.21.0 blinker 1.9.0 Brotli 1.1.0 certifi 2025.8.3 cffi 1.17.1 charset-normalizer 3.4.3 click 8.2.1 colorama 0.4.6 coloredlogs 15.0.1 contourpy 1.3.2 cryptography 42.0.4 cycler 0.12.1 diffusers 0.26.3 diskcache 5.6.3 distro 1.9.0 exceptiongroup 1.3.0 fastapi 0.116.1 ffmpy 0.6.1 filelock 3.19.1 Flask 3.0.2 Flask-SocketIO 5.3.6 flatbuffers 25.2.10 fonttools 4.59.1 frozenlist 1.7.0 fsspec 2025.7.0 gpustat 1.1 gradio 4.19.2 gradio_client 0.10.1 groovy 0.1.2 h11 0.16.0 httpcore 1.0.9 httpx 0.28.1 huggingface-hub 0.21.3 humanfriendly 10.0 idna 3.10 importlib_metadata 8.7.0 importlib_resources 6.5.2 itsdangerous 2.2.0 Jinja2 3.1.6 jinxed 1.3.0 jsonschema 4.25.1 jsonschema-specifications 2025.4.1 kiwisolver 1.4.9 loguru 0.7.2 markdown-it-py 4.0.0 MarkupSafe 2.1.5 matplotlib 3.10.5 mdurl 0.1.2 mpmath 1.3.0 multidict 6.6.4 narwhals 2.1.2 networkx 3.4.2 numpy 1.26.3 nvidia-ml-py 13.580.65 onnxruntime 1.17.1 openai 1.13.3 orjson 3.11.2 packaging 25.0 pandas 2.1.4 pillow 10.4.0 pip 22.3.1 prettytable 3.16.0 propcache 0.3.2 protobuf 6.32.0 psutil 5.9.7 pycparser 2.22 pydantic 2.11.7 pydantic_core 2.33.2 pydub 0.25.1 Pygments 2.19.2 pyparsing 3.2.3 pyreadline3 3.5.4 python-dateutil 2.9.0.post0 python-dotenv 1.0.1 python-engineio 4.12.2 python-multipart 0.0.20 python-socketio 5.13.0 pytz 2025.2 pywin32 306 PyYAML 6.0.2 redis 5.0.3 referencing 0.36.2 regex 2025.7.34 requests 2.31.0 rich 14.1.0 rpds-py 0.27.0 ruff 0.12.10 safehttpx 0.1.6 safetensors 0.4.2 semantic-version 2.10.0 setuptools 65.5.0 shellingham 1.5.4 simple-websocket 1.1.0 six 1.17.0 sniffio 1.3.1 starlette 0.47.2 sympy 1.14.0 tomlkit 0.12.0 torch 2.1.2 torchaudio 2.5.1+cu118 torchvision 0.20.1+cu118 tqdm 4.67.1 transformers 4.37.0 typer 0.16.1 typing_extensions 4.14.1 typing-inspection 0.4.1 tzdata 2025.2 urllib3 2.5.0 uvicorn 0.35.0 waitress 2.1.2 wcwidth 0.2.13 websockets 11.0.3 Werkzeug 3.1.3 win32_setctime 1.2.0 wsproto 1.2.0 yarl 1.20.1 zipp 3.23.0 [notice] A new release of pip available: 22.3.1 -> 25.2 [notice] To update, run: python.exe -m pip install --upgrade pip (venv) PS E:\AI_System> # 应该包含 transformers, diskcache 等 (venv) PS E:\AI_System> # 进入Python交互模式 (venv) PS E:\AI_System> python Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
08-28
### 解决 Qwen2.5-VL 中 `_queue.Empty` 错误 当遇到 `Qwen2.5-VL` 的 `_queue.Empty` 错误时,通常意味着程序尝试从队列中获取数据但该队列为空。此错误可能发生在多线程或多进程环境中,特别是在处理异步操作或并发访问共享资源的情况下。 为了有效解决这一问题,可以采取以下几种方法: #### 1. 增加超时机制 通过设置合理的等待时间来防止立即抛出异常,允许更多的时间让其他线程填充队列。 ```python import queue try: item = q.get(timeout=5) # 设置5秒的超时时间 except queue.Empty: print('Queue is empty, no items to process.') ``` #### 2. 使用轮询方式检查队列状态 定期检查队列是否含有待处理项,在确认有可用条目后再执行取出动作。 ```python while True: try: if not q.empty(): item = q.get_nowait() break time.sleep(0.1) # 防止CPU占用过高 except queue.Empty: continue ``` #### 3. 调整生产者消费者比例 如果发现频繁出现空队列的情况,则可能是由于消费者的消费速度远超过生产者的生产能力所造成的。此时应考虑调整两者之间的平衡关系,比如增加生产者数量或者减少消费者数目等措施[^1]。 #### 4. 检查逻辑流程 确保所有负责向队列添加项目的部分正常工作,并且没有任何地方意外地中止了这些过程;同时也要验证是否存在某些条件下会跳过入队操作的情形。 以上方案可以帮助缓解乃至彻底消除因 `_queue.Empty` 导致的问题。具体实施哪种策略取决于实际应用场景以及系统的整体架构设计需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

光芒再现dev

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值