[GH-ISSUE #137] ValueError: infer_schema(func): Parameter kernel_size has unsupported type list[int] in eager/na.py #43

Closed
opened 2026-10-26 22:19:37 +00:00 by bsakaguchi · 4 comments
Owner

Originally created by @Poldino95 on GitHub (Aug 25, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/137

Bug Description:
When running ComfyUI with PyTorch 2.6+, loading comfy_kitchen fails with a ValueError during infer_schema in comfy_kitchen/backends/eager/na.py.

PyTorch's custom_op typing inspection rejects built-in list[int] and list[bool] type hints, requiring typing.List instead.

Error Traceback:
"
ValueError: infer_schema(func): Parameter kernel_size has unsupported type list[int]. The valid types are: ... Got func with signature (q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, kernel_size: list[int], is_causal: list[bool], scale: float | None) -> torch.Tensor)
"


Proposed Fix:
Import List from typing and update the function signature in comfy_kitchen/backends/eager/na.py:
"
from typing import List

(......)

def _op_na3d(
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
kernel_size: List[int],
is_causal: List[bool],
scale: float | None = None,
) -> torch.Tensor:
(......)
"

Originally created by @Poldino95 on GitHub (Aug 25, 2026). Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/137 Bug Description: When running ComfyUI with PyTorch 2.6+, loading `comfy_kitchen` fails with a `ValueError` during `infer_schema` in `comfy_kitchen/backends/eager/na.py`. PyTorch's `custom_op` typing inspection rejects built-in `list[int]` and `list[bool]` type hints, requiring `typing.List` instead. Error Traceback: " ValueError: infer_schema(func): Parameter kernel_size has unsupported type list[int]. The valid types are: ... Got func with signature (q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, kernel_size: list[int], is_causal: list[bool], scale: float | None) -> torch.Tensor) " ------------ Proposed Fix: Import List from typing and update the function signature in comfy_kitchen/backends/eager/na.py: " from typing import List # (......) def _op_na3d( q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, kernel_size: List[int], is_causal: List[bool], scale: float | None = None, ) -> torch.Tensor: (......) "
Author
Owner

@0xDELUXA commented on GitHub (Aug 25, 2026):

Since github.com/Comfy-Org/comfy-kitchen@05c5f01978, PyTorch 2.7.0 is the minimum required version. Please update PyTorch, and this will resolve the issue.

<!-- gh-comment-id:5409594852 --> @0xDELUXA commented on GitHub (Aug 25, 2026): Since https://github.com/Comfy-Org/comfy-kitchen/commit/05c5f0197859fca3e8c706ca63ae5dda6e4e446e, PyTorch 2.7.0 is the minimum required version. Please update PyTorch, and this will resolve the issue.
Author
Owner

@Poldino95 commented on GitHub (Aug 25, 2026):

yeah but, everything was working fine: i had the version from many months ago, and then I decided to do a full-update, using the .bat script. after that, everything was broken:
"Traceback (most recent call last):
File "\ComfyUI\main.py", line 248, in
import comfy.utils
File "\ComfyUI\comfy\utils.py", line 25, in
import comfy.memory_management
File "\ComfyUI\comfy\memory_management.py", line 8, in
from comfy.quant_ops import QuantizedTensor
File "\ComfyUI\comfy\quant_ops.py", line 23, in
import comfy_kitchen as ck
File "\python_embeded\Lib\site-packages\comfy_kitchen_init_.py", line 3, in
from .backends import cuda as cuda_backend
File "\python_embeded\Lib\site-packages\comfy_kitchen\backends\cuda_init
.py", line 161, in
from comfy_kitchen.backends.eager import rope as eager_rope
File "\python_embeded\Lib\site-packages\comfy_kitchen\backends\eager_init
.py", line 71, in
from .na import na3d
File "\python_embeded\Lib\site-packages\comfy_kitchen\backends\eager\na.py", line 163, in
@torch.library.custom_op("comfy_kitchen::na3d", mutates_args=())
File "\python_embeded\Lib\site-packages\torch_library\custom_ops.py", line 121, in inner
schema_str = torch.library.infer_schema(fn, mutates_args=mutates_args)
File "\python_embeded\Lib\site-packages\torch_library\infer_schema.py", line 106, in infer_schema
error_fn(
File "\python_embeded\Lib\site-packages\torch_library\infer_schema.py", line 58, in error_fn
raise ValueError(
ValueError: infer_schema(func): Parameter kernel_size has unsupported type list[int]. The valid types are: dict_keys([<class 'torch.Tensor'>, typing.Optional[torch.Tensor], typing.Sequence[torch.Tensor], typing.List[torch.Tensor], typing.Sequence[typing.Optional[torch.Tensor]], typing.List[typing.Optional[torch.Tensor]], <class 'int'>, typing.Optional[int], typing.Sequence[int], typing.List[int], typing.Optional[typing.Sequence[int]], typing.Optional[typing.List[int]], <class 'float'>, typing.Optional[float], typing.Sequence[float], typing.List[float], typing.Optional[typing.Sequence[float]], typing.Optional[typing.List[float]], <class 'bool'>, typing.Optional[bool], typing.Sequence[bool], typing.List[bool], typing.Optional[typing.Sequence[bool]], typing.Optional[typing.List[bool]], <class 'str'>, typing.Optional[str], typing.Union[int, float, bool], typing.Union[int, float, bool, NoneType], typing.Sequence[typing.Union[int, float, bool]], typing.List[typing.Union[int, float, bool]], <class 'torch.dtype'>, typing.Optional[torch.dtype], <class 'torch.device'>, typing.Optional[torch.device]]). Got func with signature (q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, kernel_size: list[int], is_causal: list[bool], scale: float | None) -> torch.Tensor)".

also, when I updated, cuda was removed (and gave errors), so I had to reinstall it manually. after that, kitchen gave other errors, and I fixed it that way, as I showed in the first message

<!-- gh-comment-id:5409834611 --> @Poldino95 commented on GitHub (Aug 25, 2026): yeah but, everything was working fine: i had the version from many months ago, and then I decided to do a full-update, using the .bat script. after that, everything was broken: "Traceback (most recent call last): File "<PATH>\ComfyUI\main.py", line 248, in <module> import comfy.utils File "<PATH>\ComfyUI\comfy\utils.py", line 25, in <module> import comfy.memory_management File "<PATH>\ComfyUI\comfy\memory_management.py", line 8, in <module> from comfy.quant_ops import QuantizedTensor File "<PATH>\ComfyUI\comfy\quant_ops.py", line 23, in <module> import comfy_kitchen as ck File "<PATH>\python_embeded\Lib\site-packages\comfy_kitchen\__init__.py", line 3, in <module> from .backends import cuda as _cuda_backend File "<PATH>\python_embeded\Lib\site-packages\comfy_kitchen\backends\cuda\__init__.py", line 161, in <module> from comfy_kitchen.backends.eager import rope as _eager_rope File "<PATH>\python_embeded\Lib\site-packages\comfy_kitchen\backends\eager\__init__.py", line 71, in <module> from .na import na3d File "<PATH>\python_embeded\Lib\site-packages\comfy_kitchen\backends\eager\na.py", line 163, in <module> @torch.library.custom_op("comfy_kitchen::na3d", mutates_args=()) File "<PATH>\python_embeded\Lib\site-packages\torch\_library\custom_ops.py", line 121, in inner schema_str = torch.library.infer_schema(fn, mutates_args=mutates_args) File "<PATH>\python_embeded\Lib\site-packages\torch\_library\infer_schema.py", line 106, in infer_schema error_fn( File "<PATH>\python_embeded\Lib\site-packages\torch\_library\infer_schema.py", line 58, in error_fn raise ValueError( ValueError: infer_schema(func): Parameter kernel_size has unsupported type list[int]. The valid types are: dict_keys([<class 'torch.Tensor'>, typing.Optional[torch.Tensor], typing.Sequence[torch.Tensor], typing.List[torch.Tensor], typing.Sequence[typing.Optional[torch.Tensor]], typing.List[typing.Optional[torch.Tensor]], <class 'int'>, typing.Optional[int], typing.Sequence[int], typing.List[int], typing.Optional[typing.Sequence[int]], typing.Optional[typing.List[int]], <class 'float'>, typing.Optional[float], typing.Sequence[float], typing.List[float], typing.Optional[typing.Sequence[float]], typing.Optional[typing.List[float]], <class 'bool'>, typing.Optional[bool], typing.Sequence[bool], typing.List[bool], typing.Optional[typing.Sequence[bool]], typing.Optional[typing.List[bool]], <class 'str'>, typing.Optional[str], typing.Union[int, float, bool], typing.Union[int, float, bool, NoneType], typing.Sequence[typing.Union[int, float, bool]], typing.List[typing.Union[int, float, bool]], <class 'torch.dtype'>, typing.Optional[torch.dtype], <class 'torch.device'>, typing.Optional[torch.device]]). Got func with signature (q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, kernel_size: list[int], is_causal: list[bool], scale: float | None) -> torch.Tensor)". also, when I updated, cuda was removed (and gave errors), so I had to reinstall it manually. after that, kitchen gave other errors, and I fixed it that way, as I showed in the first message
Author
Owner

@0xDELUXA commented on GitHub (Aug 25, 2026):

This issue will only be resolved if you update PyTorch to 2.7.0 or newer. https://github.com/Comfy-Org/ComfyUI/pull/15413 was merged two weeks ago.

<!-- gh-comment-id:5410071498 --> @0xDELUXA commented on GitHub (Aug 25, 2026): This issue will only be resolved if you update PyTorch to 2.7.0 or newer. https://github.com/Comfy-Org/ComfyUI/pull/15413 was merged two weeks ago.
Author
Owner

@Poldino95 commented on GitHub (Aug 25, 2026):

oh, ok. thank you for the help :)

<!-- gh-comment-id:5413564669 --> @Poldino95 commented on GitHub (Aug 25, 2026): oh, ok. thank you for the help :)
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-kitchen#43
No description provided.