Skip to content

LTX2SamplingPreviewOverride is incompatible with ModelPatcherDynamic after ComfyUI #15063 #700

Description

@Kinasa0096

Description

After ComfyUI PR #15063 changed the native LTX latent upscaler to use
ModelPatcherDynamic, LTX2SamplingPreviewOverride crashes before sampling
begins.

The native LatentUpscaleModelLoader now returns a model patcher for the LTX
spatial upscaler, but the KJNodes preview wrapper still treats the input as a
plain torch.nn.Module and calls .to(device) directly.

Error

AttributeError: 'ModelPatcherDynamic' object has no attribute 'to'

File "<COMFYUI>/custom_nodes/ComfyUI-KJNodes/nodes/ltxv_nodes.py",
line 899, in __call__
    self.latent_upscale_model.to(device)

The sampler shown as the failing workflow node is SamplerCustomAdvanced, but
the exception originates from OuterSampleCallbackWrapper registered by
LTX2SamplingPreviewOverride.

Steps to reproduce

  1. Use a current ComfyUI version containing upscalers: convert latent_upsampler model to ModelPatcherDynamic Comfy-Org/ComfyUI#15063.
  2. Load the LTX 2.3 spatial upscaler through the native
    LatentUpscaleModelLoader.
  3. Connect it to the optional latent_upscale_model input of
    LTX2SamplingPreviewOverride, together with an LTX VAE and model.
  4. Start sampling with SamplerCustomAdvanced.

The exception occurs before the first sampling step.

Disconnecting only the latent_upscale_model input from
LTX2SamplingPreviewOverride avoids the crash. The native
LTXVLatentUpsampler continues to work with the same upscaler.

Cause

ComfyUI PR #15063 converted the LTX latent upscaler to the managed dynamic-VRAM
path:

Comfy-Org/ComfyUI#15063

KJNodes currently performs direct module operations in the preview wrapper:

self.latent_upscale_model.to(device)
...
x0 = self.latent_upscale_model(x0.to(torch.bfloat16))
...
self.latent_upscale_model.to(mm.unet_offload_device())

With current ComfyUI, this object is a ModelPatcherDynamic, not the underlying
module.

The updated native implementation uses model_management.load_models_gpu(),
reads the underlying model from upscale_model.model, and obtains its device
and dtype from the patcher.

Expected behavior

LTX2SamplingPreviewOverride should support the current
ModelPatcherDynamic latent-upscaler representation, while ideally remaining
compatible with older plain-module inputs.

Environment

  • OS: Windows
  • GPU: NVIDIA GeForce RTX 5080
  • DynamicVRAM: enabled
  • ComfyUI: 0.28.0, commit 45ffd543
  • ComfyUI-KJNodes: commit e27a505b
  • Python: 3.12.10
  • PyTorch: 2.10.0+cu130

Report prepared with assistance from OpenAI Codex and reviewed by the reporter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions