Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Fix onnx export not working on flux.

comfyanonymousc27ebeb1c2b7
diff --git a/comfy/ldm/common_dit.py b/comfy/ldm/common_dit.py
index 9016abc44..5aebaf9ea 100644
--- a/comfy/ldm/common_dit.py
+++ b/comfy/ldm/common_dit.py
@@ -14,7 +14,7 @@ except:
rms_norm_torch = None
def rms_norm(x, weight, eps=1e-6):
- if rms_norm_torch is not None:
+ if rms_norm_torch is not None and not (torch.jit.is_tracing() or torch.jit.is_scripting()):
return rms_norm_torch(x, weight.shape, weight=comfy.ops.cast_to(weight, dtype=x.dtype, device=x.device), eps=eps)
else:
rrms = torch.rsqrt(torch.mean(x**2, dim=-1, keepdim=True) + eps)