Fix ImportError: cannot import name 'pad' from kornia ≥ 0.8.3
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.
yes,same error
Same issue.
same
I see the same error after updating ComfyUI. I tried updating the custom node but the error is still there.
pip install --no-deps --force-reinstall kornia==0.8.2
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