The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Revert changes in comfy/ldm/modules/diffusionmodules/util.py, which is unused.
Simon Lui2da73b7073dc
diff --git a/comfy/ldm/modules/diffusionmodules/util.py b/comfy/ldm/modules/diffusionmodules/util.pyindex 9d07d9359..d890c8044 100644--- a/comfy/ldm/modules/diffusionmodules/util.py+++ b/comfy/ldm/modules/diffusionmodules/util.py@@ -15,7 +15,6 @@ import torch.nn as nnimport numpy as npfrom einops import repeat-from comfy import model_managementfrom comfy.ldm.util import instantiate_from_configimport comfy.ops@@ -140,22 +139,13 @@ class CheckpointFunction(torch.autograd.Function):@staticmethoddef backward(ctx, *output_grads):ctx.input_tensors = [x.detach().requires_grad_(True) for x in ctx.input_tensors]- if model_management.is_nvidia():- with torch.enable_grad(), \- torch.cuda.amp.autocast(**ctx.gpu_autocast_kwargs):- # Fixes a bug where the first op in run_function modifies the- # Tensor storage in place, which is not allowed for detach()'d- # Tensors.- shallow_copies = [x.view_as(x) for x in ctx.input_tensors]- output_tensors = ctx.run_function(*shallow_copies)- elif model_management.is_intel_xpu():- with torch.enable_grad(), \- torch.xpu.amp.autocast(**ctx.gpu_autocast_kwargs):- # Fixes a bug where the first op in run_function modifies the- # Tensor storage in place, which is not allowed for detach()'d- # Tensors.- shallow_copies = [x.view_as(x) for x in ctx.input_tensors]- output_tensors = ctx.run_function(*shallow_copies)+ with torch.enable_grad(), \+ torch.cuda.amp.autocast(**ctx.gpu_autocast_kwargs):+ # Fixes a bug where the first op in run_function modifies the+ # Tensor storage in place, which is not allowed for detach()'d+ # Tensors.+ shallow_copies = [x.view_as(x) for x in ctx.input_tensors]+ output_tensors = ctx.run_function(*shallow_copies)input_grads = torch.autograd.grad(output_tensors,ctx.input_tensors + ctx.input_params,