Skip to content

Fix bug in LayerInfo.get_kernel_size when kernel sizes are torch.Tensor with single item#365

Open
lancelotblanchard wants to merge 1 commit intoTylerYep:mainfrom
lancelotblanchard:main
Open

Fix bug in LayerInfo.get_kernel_size when kernel sizes are torch.Tensor with single item#365
lancelotblanchard wants to merge 1 commit intoTylerYep:mainfrom
lancelotblanchard:main

Conversation

@lancelotblanchard
Copy link
Copy Markdown

As reported in issue #355, LayerInfo.get_kernel_size raises a TypeError: iteration over a 0-d tensor when the kernel_size of a module is a tensor with only one item. This happens for some model implementations from the transformers library (e.g., EncodecConv1d, MimiConv1d)

This fixes the issue by modifying get_kernel_size to turn the kernel_size of a module into a list, only if it is not a 0-d tensor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant