llamafactory-cli webui启动报错TypeError: argument of type ‘bool‘ is not iterable

一、问题

在阿里云NoteBook上启动llamafactory-cli webui报错TypeError: argument of type 'bool' is not iterable

复制代码
This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.11/site-packages/gradio/route_utils.py", line 789, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 714, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 734, in app
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 37, in run_in_threadpool
    return await anyio.to_thread.run_sync(func)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio/routes.py", line 584, in main
    gradio_api_info = api_info(request)
                      ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio/routes.py", line 615, in api_info
    api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio/blocks.py", line 3019, in get_api_info
    python_type = client_utils.json_schema_to_python_type(info)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 931, in json_schema_to_python_type
    type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 976, in _json_schema_to_python_type
    elements = _json_schema_to_python_type(items, defs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 946, in _json_schema_to_python_type
    return _json_schema_to_python_type(defs[schema["$ref"].split("/")[-1]], defs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 985, in _json_schema_to_python_type
    des = [
          ^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 986, in <listcomp>
    f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 998, in _json_schema_to_python_type
    desc = " | ".join([_json_schema_to_python_type(i, defs) for i in schema[type_]])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 998, in <listcomp>
    desc = " | ".join([_json_schema_to_python_type(i, defs) for i in schema[type_]])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 946, in _json_schema_to_python_type
    return _json_schema_to_python_type(defs[schema["$ref"].split("/")[-1]], defs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 985, in _json_schema_to_python_type
    des = [
          ^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 986, in <listcomp>
    f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 993, in _json_schema_to_python_type
    f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 939, in _json_schema_to_python_type
    type_ = get_type(schema)
            ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio_client/utils.py", line 898, in get_type
    if "const" in schema:
       ^^^^^^^^^^^^^^^^^
TypeError: argument of type 'bool' is not iterable
...
二、问题解决

pydantic版本回退到: 2.10.6

复制代码
pip uninstall pydantic
pip install pydantic==2.10.6

重新启动llamafactory-cli webui,能够正常通过浏览器打开webui


参考:

https://juejin.cn/post/7490524670082449471

相关推荐
曲幽5 天前
零基础快速搭建AI绘画网站!用Gradio玩转Stable Diffusion
python·ai作画·stable diffusion·gradio·diffusers·webui
WEL测试2 个月前
颠覆传统软件测试!Browser Use WebUI+DeepSeek:软件测试行业的革命性突破
ui自动化·webui·ui测试·browser use
政安晨2 个月前
政安晨的AI大模型训练实践 九 - 熟悉LLaMA Factory的详细参数含义-基本概念理解一下
ai训练·基本概念·llamafactory
奋斗的袍子0072 个月前
DeepSeek-R1本地部署详细指南!(Ollama+Chatbox AI+Open WebUI)
人工智能·后端·深度学习·大模型·webui·本地部署·deepseek
skywalk81633 个月前
open-webui启动报错:OSError: [WinError 1314] 客户端没有所需的特权。
人工智能·windows·webui
政安晨3 个月前
政安晨的AI大模型训练实践三:熟悉一下LF训练模型的WebUI
人工智能·python·llama·webui·训练大模型·llama factory工具·llama-3.2-1b
kida_yuan4 个月前
【从零开始】11. LLaMA-Factory 微调 Qwen 模型(番外篇)
人工智能·指令微调·llamafactory
Nicolas8934 个月前
【大模型实战篇】LLaMA Factory微调ChatGLM-4-9B模型
大模型·全参微调·大模型微调·glm4·llamafactory·chatglm9b
MavenTalk5 个月前
ComfyUI 与 Stable Diffusion WebUI 的优缺点比较
stable diffusion·ai绘画·comfyui·webui·ai助手