Mambaoutai is the result of all the experiments and training runs described in the following blog post, where all details about the model series is shared. Mambaoutai is series of small mamba checkpoints released for the community to explore, trained on French, English and code. We run two different decay phases with the WSD-scheduler, and release model checkpoints pretrained both with and without instruction data.
Usage
You need to install transformers from main until transformers=4.39.0 is released.
If any of these two is not installed, the "eager" implementation will be used(not recommended). Otherwise the more optimised CUDA kernels will be used.
Generation
Use this snippet of code to generate text from the model:
python
1from transformers import MambaConfig, MambaForCausalLM, AutoTokenizer
2import torch
34if model_has_instruct_data:5# use chat tokens6 prompt = ”<start_user>Tell me something about Paris.<end_message><start_assistant>”
7else:8# prompt the non-instructed tuned model gently9 prompt = ”This is a text about Paris. Paris is”
1011tokenizer = AutoTokenizer.from_pretrained("lightonai/mambaoutai")12model = MambaForCausalLM.from_pretrained("lightonai/mambaoutai")13input_ids = tokenizer(prompt, return_tensors="pt")["input_ids"]1415out = model.generate(input_ids, max_new_tokens=10)16print(tokenizer.batch_decode(out))
Training checkpoints
You can find some of the training checkpoints in the repo branch. On branch corresponding to the model at some point in time during training.
You can do inference with these training checkpoints by adding the revision parameter to the from_pretrained method.
For example, to load the model checkpoint after 30000 steps of pretraining, you can use the following code:
Since Mambaoutai is only 1.6B parameters, it can be run on a CPU with reasonable speed.
Here is an example of how to run it on llama.cpp:
bash
1# Clone llama.cpp repository and compile it from source2git clone https://github.com/ggerganov/llama.cpp\3cd llama.cpp
4make56# Create a venv and install dependencies7conda create -n mamba-cpp python=3.108conda activate mamba-cpp
9pip install -r requirements/requirements-convert-hf-to-gguf.txt
1011# Download the weights, tokenizer, config, tokenizer_config and special_tokens_map from this repo and12# put them in a directory 'Mambaoutai/' 13mkdir Mambaoutai
1415# Convert the weights to GGUF format16python convert-hf-to-gguf.py Mambaoutai
1718# Run inference with a prompt19./main -m Mambaoutai/ggml-model-f16.gguf -p "Building a website can be done in 10 simple steps:\nStep 1:" -n 400 -e -ngl 1
Training Hardware
The model checkpoints with no instruction data have been fully trained on an NVIDIA DGX H100 provided by OVH Cloud, whereas the decay phases with instruction data have been carried out on an HPE Cray with 8xH100 on Orange Cloud Avenue.
The ablation experiments were conducted on 16 nodes(4xA100-40GB) on MeluXina.
Model hyperparameters
More details about the model hyperparameters are given in the table below :