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

Inefficient jacobian computation for embedding layers. #199

Open
mohamad-amin opened this issue Jan 31, 2024 · 1 comment
Open

Inefficient jacobian computation for embedding layers. #199

mohamad-amin opened this issue Jan 31, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mohamad-amin
Copy link

Hello,

When I try to compute the NTK of a model with an embedding layer, I get the following warning:

/usr/local/lib/python3.10/dist-packages/neural_tangents/_src/empirical.py:2215: UserWarning: No Jacobian rule found for gather.
  warnings.warn(f'No Jacobian rule found for {primitive}.')

And ntk computation fails, due to OOM errors. This is a reproduction:
https://colab.research.google.com/drive/1Z8ClXo85VjNEoKmWYHsS5dNccZ-Xf_JS?usp=sharing

@romanngg romanngg added the enhancement New feature or request label Jan 31, 2024
@romanngg
Copy link
Contributor

Thanks for pointing this out and the repro! Yes structured derivatives don't have structure annotation / jacobian implementation for scatter/gather primitives, and would be very inefficient currently (so I recommend using methods 1/2); will take a look and see if it can be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants