From 5b96a911562d8c04d934b123cbb4a09bd39c18ac Mon Sep 17 00:00:00 2001 From: root Date: Mon, 17 Aug 2026 14:17:03 +0000 Subject: [PATCH] =?UTF-8?q?[fix]=20baseline4=20=E4=B8=8D=E6=98=AF=20CUDA?= =?UTF-8?q?=20=E4=B8=8D=E5=8F=AF=E7=94=A8=EF=BC=8C=E6=98=AF=20.so=20?= =?UTF-8?q?=E5=9C=A8=E9=9D=9E=E4=B8=BB=E8=BF=9B=E7=A8=8B=E9=87=8C=E8=A2=AB?= =?UTF-8?q?=20dlopen=20=E6=97=B6=E6=AE=B5=E9=94=99=E8=AF=AF=E3=80=82?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E7=94=A8=E8=BF=9B=E7=A8=8B=E7=BA=A7=E5=88=AB?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qwen3_6_scripts/patch_ops.sh | 18 ++++++++---------- qwen3_6_scripts/qwen3_5.py | 6 ++++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/qwen3_6_scripts/patch_ops.sh b/qwen3_6_scripts/patch_ops.sh index bd944641..3735d411 100755 --- a/qwen3_6_scripts/patch_ops.sh +++ b/qwen3_6_scripts/patch_ops.sh @@ -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" diff --git a/qwen3_6_scripts/qwen3_5.py b/qwen3_6_scripts/qwen3_5.py index 343e904a..408d1492 100644 --- a/qwen3_6_scripts/qwen3_5.py +++ b/qwen3_6_scripts/qwen3_5.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