[Model Runner V2] Tolerate lack of pinned memory support (#56908)

Signed-off-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
Nick Hill
2026-09-14 21:28:32 -07:00
committed by GitHub
parent 45779ef99f
commit f84b0c4bce
2 changed files with 40 additions and 11 deletions
+3 -5
View File
@@ -4,13 +4,11 @@ from collections.abc import Sequence
import torch
from vllm.utils.platform_utils import is_uva_available
class UvaBuffer:
def __init__(self, size: int | Sequence[int], dtype: torch.dtype):
if not is_uva_available():
raise RuntimeError("UVA is not available")
self.cpu = torch.zeros(size, dtype=dtype, device="cpu")
self.np = self.cpu.numpy()
self.uva = self.cpu
def uva(self, n: int | None = None):
return self.cpu[:n] if n is not None else self.cpu