From 949df832347eaea690aaaa9a5d76bea737d8cf1d Mon Sep 17 00:00:00 2001 From: Yao Chi Date: Sun, 25 Aug 2024 23:48:08 +0800 Subject: [PATCH] refine comy/ops.py --- comfy/ops.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/comfy/ops.py b/comfy/ops.py index ac13e7abb..a80e8cd0c 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -309,15 +309,3 @@ def pick_operations(weight_dtype, compute_dtype, load_device=None): if comfy.model_management.supports_fp8_compute(load_device): return fp8_ops return manual_cast - -def fp8_quantize(weight, qdtype=torch.float8_e4m3fn): - device = weight.device - finfo = torch.finfo(qdtype) - scale = finfo.max / weight.abs().max().clamp(min=1e-12) - - qweight = (weight * scale).clamp(min=finfo.min, max=finfo.max) - # Return both float8 data and the inverse scale (as float), - # as both required as inputs to torch._scaled_mm - qweight = qweight.to(qdtype) - scale = scale.float().reciprocal() - return qweight, scale \ No newline at end of file