You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ray Serve中_serve_asgi_lifespan是什么?如何解决VLLMDeployment属性错误?

Ray + vLLM 部署报错:'VLLMDeployment' object has no attribute '_serve_asgi_lifespan' 解决求助

问题

部署Ray + vLLM时触发AttributeError,错误提示:'VLLMDeployment' object has no attribute '_serve_asgi_lifespan'

操作步骤

  • 拉取Ray Docker镜像2.35.0-py312-gpu并创建容器
  • 执行依赖安装命令:pip install "ray[serve]" requests vllm
  • 创建llm.py文件后运行启动命令:serve run llm:build_app model="NousResearch/Meta-Llama-3-8B-Instruct" tensor-parallel-size=2

错误日志

(ServeReplica:default:VLLMDeployment pid=2839) ERROR 2024-09-16 01:40:43,815 default_VLLMDeployment imhgemig replica.py:1202 - Exception during graceful shutdown of replica: 'VLLMDeployment' object has no attribute '_serve_asgi_lifespan'
(ServeReplica:default:VLLMDeployment pid=2839)   File "/home/ray/anaconda3/lib/python3.12/site-packages/ray/serve/_private/replica.py", line 1196, in call_destructor
(ServeReplica:default:VLLMDeployment pid=2839)     await self._call_func_or_gen(self._callable.__del__)
(ServeReplica:default:VLLMDeployment pid=2839)     result = await result
(ServeReplica:default:VLLMDeployment pid=2839)   File "/home/ray/anaconda3/lib/python3.12/site-packages/ray/serve/api.py", line 225, in __del__
(ServeReplica:default:VLLMDeployment pid=2839)     await ASGIAppReplicaWrapper.__del__(self)
(ServeReplica:default:VLLMDeployment pid=2839)   File "/home/ray/anaconda3/lib/python3.12/site-packages/ray/serve/_private/http_util.py", line 472, in __del__
(ServeReplica:default:VLLMDeployment pid=2839)     with LoggingContext(self._serve_asgi_lifespan.logger, level=logging.WARNING):
(ServeReplica:default:VLLMDeployment pid=2839) AttributeError: 'VLLMDeployment' object has no attribute '_serve_asgi_lifespan'

背景说明

刚接触Ray,对Ray和FastAPI不熟悉,不清楚_serve_asgi_lifespan的含义。


内容的提问来源于stack exchange,提问作者dmjy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 07:34:52