开发者社区 > 大数据与机器学习 > 人工智能平台PAI > 正文

机器学习PAI服务运行中了,但不可用,调用时报错,如何解决?

机器学习PAI服务运行中了,但不可用,调用时报错?
[2024-03-06 11:38:11] ERROR: Exception in ASGI application
[2024-03-06 11:38:11] Traceback (most recent call last):
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
[2024-03-06 11:38:11] result = await app( # type: ignore[func-returns-value]
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
[2024-03-06 11:38:11] return await self.app(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 1054, in call
[2024-03-06 11:38:11] await super().call(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 123, in call
[2024-03-06 11:38:11] await self.middleware_stack(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 186, in call
[2024-03-06 11:38:11] raise exc
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 164, in call
[2024-03-06 11:38:11] await self.app(scope, receive, _send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py", line 83, in call
[2024-03-06 11:38:11] await self.app(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py", line 83, in call
[2024-03-06 11:38:11] await self.app(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 62, in call
[2024-03-06 11:38:11] await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
[2024-03-06 11:38:11] raise exc
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
[2024-03-06 11:38:11] await app(scope, receive, sender)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 758, in call
[2024-03-06 11:38:11] await self.middleware_stack(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 778, in app
[2024-03-06 11:38:11] await route.handle(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 299, in handle
[2024-03-06 11:38:11] await self.app(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 79, in app
[2024-03-06 11:38:11] await wrap_app_handling_exceptions(app, request)(scope, receive, send)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
[2024-03-06 11:38:11] raise exc
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
[2024-03-06 11:38:11] await app(scope, receive, sender)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 74, in app
[2024-03-06 11:38:11] response = await func(request)
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 299, in app
[2024-03-06 11:38:11] raise e
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 294, in app
[2024-03-06 11:38:11] raw_response = await run_endpoint_function(
[2024-03-06 11:38:11] File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 191, in run_endpoint_function
[2024-03-06 11:38:11] return await dependant.call(**values)
[2024-03-06 11:38:11] File "/code/ChatLLM-webui/webui/entrypoints/api_server.py", line 242, in chat_api
[2024-03-06 11:38:11] if cmd_opts.enable_lora:
[2024-03-06 11:38:11] AttributeError: 'Namespace' object has no attribute 'enable_lora'
image.png
我加了这个 现在起来了

展开
收起
真的很搞笑 2024-03-11 15:04:15 78 0
3 条回答
写回答
取消 提交回答
  • 面对过去,不要迷离;面对未来,不必彷徨;活在今天,你只要把自己完全展示给别人看。

    从报错信息来看,问题出在api_server.py文件的第242行,Namespace对象没有enable_lora属性。为了解决这个问题,你需要检查Namespace对象的定义以及enable_lora属性的设置。

    首先,确保你在创建Namespace对象时定义了enable_lora属性。例如:

    from argparse import Namespace
    
    cmd_opts = Namespace(enable_lora=True)
    

    然后,在第242行之前,确保你已经正确地设置了enable_lora属性的值。例如:

    if hasattr(cmd_opts, 'enable_lora'):
        if cmd_opts.enable_lora:
            # 你的代码逻辑
    

    这样,当enable_lora属性存在且值为True时,才会执行相应的代码逻辑。

    2024-03-12 13:50:59
    赞同 展开评论 打赏
  • 看着像是vllm在分配显存池的时候没有拿到足够的空间,试试设置下--gpu-memory-utilization,比如0.98 还有 --max-model-len,比如4096 ,此回答整理自钉群“机器学习PAI交流群(答疑@值班)”

    2024-03-11 16:16:08
    赞同 展开评论 打赏
  • 将军百战死,壮士十年归!

    看起来是在运行机器学习 PAI 服务时发生了错误。根据报错信息,似乎是在 api_server.py 文件的 chat_api 函数中,尝试访问一个名为 enable_lora 的属性时出现了问题。

    可能的原因之一是 cmd_opts 对象没有 enable_lora 属性。你可以检查 cmd_opts 对象的定义或者在调用 chat_api 函数之前确保 cmd_opts 对象具有 enable_lora 属性。

    另外,也可以检查代码中是否有其他地方在使用 cmd_opts.enable_lora,确保相关的代码逻辑没有问题。

    如果问题仍然存在,你可能需要进一步检查代码的其他部分,或者提供更多的代码上下文,以便更准确地确定问题的原因和解决方法。

    2024-03-11 15:33:47
    赞同 展开评论 打赏

人工智能平台 PAI(Platform for AI,原机器学习平台PAI)是面向开发者和企业的机器学习/深度学习工程平台,提供包含数据标注、模型构建、模型训练、模型部署、推理优化在内的AI开发全链路服务,内置140+种优化算法,具备丰富的行业场景插件,为用户提供低门槛、高性能的云原生AI工程化能力。

相关产品

  • 人工智能平台 PAI
  • 热门讨论

    热门文章

    相关电子书

    更多
    大规模机器学习在蚂蚁+阿里的应用 立即下载
    阿里巴巴机器学习平台AI 立即下载
    微博机器学习平台架构和实践 立即下载