Downloads · 30 days
344
9% of all-time downloads
SpirinEgor/mamba-1.4b-ru
mamba-1.4b-ru is a text generation model from SpirinEgor. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
<style .custom-table { table-layout: fixed; width: 100%; border-collapse: collapse; margin-top: 2em; } .custom-table td { width: 50%; vertical-align: top; padding: 10px; box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.15)…
Downloads · 30 days
344
9% of all-time downloads
All-time downloads
3.9K
Public
Parameters
1.3B
16.4 GB on disk
Likes
6
Public
Click a slice to open those files.
.bin5.3 GB · 50%
From the Hugging Face model README
The original Mamba model trained on over 1T tokens, mostly in English and Russian.
This release contains only the pre-trained part of the model. It doesn’t include any instructions following tuning. Feel free to try it out and share your results.
Note that this is a ~1.3B model, which is why its results can be worse than those of models with 7B parameters. However, model is competitive among models of the same size.
If you have any questions, feel free to open an issue.
Model has the same architecture and config parameters as the original Mamba-1.4B model. The only difference is the vocabulary size, which is 50,280 in the vanilla configuration and 32,768 in model. As a result, model has fewer parameters (1.34B).
This model was trained with the original implementation with the FSDP strategy.
Training details:
You need to install transformers version 4.39.0 or higher. We also recommend you to install optimized kernels: both causal_conv_1d and mamba-ssm.
pip install transformers>=4.39.0
pip install causal-conv1d>=1.2.0
pip install mamba-ssm
After that, you can use the classic generate API. Refer to the documentation of the original model for more details.
from transformers import MambaForCausalLM, AutoTokenizer
model = MambaForCausalLM.from_pretrained("SpirinEgor/mamba-1.4b")
tokenizer = AutoTokenizer.from_pretrained("SpirinEgor/mamba-1.4b")
s = "Я очень люблю лимончелло"
input_ids = tokenizer(s, return_tensors="pt")["input_ids"]
output_ids = model.generate(input_ids, max_new_tokens=50, do_sample=True, top_p=0.95, top_k=50, repetition_penalty=1.1)
print(tokenizer.decode(output_ids[0]))
# <s> Я очень люблю лимончелло. Просто без ума от этого ликёра, но когда его много я себя не контролирую и начинаю пить всё что можно.</s>
The training dataset contains data mainly in English and Russian, as well as code and multilingual content. We use a combination of open-source datasets, e.g., parts of SlimPajama, Wikipedia, Reddit, etc.
| Language | Part |
|---|---|
| Russian | 53.5% |
| English | 36.8% |
| Source Code | 4.2% |
| Other | 5.5% |
For evaluation, we use the same set of tasks as in the original paper.
Some useful notes and details:
If you want to reproduce the results or check any other model, you can use the lm-evaluation-harness framework.
We ran it with the following parameters:
--tasks lambada_openai,hellaswag,piqa,arc_easy,arc_challenge,winogrande --num_fewshot 0 --batch_size 4
Hover over the small plots to enlarge them.
As expected, model performs worse on tasks in the English language, and shows better results with Russian, even outperforming some popular models.
@article{mamba,
title={Mamba: Linear-Time Sequence Modeling with Selective State Spaces},
author={Gu, Albert and Dao, Tri},
journal={arXiv preprint arXiv:2312.00752},
year={2023}
}
@misc{spirin2024mamba_ru,
title={mamba-1.4b-ru},
author={Spirin, Egor},
url={https://huggingface.co/SpirinEgor/mamba-1.4b},
publisher={Hugging Face}
year={2024},
}