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 bislerp work on GPU.
comfyanonymousc962884a5c98
diff --git a/comfy/utils.py b/comfy/utils.pyindex 4b484d07a..1985012e0 100644--- a/comfy/utils.py+++ b/comfy/utils.py@@ -307,13 +307,13 @@ def bislerp(samples, width, height):res[dot < 1e-5 - 1] = (b1 * (1.0-r) + b2 * r)[dot < 1e-5 - 1]return res- def generate_bilinear_data(length_old, length_new):- coords_1 = torch.arange(length_old).reshape((1,1,1,-1)).to(torch.float32)+ def generate_bilinear_data(length_old, length_new, device):+ coords_1 = torch.arange(length_old, dtype=torch.float32, device=device).reshape((1,1,1,-1))coords_1 = torch.nn.functional.interpolate(coords_1, size=(1, length_new), mode="bilinear")ratios = coords_1 - coords_1.floor()coords_1 = coords_1.to(torch.int64)- coords_2 = torch.arange(length_old).reshape((1,1,1,-1)).to(torch.float32) + 1+ coords_2 = torch.arange(length_old, dtype=torch.float32, device=device).reshape((1,1,1,-1)) + 1coords_2[:,:,:,-1] -= 1coords_2 = torch.nn.functional.interpolate(coords_2, size=(1, length_new), mode="bilinear")coords_2 = coords_2.to(torch.int64)@@ -323,7 +323,7 @@ def bislerp(samples, width, height):h_new, w_new = (height, width)#linear w- ratios, coords_1, coords_2 = generate_bilinear_data(w, w_new)+ ratios, coords_1, coords_2 = generate_bilinear_data(w, w_new, samples.device)coords_1 = coords_1.expand((n, c, h, -1))coords_2 = coords_2.expand((n, c, h, -1))ratios = ratios.expand((n, 1, h, -1))@@ -336,7 +336,7 @@ def bislerp(samples, width, height):result = result.reshape(n, h, w_new, c).movedim(-1, 1)#linear h- ratios, coords_1, coords_2 = generate_bilinear_data(h, h_new)+ ratios, coords_1, coords_2 = generate_bilinear_data(h, h_new, samples.device)coords_1 = coords_1.reshape((1,1,-1,1)).expand((n, c, -1, w_new))coords_2 = coords_2.reshape((1,1,-1,1)).expand((n, c, -1, w_new))ratios = ratios.reshape((1,1,-1,1)).expand((n, 1, -1, w_new))