[fix] baseline4 不是 CUDA 不可用,是 .so 在非主进程里被 dlopen 时段错误。需要用进程级别的判断
This commit is contained in:
@@ -246,18 +246,15 @@ INIT_EOF
|
||||
"""Apply ix_ops patches at vllm startup."""
|
||||
import logging
|
||||
_logger = logging.getLogger("ix_startup_patch")
|
||||
_applied = False
|
||||
def apply():
|
||||
import sys, os
|
||||
# Skip in subprocess inspection (no GPU context → dlopen .so crashes)
|
||||
try:
|
||||
import torch
|
||||
if not torch.cuda.is_available():
|
||||
return 0
|
||||
except Exception:
|
||||
global _applied
|
||||
if _applied:
|
||||
return 0
|
||||
_applied = True
|
||||
import sys, os
|
||||
# Ensure ex_engine is importable
|
||||
for p in ["/workspace/qwen3_6_scripts",
|
||||
"/workspace"]:
|
||||
for p in ["/workspace/qwen3_6_scripts", "/workspace"]:
|
||||
rp = os.path.realpath(p)
|
||||
if os.path.isdir(rp) and rp not in sys.path:
|
||||
sys.path.insert(0, rp)
|
||||
@@ -279,7 +276,8 @@ def apply():
|
||||
except Exception as e:
|
||||
_logger.warning("ix_startup_patch: hot-path patches failed: %s", e)
|
||||
return n
|
||||
_n_patches = apply()
|
||||
# DO NOT call apply() at import time — registry subprocess would crash.
|
||||
# apply() is called from qwen3_5.py model init instead.
|
||||
STARTUP_EOF
|
||||
echo "[patch_ops] deployed ix_startup_patch.py"
|
||||
|
||||
|
||||
@@ -2201,6 +2201,12 @@ class Qwen3_5ForCausalLM(nn.Module, HasInnerState, SupportsLoRA,
|
||||
multimodal_config: Optional[MultiModalConfig] = None,
|
||||
prefix: str = "",
|
||||
) -> None:
|
||||
# Apply ix_bridge operator patches on first model init (safe: GPU is ready)
|
||||
try:
|
||||
from vllm import ix_startup_patch
|
||||
ix_startup_patch.apply()
|
||||
except Exception:
|
||||
pass
|
||||
_bi100_model_trace("Qwen3_5ForCausalLM initialization begin")
|
||||
super().__init__()
|
||||
self.config = config
|
||||
|
||||
Reference in New Issue
Block a user