From fbf68c4e522bada2b847b589088ef248847f2a63 Mon Sep 17 00:00:00 2001 From: Haoming <73768377+Haoming02@users.noreply.github.com> Date: Sun, 8 Dec 2024 03:00:31 +0800 Subject: [PATCH] clamp input (#5928) --- comfy/ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/ops.py b/comfy/ops.py index 3c5ba012..8e069423 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)