Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions comfy/model_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,9 @@ def pin_memory(tensor):
if MAX_PINNED_MEMORY <= 0:
return False

if type(tensor) is not torch.nn.parameter.Parameter:
return False

if not is_device_cpu(tensor.device):
return False

Expand All @@ -1116,6 +1119,9 @@ def pin_memory(tensor):
#on the GPU async. So dont trust the CUDA API and guard here
return False

if not tensor.is_contiguous():
return False

size = tensor.numel() * tensor.element_size()
if (TOTAL_PINNED_MEMORY + size) > MAX_PINNED_MEMORY:
return False
Expand Down