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

Fix a shape annotation and typos in mamba slow forward #30691

Merged
merged 2 commits into from May 20, 2024

Conversation

vasqu
Copy link
Contributor

@vasqu vasqu commented May 7, 2024

What does this PR do?

It only addresses typos and a wrong shape annotation in the comments of mamba's slow forward call. There's no change in the logic or anything.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@ArthurZucker

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Ok good nit! 🤗 (does jamba also has this typo?)

@vasqu
Copy link
Contributor Author

vasqu commented May 8, 2024

Yup, same typo. The shape annotation is correct tho.

Another thing I've noticed in Jamba are these line;

if self.training:
# In training mode, we don't want to perform in-place operations on ssm_state so we can compute the backwards pass
ssm_state = cache_params.ssm_states[self.layer_idx].clone()
else:
ssm_state = cache_params.ssm_states[self.layer_idx]

If you remember my issue from the past ( #29526 ), I've added something similar but not differentiating between training and eval. Might be worth to change in base mamba as well.

@ArthurZucker
Copy link
Collaborator

Down to change, but with a bench / something that shows it does produce improvements!

@ArthurZucker ArthurZucker merged commit 76e0530 into huggingface:main May 20, 2024
17 checks passed
@vasqu vasqu deleted the fix-mamba-comments branch May 20, 2024 12:27
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.

None yet

2 participants