Fix ImportError with newer Kornia versions (missing pad import)

Open Beginner friendly
#541 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python

Research direction

The failing line is the from kornia.geometry.transform.pyramid import ... statement that includes pad; the payload does not name the file, so search the repository for that import. Replace the pad import with torch.nn.functional.pad as the issue suggests, then confirm the node package loads without an ImportError. Done means the import succeeds on current Kornia.

Written by the indexing model from the issue text.

Description

With recent versions of kornia, the following import fails:

from kornia.geometry.transform.pyramid import pad

This prevents the entire node package from loading:

ImportError: cannot import name 'pad' from 'kornia.geometry.transform.pyramid'

A simple fix is:

 import torch.nn.functional as F
+pad = F.pad

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

After this change the nodes load correctly with current Kornia versions.

Environment:

  • Linux (Arch)
  • Python 3.14
  • Latest ComfyUI
  • Latest ComfyUI-LTXVideo
Dominant language
Python
Stars
4.2k
Forks
508
Avg merge
7h 14m
Merged PRs (30d)
3

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Lightricks/ComfyUI-LTXVideo

All issues in Lightricks/ComfyUI-LTXVideo

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.