Skip to content

Commit

Permalink
fp8 casting is fast on GPUs that support fp8 compute.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Oct 20, 2024
1 parent a68bbaf commit 471cd3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions comfy/model_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@ def unet_dtype(device=None, model_params=0, supported_dtypes=[torch.float16, tor
pass

if fp8_dtype is not None:
if supports_fp8_compute(device): #if fp8 compute is supported the casting is most likely not expensive
return fp8_dtype

free_model_memory = maximum_vram_for_weights(device)
if model_params * 2 > free_model_memory:
return fp8_dtype
Expand Down

0 comments on commit 471cd3e

Please sign in to comment.