From be4062fd6c56ba5528a8e0d3b0bbe1e2be8d22e9 Mon Sep 17 00:00:00 2001 From: Wentao Ye <44945378+yewentao256@users.noreply.github.com> Date: Thu, 28 May 2026 11:00:56 -0400 Subject: [PATCH] [Bug] Fix `tests/distributed/test_elastic_ep.py - assert False` (#43813) Signed-off-by: yewentao256 --- vllm/v1/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vllm/v1/utils.py b/vllm/v1/utils.py index cb80af4b1b..efbf2daf39 100644 --- a/vllm/v1/utils.py +++ b/vllm/v1/utils.py @@ -117,8 +117,12 @@ class CpuGpuBuffer: pin_memory: bool, with_numpy: bool = True, ) -> None: - self.cpu = torch.zeros(*size, dtype=dtype, device="cpu", pin_memory=pin_memory) - self.gpu = torch.zeros_like(self.cpu, device=device) + # these buffers are mutable runtime state, so allocate them as normal + with torch.inference_mode(False): + self.cpu = torch.zeros( + *size, dtype=dtype, device="cpu", pin_memory=pin_memory + ) + self.gpu = torch.zeros_like(self.cpu, device=device) self.np: np.ndarray # To keep type hints simple (avoiding generics and subclasses), we # only conditionally create the numpy array attribute. This can cause