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