From 2a9d995c09dd16c06e457664028c732d7f3bc16a Mon Sep 17 00:00:00 2001 From: lbk-sys <85090337+lbk-sys@users.noreply.github.com> Date: Sun, 28 Sep 2025 16:39:17 +0800 Subject: [PATCH] prepare for sglang+verl (#10555) Signed-off-by: lbk-sys Signed-off-by: libaokui Co-authored-by: libaokui Co-authored-by: Even Zhou --- python/sglang/srt/patch_torch.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/sglang/srt/patch_torch.py b/python/sglang/srt/patch_torch.py index 8d90ce4c0..6dc329a9d 100644 --- a/python/sglang/srt/patch_torch.py +++ b/python/sglang/srt/patch_torch.py @@ -17,10 +17,18 @@ import torch from packaging import version from torch.multiprocessing import reductions +from sglang.srt.utils import is_npu + +_is_npu = is_npu() + def monkey_patch_torch_reductions(): """Monkey patching before Torch https://github.com/pytorch/pytorch/pull/149248 is fixed""" + # Currently, NPU does not support UUID. This has been temporarily commented out, with support expected in the fourth quarter. + if _is_npu: + return + if hasattr(reductions, "_reduce_tensor_original"): return