Skip to content

Conversation

@Cecilwang
Copy link
Contributor

Thanks for the previous support for convolution layers. In this PR, I’ve added fixes for two specific cases:

  • Conv1D and unfold parameter requirement:
    The unfold operation expects 2D parameters, so for Conv1D layers, both the input tensor and parameters need to be expanded by one dimension to match the expected shape.

  • Grouped convolutions:
    Fixed the input tensor shape for convolutions that use the groups parameter to ensure the input is correctly formatted and grouped during computation.

ref:
https://pytorch.org/docs/stable/generated/torch.nn.Unfold.html
https://discuss.pytorch.org/t/conv1d-implementation-using-torch-nn-functional-unfold/109643/3

Signed-off-by: Sixue(Cecil) Wang <cecilwang@preferred.jp>
@Qubitium
Copy link
Collaborator

@Cecilwang Do you know of a opensource model currently on HF that would trigger this code? I want want to add test_conv1d.py tests to CI so we can check for regressions in the future. I know you are currently applying to a private model but was wondering if you know a non-private model that we can do a simple quant/inference on?

Otherwise, this PR is great and ready to go!

@Cecilwang
Copy link
Contributor Author

Cecilwang commented Apr 22, 2025

@Qubitium Qubitium merged commit 31051a5 into ModelCloud:main Apr 22, 2025
1 check passed
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.

2 participants