Cannot import name 'pad'
Hello, After today update I did run into problem with nodes:
Traceback (most recent call last):
File "Y:\ai_ComfyUi\git_nv2\ComfyUI\nodes.py", line 2204, in load_custom_node
module_spec.loader.exec_module(module)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "Y:\ai_ComfyUi\git_nv2\ComfyUI\custom_nodes\ComfyUI-LTXVideo\__init__.py", line 48, in <module>
from .pyramid_blending import LTXVLaplacianPyramidBlend
File "Y:\ai_ComfyUi\git_nv2\ComfyUI\custom_nodes\ComfyUI-LTXVideo\pyramid_blending.py", line 7, in <module>
from kornia.geometry.transform.pyramid import (
...<6 lines>...
)
ImportError: cannot import name 'pad' from 'kornia.geometry.transform.pyramid' (Y:\ai_ComfyUi\git_nv2\python_embeded\Lib\site-packages\kornia\geometry\transform\pyramid.py)
If I do understand this correctly I can also use normal vae decode node for LTX? Any help appreciated. This is portable version of comfyui.
Ok seams that pad was moved to keypoints
potential fix:
diff --git a/pyramid_blending.py b/pyramid_blending.py
index afc4bac..74ca289 100644
--- a/pyramid_blending.py
+++ b/pyramid_blending.py
@@ -10,8 +10,8 @@ from kornia.geometry.transform.pyramid import (
build_pyramid,
find_next_powerof_two,
is_powerof_two,
- pad,
)
+from kornia.geometry import keypoints
from torch import Tensor
from .nodes_registry import comfy_node
Gemini told me that I should "from torch.nn.functional import pad". I'm very curious. I checked the submission records here and at Kornia. In 'pyramid.py', there has never been a 'pad' module. So before this, how did everyone use this set of nodes? Has no one ever raised the same question?
pip uninstall -y kornia pip install kornia==0.6.12
problem fixed
So, if you have any custom node requirements for the newer version of Kornia, you just need to remove the import of 'pad' and add the line "pad = F.pad" below
kornia==0.8.2 should work
Kornia only just released a few days back. Broke my build also.
fixed thanks, Downgrade Kornia with \python_embeded\python.exe -m pip uninstall -y kornia \python_embeded\python.exe -m pip install kornia==0.6.12
Confirming fresh repro on current main (commit 229437c, 2026-05-11) with kornia==0.8.3, torch==2.12.0, Python 3.13, ComfyUI 0.22.0, macOS arm64 / MPS. The bug is purely a kornia API change — not platform-specific.
Diagnosis: kornia previously re-exported torch.nn.functional.pad into kornia.geometry.transform.pyramid's namespace; that re-export was dropped in 0.8.x. The other 5 names in that import block (PyrUp, build_laplacian_pyramid, build_pyramid, find_next_powerof_two, is_powerof_two) are still exported — the fix only needs to relocate pad to its real home.
Clean one-line patch (call sites at lines 31 and 44 work unchanged):
from kornia.geometry.transform.pyramid import (
PyrUp,
build_laplacian_pyramid,
build_pyramid,
find_next_powerof_two,
is_powerof_two,
- pad,
)
from torch import Tensor
+from torch.nn.functional import pad
Preferable to pad = F.pad (also valid) since the explicit import is greppable and doesn't introduce a local binding. The kornia==0.6.12 downgrade works as a stopgap but pins a 3+-year-old kornia, which conflicts with newer ComfyUI packs that need modern kornia features.
#496 looks like a duplicate of this — might be worth closing one to consolidate. Happy to open a PR with the diff above; let me know.
How is this still not fixed? Downgrading the latest ComfyUI to kornia 0.6.12 breaks the install.
Currently, these nodes are unusable on a fresh install of ComfyUI.
Исправлено, спасибо. Понизьте версию Kornia с помощью команды
\python_embeded\python.exe -m pip uninstall -y korniaи\python_embeded\python.exe -m pip install kornia==0.6.12.
Downgrading kornia does not solve the issue, as other nodes will require a new kornia version.
kornia==0.7.3 works for me. It looks like at some point thereafter, ComyUI-LTXVideo ceases to work properly. I hope this helps others.
kornia==0.7.3 works for me. It looks like at some point thereafter, ComyUI-LTXVideo ceases to work properly. I hope this helps others.
Thanks, it worked for me
I fixed by
pip install kornia==0.8.2
Opened #516 with a fix for this. kornia 0.8.3 dropped the pad re-export
from kornia.geometry.transform.pyramid; since it was just
torch.nn.functional.pad, the fix swaps the two calls over to F.pad
(already imported in the file). Drop-in, no behavior change — works on a
current portable build here. Anyone hitting this can apply the same change
to pyramid_blending.py while waiting for it to merge.
I opened https://github.com/Lightricks/ComfyUI-LTXVideo/pull/506 And it's also sitting stagnant.
This is still a problem, and there is an open PR that resolves it. This could use some attention. I've tested the change @VixenVillainous and @DevNullInc proposed on ComfyUI v0.29.0 (latest) and it is working.
Confirming fresh repro on current
main(commit229437c, 2026-05-11) withkornia==0.8.3,torch==2.12.0, Python 3.13, ComfyUI 0.22.0, macOS arm64 / MPS. The bug is purely a kornia API change — not platform-specific.Diagnosis: kornia previously re-exported
torch.nn.functional.padintokornia.geometry.transform.pyramid's namespace; that re-export was dropped in 0.8.x. The other 5 names in that import block (PyrUp, build_laplacian_pyramid, build_pyramid, find_next_powerof_two, is_powerof_two) are still exported — the fix only needs to relocatepadto its real home.Clean one-line patch (call sites at lines 31 and 44 work unchanged):
from kornia.geometry.transform.pyramid import ( PyrUp, build_laplacian_pyramid, build_pyramid, find_next_powerof_two, is_powerof_two,
- pad, ) from torch import Tensor +from torch.nn.functional import pad
Preferable to
pad = F.pad(also valid) since the explicit import is greppable and doesn't introduce a local binding. Thekornia==0.6.12downgrade works as a stopgap but pins a 3+-year-old kornia, which conflicts with newer ComfyUI packs that need modern kornia features.#496 looks like a duplicate of this — might be worth closing one to consolidate. Happy to open a PR with the diff above; let me know.
This one line changes worked here too ty