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.

clamp input (#5928)

Haomingfbf68c4e522b
diff --git a/comfy/ops.py b/comfy/ops.py
index 3c5ba0124..8e0694232 100644
--- a/comfy/ops.py
+++ b/comfy/ops.py
@@ -269,7 +269,7 @@ def fp8_linear(self, input):
if scale_input is None:
scale_input = torch.ones((), device=input.device, dtype=torch.float32)
- inn = input.reshape(-1, input.shape[2]).to(dtype)
+ inn = torch.clamp(input, min=-448, max=448).reshape(-1, input.shape[2]).to(dtype)
else:
scale_input = scale_input.to(input.device)
inn = (input * (1.0 / scale_input).to(input.dtype)).reshape(-1, input.shape[2]).to(dtype)