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.

Use .itemsize to get dtype size for fp8.

comfyanonymousca82ade7652c
diff --git a/comfy/model_management.py b/comfy/model_management.py
index 18d15f9d0..94d596969 100644
--- a/comfy/model_management.py
+++ b/comfy/model_management.py
@@ -430,6 +430,13 @@ def dtype_size(dtype):
dtype_size = 4
if dtype == torch.float16 or dtype == torch.bfloat16:
dtype_size = 2
+ elif dtype == torch.float32:
+ dtype_size = 4
+ else:
+ try:
+ dtype_size = dtype.itemsize
+ except: #Old pytorch doesn't have .itemsize
+ pass
return dtype_size
def unet_offload_device():