[Build] Force torch version (#3791)
We notice that sometimes user build vllm-ascend with incorrect torch
version. In this case, the build is passed, but when running the code,
the error `AttributeError: '_OpNamespace' '_C_ascend' object has no
attribute 'weak_ref_tensor'` is raised. Let's force the torch version to
2.7.1 and check the torch version when build from source to fix the
issue.
closes: #3342
- vLLM version: v0.11.0rc3
- vLLM main:
c9461e05a4
Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
This commit is contained in:
@@ -20,6 +20,13 @@ set(VLLM_ASCEND_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
find_package(Torch REQUIRED)
|
||||
|
||||
run_python(TORCH_VERSION
|
||||
"import torch; print(torch.__version__)" "Failed to locate torch path")
|
||||
# check torch version is 2.7.1
|
||||
if(NOT ${TORCH_VERSION} VERSION_EQUAL "2.7.1")
|
||||
message(FATAL_ERROR "Expected PyTorch version 2.7.1, but found ${TORCH_VERSION}")
|
||||
endif()
|
||||
|
||||
set(RUN_MODE "npu" CACHE STRING "cpu/sim/npu")
|
||||
set(SOC_VERSION ${SOC_VERSION})
|
||||
message(STATUS "Detected SOC version: ${SOC_VERSION}")
|
||||
|
||||
Reference in New Issue
Block a user