Skip to content

Commit 46df67a

Browse files
authored
[bugfix] Improve log level and info for custom ops build (#937)
### What this PR does / why we need it? Fix the bug of #703, where vllm wrong raised the ERROR : Failed to import vllm_ascend_C:No module named 'vllm_ascend.vllm_ascend_C'. The format for reporting import vllm_ascend_C failure is unified by warning ("Failed to import vllm_ascend_C:%s", e). ### Does this PR introduce _any_ user-facing change? No --------- Signed-off-by: yangpuPKU <604425840@qq.com>
1 parent 8ddc0a1 commit 46df67a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

vllm_ascend/device_allocator/camem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def find_loaded_library(lib_name) -> Optional[str]:
6060
lib_name = find_loaded_library("vllm_ascend_C")
6161
camem_available = True
6262
except ImportError as e:
63-
logger.error("Failed to import vllm_ascend_C:%s", e)
63+
logger.warning(
64+
"Failed to import vllm_ascend_C:%s. Sleep mode will be disabled. ", e)
6465
init_module = None
6566
python_create_and_map = None
6667
python_unmap_and_release = None

vllm_ascend/platform.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@
3131
try:
3232
# register custom ops into torch_library here
3333
import vllm_ascend.vllm_ascend_C # type: ignore # noqa: F401
34-
35-
except ImportError:
36-
logging.warning(
37-
"Warning: Failed to register custom ops, all custom ops will be disabled"
38-
)
39-
else:
4034
CUSTOM_OP_ENABLED = True
35+
except ImportError as e:
36+
logging.warning(
37+
"Failed to import 'vllm_ascend.vllm_ascend_C': %s. All custom ops will be disabled. ",
38+
e)
4139

4240
if TYPE_CHECKING:
4341
from vllm.config import ModelConfig, VllmConfig

0 commit comments

Comments
 (0)