Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lancelotblanchard
Copy link

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