Skip to content

Commit 55ebd28

Browse files
Add a supports_fp64 function. (Comfy-Org#13368)
1 parent a2840e7 commit 55ebd28

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

comfy/ldm/flux/math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None, transforme
1616

1717
def rope(pos: Tensor, dim: int, theta: int) -> Tensor:
1818
assert dim % 2 == 0
19-
if comfy.model_management.is_device_mps(pos.device) or comfy.model_management.is_intel_xpu() or comfy.model_management.is_directml_enabled():
19+
if not comfy.model_management.supports_fp64(pos.device):
2020
device = torch.device("cpu")
2121
else:
2222
device = pos.device

comfy/model_management.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,21 @@ def supports_mxfp8_compute(device=None):
17321732

17331733
return True
17341734

1735+
def supports_fp64(device=None):
1736+
if is_device_mps(device):
1737+
return False
1738+
1739+
if is_intel_xpu():
1740+
return False
1741+
1742+
if is_directml_enabled():
1743+
return False
1744+
1745+
if is_ixuca():
1746+
return False
1747+
1748+
return True
1749+
17351750
def extended_fp16_support():
17361751
# TODO: check why some models work with fp16 on newer torch versions but not on older
17371752
if torch_version_numeric < (2, 7):

0 commit comments

Comments
 (0)