mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
[BugFix] fix cuda-python requirement (#5261)
* fix cuda-python requirement * update * fix
This commit is contained in:
@@ -1807,6 +1807,15 @@ class FDConfig:
|
||||
int(envs.FD_DISABLED_RECOVER) == 0
|
||||
), "FD_DISABLED_RECOVER is not supported while ENABLE_V1_KVCACHE_SCHEDULER is turned on."
|
||||
|
||||
if self.eplb_config is not None and self.eplb_config.enable_eplb:
|
||||
try:
|
||||
import cuda # noqa
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"cuda-python not installed. Install the version matching your CUDA toolkit:\n"
|
||||
" CUDA 12.x → pip install cuda-python==12.*\n"
|
||||
)
|
||||
|
||||
def print(self):
|
||||
"""
|
||||
print all config
|
||||
|
||||
@@ -22,7 +22,11 @@ from typing import List, Tuple
|
||||
|
||||
import numpy as np
|
||||
import paddle
|
||||
from cuda import cudart
|
||||
|
||||
try:
|
||||
from cuda import cudart
|
||||
except ImportError:
|
||||
cudart = None
|
||||
|
||||
from fastdeploy.config import EPLBConfig
|
||||
|
||||
@@ -90,6 +94,12 @@ def create_mmap(model_name: List, ep_rank: int, ep_size: int, shm_uuid: str, epl
|
||||
shm_ptr = ctypes.cast(shm_ptr, ctypes.POINTER(ctypes.c_int8))
|
||||
addr = ctypes.addressof(shm_ptr.contents)
|
||||
|
||||
if cudart is None:
|
||||
raise ImportError(
|
||||
"cuda-python not installed. Install the version matching your CUDA toolkit:\n"
|
||||
" CUDA 12.x → pip install cuda-python==12.*\n"
|
||||
)
|
||||
|
||||
# Register memory with CUDA
|
||||
(ret,) = cudart.cudaHostRegister(addr, shm_size, 0)
|
||||
if ret != cudart.cudaError_t.cudaSuccess:
|
||||
|
||||
@@ -46,4 +46,3 @@ msgspec
|
||||
einops
|
||||
setproctitle
|
||||
aistudio_sdk
|
||||
cuda-python==12.8
|
||||
|
||||
Reference in New Issue
Block a user