Unofficial Mamba2 for Hf Transformers
Collection
Just the original weights converted to be compatible with transformers. β’ 5 items β’ Updated β’ 2
Run AntonV/mamba2-130m-hf on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/AntonV/mamba2-130m-hf. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/AntonV/mamba2-130m-hf on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use AntonV/mamba2-130m-hf with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("AntonV/mamba2-130m-hf", device_map="auto")Configuration Parsing Warning:Invalid JSON for config file config.json
Converted files of the original model at mamba2-130m to HF transformers compatible formats. Not affiliated with both the original authors or hf.
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("AntonV/mamba2-130m-hf")
model = AutoModelForCausalLM.from_pretrained("AntonV/mamba2-130m-hf")
input_ids = tokenizer("Hey how are you doing?", return_tensors="pt")["input_ids"]
out = model.generate(input_ids, max_new_tokens=10)
print(tokenizer.batch_decode(out))
BibTeX:
@inproceedings{mamba2,
title={Transformers are {SSM}s: Generalized Models and Efficient Algorithms Through Structured State Space Duality},
author={Dao, Tri and Gu, Albert},
booktitle={International Conference on Machine Learning (ICML)},
year={2024}
}