mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-25 16:37:23 +08:00
model_base: support non-dynamic disable cases
This commit is contained in:
parent
d73b819eda
commit
dfdb4071a6
@ -908,7 +908,7 @@ class LTXAVModel(LTXVModel):
|
|||||||
"""Process transformer blocks for LTXAV."""
|
"""Process transformer blocks for LTXAV."""
|
||||||
patches_replace = transformer_options.get("patches_replace", {})
|
patches_replace = transformer_options.get("patches_replace", {})
|
||||||
blocks_replace = patches_replace.get("dit", {})
|
blocks_replace = patches_replace.get("dit", {})
|
||||||
prefetch_queue = comfy.model_prefetch.make_prefetch_queue(list(self.transformer_blocks), vx.device)
|
prefetch_queue = comfy.model_prefetch.make_prefetch_queue(list(self.transformer_blocks), vx.device, transformer_options)
|
||||||
|
|
||||||
# Process transformer blocks
|
# Process transformer blocks
|
||||||
for i, block in enumerate(self.transformer_blocks):
|
for i, block in enumerate(self.transformer_blocks):
|
||||||
|
|||||||
@ -210,6 +210,11 @@ class BaseModel(torch.nn.Module):
|
|||||||
if "latent_shapes" in extra_conds:
|
if "latent_shapes" in extra_conds:
|
||||||
xc = utils.unpack_latents(xc, extra_conds.pop("latent_shapes"))
|
xc = utils.unpack_latents(xc, extra_conds.pop("latent_shapes"))
|
||||||
|
|
||||||
|
transformer_options = transformer_options.copy()
|
||||||
|
transformer_options["prefetch_dynamic_vbars"] = (
|
||||||
|
self.current_patcher is not None and self.current_patcher.is_dynamic()
|
||||||
|
)
|
||||||
|
|
||||||
model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds)
|
model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds)
|
||||||
if len(model_output) > 1 and not torch.is_tensor(model_output):
|
if len(model_output) > 1 and not torch.is_tensor(model_output):
|
||||||
model_output, _ = utils.pack_latents(model_output)
|
model_output, _ = utils.pack_latents(model_output)
|
||||||
|
|||||||
@ -57,8 +57,9 @@ def prefetch_queue_pop(queue, device, module):
|
|||||||
comfy.model_management.sync_stream(device, offload_stream)
|
comfy.model_management.sync_stream(device, offload_stream)
|
||||||
queue[0] = (offload_stream, (prefetch, comfy_modules))
|
queue[0] = (offload_stream, (prefetch, comfy_modules))
|
||||||
|
|
||||||
def make_prefetch_queue(queue, device):
|
def make_prefetch_queue(queue, device, transformer_options):
|
||||||
if (comfy.model_management.NUM_STREAMS == 0
|
if (not transformer_options.get("prefetch_dynamic_vbars", False)
|
||||||
|
or comfy.model_management.NUM_STREAMS == 0
|
||||||
or comfy.model_management.is_device_cpu(device)
|
or comfy.model_management.is_device_cpu(device)
|
||||||
or not comfy.model_management.device_supports_non_blocking(device)):
|
or not comfy.model_management.device_supports_non_blocking(device)):
|
||||||
return None
|
return None
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user