Skip to content
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

Optimized rotation matrix #1073

Open
Giuseppe5 opened this issue Oct 25, 2024 · 0 comments
Open

Optimized rotation matrix #1073

Giuseppe5 opened this issue Oct 25, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Giuseppe5
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Current rotation equalization method is based on orthogonal and hadamard matrices. We can extend this to learned rotational matrices

Describe the solution you'd like
We need to have an extra rotation class in equalized_layers.py, that holds the two learnable matrices.
After the rotation is applied and the layers are wrapped with this new equalized layer, we can apply the learning process, e.g., the one described in SpinQuant.

Post learning, the rotation matrices can be fused in their respective wrapped layers and remove the wrapped layers.

Additional context
The infrastructure to pick up the layers to rotate is already in place. The most effort is to put together the training process.

@i-colbert

@Giuseppe5 Giuseppe5 added enhancement New feature or request good first issue Good for newcomers labels Oct 25, 2024
vishwamartur added a commit to vishwamartur/brevitas that referenced this issue Nov 3, 2024
Related to Xilinx#1073

Add `RotationEqualizedLayer` class to `equalized_layer.py` to hold two learnable matrices for rotation.

* Implement `forward` method in `RotationEqualizedLayer` to apply rotation and call the wrapped layer.
* Add method to fuse rotation matrices into the wrapped layer.
* Add unit tests for `RotationEqualizedLayer` class in `test_equalized_layer.py`.
* Test forward pass with rotation matrices.
* Test fusing rotation matrices into the wrapped layer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant