Skip to content

[Transforms][WIP] Update wrapped_forward to use hooks; apply transforms to activations #286

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

Draft
wants to merge 6 commits into
base: matrix_registry
Choose a base branch
from

Conversation

dsikka
Copy link
Collaborator

@dsikka dsikka commented Mar 31, 2025

No description provided.

@dsikka dsikka changed the title [Transforms][WIP] Apply transforms to activations [Transforms][WIP] Update wrapped_forward ot use hooks, Apply transforms to activations May 5, 2025
@dsikka dsikka changed the title [Transforms][WIP] Update wrapped_forward ot use hooks, Apply transforms to activations [Transforms][WIP] Update wrapped_forward to use hooks; apply transforms to activations May 5, 2025
transform = self.matrix_registry.get_matrix(self.size)
if transform is None:
transform = random_hadamard_matrix(size=self.size)
transform = random_hadamard_matrix(size=self.size).to(dtype).to(device)
self.matrix_registry.set_matrix(self.size, transform)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to abstract this one layer down, so the transform just calls random_hadamard_matrix or deterministic_hadamard_matrix with use_cache=True, and the function automatically checks the registry/cache and returns the same value if a matrix of the same size and arguments has already been generated

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