From 39f114c44bb99d4a221e8da451d4f2a20119c674 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 18 Aug 2024 16:53:17 -0400 Subject: [PATCH] Less broken non blocking? --- comfy/ops.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/comfy/ops.py b/comfy/ops.py index d76138c..ce13291 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -21,8 +21,9 @@ import comfy.model_management def cast_to(weight, dtype=None, device=None, non_blocking=False): - non_blocking = False - return weight.to(device=device, dtype=dtype, non_blocking=non_blocking) + r = torch.empty_like(weight, dtype=dtype, device=device) + r.copy_(weight, non_blocking=non_blocking) + return r def cast_to_input(weight, input, non_blocking=False): return cast_to(weight, input.dtype, input.device, non_blocking=non_blocking)