[Bugfix][CPU] Fix CPU model runner v2 (#46365)
Signed-off-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
@@ -17,6 +17,10 @@ def noop(*args: Any, **kwargs: Any) -> None:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def fake_pin_memory(self: torch.Tensor, *args: Any, **kwargs: Any) -> torch.Tensor:
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
class _EventPlaceholder:
|
class _EventPlaceholder:
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
self.record = noop
|
self.record = noop
|
||||||
@@ -41,6 +45,7 @@ torch.cuda.set_stream = noop
|
|||||||
torch.cuda.current_stream = lambda *args, **kwargs: _StreamPlaceholder()
|
torch.cuda.current_stream = lambda *args, **kwargs: _StreamPlaceholder()
|
||||||
torch.accelerator.synchronize = noop
|
torch.accelerator.synchronize = noop
|
||||||
torch.accelerator.empty_cache = noop
|
torch.accelerator.empty_cache = noop
|
||||||
|
torch.Tensor.pin_memory = fake_pin_memory
|
||||||
|
|
||||||
# Patch vLLM torch utils
|
# Patch vLLM torch utils
|
||||||
import vllm.utils.torch_utils as torch_utils
|
import vllm.utils.torch_utils as torch_utils
|
||||||
|
|||||||
Reference in New Issue
Block a user