Skip to content

Conversation

aryanmahawar205
Copy link

Changes

  • Modified the _construct_quantization_op method in converter.py to expand the scale tensor to match the rank of the weight tensor.
  • Added logic to handle the expansion of the zero-point tensor as well.

Testing

  • Verified the fix by quantizing a model with Conv3d layers and ensuring that the quantization process completes without errors.
  • Tested with both w8a8 and other quantization schemes to ensure compatibility.

Related Issue

Fixes #2452 - coremltools.optimize.torch.quantization fails to handle w8a8 quantization for Conv3d layers.

Checklist

  • Code changes adhere to the project's coding standards.
  • Tests have been added/updated to verify the fix.

@aryanmahawar205
Copy link
Author

@junpeiz can you have a look at my PR. Thanks!

@TobyRoseman
Copy link
Collaborator

There seems to be a lot of formatting changes in this pull request. I don't think we want those changes. Please revert the formatting changes and just include your fix.

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.

coremltools.optimize.torch.quantization fails to handle w8a8 conv3d quantization properly
2 participants