From 97026cf7df8e62b767c93eabc2e96069243d6d87 Mon Sep 17 00:00:00 2001 From: MengqingCao Date: Mon, 28 Apr 2025 08:43:20 +0000 Subject: [PATCH] [Bugfix] fix triton placeholder Signed-off-by: MengqingCao --- vllm_ascend/__init__.py | 4 ++++ .../patch/worker/patch_0_8_4/patch_tritonplaceholder.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/vllm_ascend/__init__.py b/vllm_ascend/__init__.py index 7588e70ed9..c6b162f89a 100644 --- a/vllm_ascend/__init__.py +++ b/vllm_ascend/__init__.py @@ -23,5 +23,9 @@ def register(): def register_model(): + # TODO: fixme when TritonPlaceholder fixed + from vllm_ascend.utils import vllm_version_is + if vllm_version_is("0.8.4"): + import vllm_ascend.patch.worker.patch_0_8_4.patch_tritonplaceholder # noqa from .models import register_model register_model() diff --git a/vllm_ascend/patch/worker/patch_0_8_4/patch_tritonplaceholder.py b/vllm_ascend/patch/worker/patch_0_8_4/patch_tritonplaceholder.py index cd32cd1dd8..6271753bd1 100644 --- a/vllm_ascend/patch/worker/patch_0_8_4/patch_tritonplaceholder.py +++ b/vllm_ascend/patch/worker/patch_0_8_4/patch_tritonplaceholder.py @@ -17,6 +17,7 @@ # Adapted from vllm/triton_utils/importing.py # +import importlib import sys import types from importlib.util import find_spec @@ -40,6 +41,8 @@ def __init__(self): self.autotune = self._dummy_decorator("autotune") self.heuristics = self._dummy_decorator("heuristics") self.language = TritonLanguagePlaceholder() + self.__spec__ = importlib.machinery.ModuleSpec( + name="triton", loader=None, origin="placeholder") logger.warning_once( "Triton is not installed. Using dummy decorators. " "Install it via `pip install triton` to enable kernel"