mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-08-26 14:57:58 +08:00
copy conds to device before repeating
This commit is contained in:
parent
87f4673af9
commit
baf1e9f1fe
@ -11,17 +11,13 @@ class CONDRegular:
|
|||||||
def _copy_with(self, cond):
|
def _copy_with(self, cond):
|
||||||
return self.__class__(cond)
|
return self.__class__(cond)
|
||||||
|
|
||||||
def _pin_memory(self, cond):
|
def _pin_cond(self, device):
|
||||||
if cond.device == torch.device('cpu'):
|
if self.cond.device == torch.device('cpu') and device_supports_non_blocking(device):
|
||||||
return cond.pin_memory()
|
self.cond = self.cond.pin_memory(device)
|
||||||
else:
|
|
||||||
return cond
|
|
||||||
|
|
||||||
def process_cond(self, batch_size, device, **kwargs):
|
def process_cond(self, batch_size, device, **kwargs):
|
||||||
if device_supports_non_blocking(device):
|
self._pin_cond(device)
|
||||||
return self._copy_with(comfy.utils.repeat_to_batch_size(self._pin_memory(self.cond), batch_size).to(device, non_blocking=True))
|
return self._copy_with(comfy.utils.repeat_to_batch_size(self.cond.to(device, non_blocking=device_supports_non_blocking(device)), batch_size))
|
||||||
else:
|
|
||||||
return self._copy_with(comfy.utils.repeat_to_batch_size(self.cond, batch_size).to(device))
|
|
||||||
|
|
||||||
def can_concat(self, other):
|
def can_concat(self, other):
|
||||||
if self.cond.shape != other.cond.shape:
|
if self.cond.shape != other.cond.shape:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user