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 fp8_e4m3fn_fast falling back to bf16 compute with dynamic VRAM (#16941)

CyrilB1531bb878b9ee352
diff --git a/comfy/ops.py b/comfy/ops.py
index 820e0a37d..d450860fe 100644
--- a/comfy/ops.py
+++ b/comfy/ops.py
@@ -928,7 +928,8 @@ def fp8_linear(self, input):
Legacy FP8 linear function for backward compatibility.
Uses QuantizedTensor subclass for dispatch.
"""
- dtype = self.weight.dtype
+ # With dynamic VRAM the weight is still in its file dtype here, use the dtype it gets cast to.
+ dtype = comfy.memory_management.tensors_to_geometries([self.weight])[0].dtype
if dtype not in [torch.float8_e4m3fn]:
return None