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 · May be fixed by #1127
Open

Optimized rotation matrix #1073

Giuseppe5 opened this issue Oct 25, 2024 · 0 comments · May be fixed by #1127
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.
@Giuseppe5 Giuseppe5 linked a pull request Dec 18, 2024 that will close this issue
14 tasks
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

Successfully merging a pull request may close this issue.

1 participant