The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Make cast_to a nop if weight is already good.
comfyanonymous538cb068bc10
diff --git a/comfy/ops.py b/comfy/ops.pyindex ce132911c..418d59e1c 100644--- a/comfy/ops.py+++ b/comfy/ops.py@@ -21,6 +21,8 @@ import comfy.model_managementdef cast_to(weight, dtype=None, device=None, non_blocking=False):+ if (dtype is None or weight.dtype == dtype) and (device is None or weight.device == device):+ return weightr = torch.empty_like(weight, dtype=dtype, device=device)r.copy_(weight, non_blocking=non_blocking)return r