Add some warnings and prevent crash when cond devices don't match. (#9169)

This commit is contained in:
comfyanonymous
2025-08-04 01:20:12 -07:00
committed by GitHub
parent 7991341e89
commit 84f9759424
2 changed files with 8 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import torch
import math
import comfy.utils
import logging
class CONDRegular:
@@ -16,6 +17,9 @@ class CONDRegular:
def can_concat(self, other):
if self.cond.shape != other.cond.shape:
return False
if self.cond.device != other.cond.device:
logging.warning("WARNING: conds not on same device, skipping concat.")
return False
return True
def concat(self, others):
@@ -51,6 +55,9 @@ class CONDCrossAttn(CONDRegular):
diff = mult_min // min(s1[1], s2[1])
if diff > 4: #arbitrary limit on the padding because it's probably going to impact performance negatively if it's too much
return False
if self.cond.device != other.cond.device:
logging.warning("WARNING: conds not on same device: skipping concat.")
return False
return True
def concat(self, others):