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

[FEATURE] adding MPS GRUCell for efficiency #1500

Open
thegodone opened this issue Oct 18, 2024 · 1 comment
Open

[FEATURE] adding MPS GRUCell for efficiency #1500

thegodone opened this issue Oct 18, 2024 · 1 comment

Comments

@thegodone
Copy link

Describe the bug

This is related to the #1499 , the GRUCell is not implemented and the GRU version is also not optimized on MPS compare to pytorch and tensorflow variant.

@thegodone thegodone changed the title [BUG] adding MPS GRUCell for efficiency [FEATURE] adding MPS GRUCell for efficiency Oct 18, 2024
@angeloskath
Copy link
Member

I don't think this is related to #1499 but we definitely need to speed up our RNN implementations.

HendricksJudy added a commit to HendricksJudy/mlx that referenced this issue Oct 21, 2024
Fixes ml-explore#1500

Implement MPS-specific GRUCell and update GRU class for efficiency.

* **GRUCell Implementation:**
  - Add a new `GRUCell` class in `python/mlx/nn/layers/recurrent.py` with MPS-specific optimizations.
  - Define the input shape and hidden state shape for the `GRUCell`.
  - Implement the forward pass for the `GRUCell` with MPS-specific optimizations.

* **GRU Class Update:**
  - Update the `GRU` class in `python/mlx/nn/layers/recurrent.py` to use the new `GRUCell` for improved performance on MPS.
  - Define the input shape and hidden state shape for the `GRU` class.
  - Implement the forward pass for the `GRU` class using the `GRUCell`.

* **Documentation:**
  - Update `docs/src/python/nn/layers.rst` to include the new `GRUCell` class.

* **Tests:**
  - Add tests for the new `GRUCell` class in `python/tests/test_nn.py` to ensure correctness and performance improvements.

Love MLX : )
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 a pull request may close this issue.

2 participants