ComfyUI-LTXVideo icon indicating copy to clipboard operation
ComfyUI-LTXVideo copied to clipboard

Fix ImportError: cannot import name 'pad' from kornia ≥ 0.8.3

Open artokun opened this issue 4 months ago • 6 comments

On kornia ≥ 0.8.3, ComfyUI-LTXVideo fails to import — pad is no longer re-exported from kornia.geometry.transform.pyramid, so the whole node pack is skipped:

File ".../ComfyUI-LTXVideo/pyramid_blending.py", line 7, in <module>
    from kornia.geometry.transform.pyramid import ( ... pad ... )
ImportError: cannot import name 'pad' from 'kornia.geometry.transform.pyramid'

Fix (pad there was only ever torch.nn.functional.pad): drop pad, from the kornia import block in pyramid_blending.py and add a shim:

import torch.nn.functional as F
pad = F.pad  # kornia >=0.8.3 no longer re-exports pad here

from kornia.geometry.transform.pyramid import (
    pyrup, pyrdown, ...   # (pad removed)
)

Alternatively, pin kornia<0.8.3 in requirements.txt, but the one-line shim keeps compatibility with current kornia.

artokun avatar Jul 08 '26 05:07 artokun

yes,same error

zwukong avatar Jul 08 '26 14:07 zwukong

Same issue.

amoszach avatar Jul 15 '26 11:07 amoszach

same

Someonetoldme584 avatar Jul 20 '26 13:07 Someonetoldme584

I see the same error after updating ComfyUI. I tried updating the custom node but the error is still there.

denjay5 avatar Jul 25 '26 02:07 denjay5

pip install --no-deps --force-reinstall kornia==0.8.2

maoper11 avatar Jul 31 '26 14:07 maoper11

You have to edit pyramid_blending.py inside ComfyUI-LTXVideo folder:

from kornia.geometry.transform.pyramid import ( PyrUp, build_laplacian_pyramid, build_pyramid, find_next_powerof_two, is_powerof_two,

)

from torch.nn.functional import pad

cneva avatar Jul 31 '26 15:07 cneva