From d9064550b22ca4fa5dd2d66807a67c3255e9e59a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 11 Aug 2026 10:45:35 +0000 Subject: [PATCH] =?UTF-8?q?fix(CRITICAL):=20launch=5Fserver.py=E7=94=A8exe?= =?UTF-8?q?cvp=E5=90=AF=E5=8A=A8api=5Fserver=E2=80=94=E2=80=94import=20*?= =?UTF-8?q?=E4=B8=8D=E8=A7=A6=E5=8F=91=5F=5Fmain=5F=5F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原来的 from vllm...api_server import * 只执行了 import 阶段的 side-effects (torch/tensorflow warnings), 但不触发 if __name__ == '__main__' 所以服务器永远不启动, 进程直接退出。 改用 os.execvp 替换进程为 python3 -m vllm.entrypoints.openai.api_server, 传递所有CLI参数, 这是force patch后最安全的启动方式。 --- qwen3_6_scripts/launch_server.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qwen3_6_scripts/launch_server.py b/qwen3_6_scripts/launch_server.py index acdb5239..8de16c1b 100644 --- a/qwen3_6_scripts/launch_server.py +++ b/qwen3_6_scripts/launch_server.py @@ -45,5 +45,9 @@ def _force_patch(): _force_patch() -# Now run the standard vllm api_server with our patched version -from vllm.entrypoints.openai.api_server import * +# execvp replaces this process with vllm api_server, passing all CLI args through. +# This is the safest approach: no import issues, our patched files are already on disk. +print("[launch] Starting vllm api_server with args:", sys.argv[1:], file=sys.stderr) +os.execvp(sys.executable, [ + sys.executable, "-m", "vllm.entrypoints.openai.api_server" +] + sys.argv[1:])