-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Add a converter from mamba_ssm -> huggingface mamba #29705
Conversation
Thanks for opening this PR @byi8220 ! Let us know when it's ready for review 🤗 |
Thanks, I think it should be reviewable now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
Just a comment about having validation in the script rather than a new test
…mers into mamba-converter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!
Looks good to me, just some small nits. cc @ArthurZucker for reference
src/transformers/models/mamba/convert_mamba_ssm_checkpoint_to_pytorch.py
Outdated
Show resolved
Hide resolved
src/transformers/models/mamba/convert_mamba_ssm_checkpoint_to_pytorch.py
Outdated
Show resolved
Hide resolved
…pytorch.py Co-authored-by: amyeroberts <[email protected]>
Addressed nits. Since there's no unit test for this anymore just did one last sanity test. Works on my machine
|
Awesome work - thanks again for adding this and for running some sanity checks! |
* implement convert_mamba_ssm_checkpoint_to_pytorch * Add test test_model_from_mamba_ssm_conversion * moved convert_ssm_config_to_hf_config to inside mamba_ssm_available check * fix skipif clause * moved skips to inside test since skipif decorator isn't working for some reason * Added validation * removed test * fixup * only compare logits * remove weight rename * Update src/transformers/models/mamba/convert_mamba_ssm_checkpoint_to_pytorch.py Co-authored-by: amyeroberts <[email protected]> * nits --------- Co-authored-by: amyeroberts <[email protected]>
* implement convert_mamba_ssm_checkpoint_to_pytorch * Add test test_model_from_mamba_ssm_conversion * moved convert_ssm_config_to_hf_config to inside mamba_ssm_available check * fix skipif clause * moved skips to inside test since skipif decorator isn't working for some reason * Added validation * removed test * fixup * only compare logits * remove weight rename * Update src/transformers/models/mamba/convert_mamba_ssm_checkpoint_to_pytorch.py Co-authored-by: amyeroberts <[email protected]> * nits --------- Co-authored-by: amyeroberts <[email protected]>
What does this PR do?
Fixes #29631
This PR creates a new command line script
convert_mamba_ssm_checkpoint_to_pytorch.py
which converts model checkpoints created by the state-spaces/mamba repo into a HuggingfaceMambaForCausalLM
model.The intended usage of this script is:
This script has a dependency on the
mamba_ssm
package.Testing
A validation pass is performed before exporting the model.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
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.