Skip to content

Commit 46624be

Browse files
committed
explict init cuda context
1 parent 11ac0ba commit 46624be

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lightllm/utils/vllm_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33

44
logger = init_logger(__name__)
55
try:
6+
if not torch.cuda.is_initialized():
7+
torch.cuda.init()
68
from vllm import _custom_ops as ops
79

810
vllm_ops = ops
911
HAS_VLLM = True
1012
cutlass_scaled_mm = torch.ops._C.cutlass_scaled_mm
13+
1114
except:
1215
HAS_VLLM = False
1316
cutlass_scaled_mm = None

0 commit comments

Comments
 (0)