Text Generation
Transformers
Safetensors
Basque
English
Spanish
mamba2
mamba-2
basque
autocomplete
on-device
low-resource
Instructions to use itzune/morpheus with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use itzune/morpheus with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="itzune/morpheus")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("itzune/morpheus") model = AutoModelForCausalLM.from_pretrained("itzune/morpheus", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use itzune/morpheus with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "itzune/morpheus" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "itzune/morpheus", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/itzune/morpheus
- SGLang
How to use itzune/morpheus with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "itzune/morpheus" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "itzune/morpheus", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "itzune/morpheus" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "itzune/morpheus", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use itzune/morpheus with Docker Model Runner:
docker model run hf.co/itzune/morpheus
Upload Morpheus v2 Mamba-2 (91M, step 74K, best checkpoint)
Browse files- README.md +66 -0
- config.json +20 -0
- generation_config.json +4 -0
- model.safetensors +3 -0
- tokenizer.model +3 -0
- tokenizer_config.json +11 -0
README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
language:
|
| 5 |
+
- eu
|
| 6 |
+
- en
|
| 7 |
+
- es
|
| 8 |
+
tags:
|
| 9 |
+
- mamba-2
|
| 10 |
+
- basque
|
| 11 |
+
- autocomplete
|
| 12 |
+
- on-device
|
| 13 |
+
- low-resource
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Morpheus v2 (Mamba-2) — Basque Autocomplete
|
| 18 |
+
|
| 19 |
+
A 91M-parameter Mamba-2 language model for on-device Basque (Euskara) text autocompletion.
|
| 20 |
+
|
| 21 |
+
## Model Details
|
| 22 |
+
|
| 23 |
+
- **Architecture:** Mamba-2 (State Space Model)
|
| 24 |
+
- **Parameters:** 91M
|
| 25 |
+
- **Embedding vocab:** 4,000 (Unigram SentencePiece)
|
| 26 |
+
- **Hidden dimension:** 768
|
| 27 |
+
- **Layers:** 24
|
| 28 |
+
- **State dimension:** 64
|
| 29 |
+
- **Head dimension:** 64
|
| 30 |
+
- **Inner dimension:** 1,536
|
| 31 |
+
- **Sequence length:** 1,024
|
| 32 |
+
- **Training tokens:** ~10 billion
|
| 33 |
+
- **Training steps:** 76,000 (best checkpoint at 74,000)
|
| 34 |
+
- **Held-out PPL:** 7.13
|
| 35 |
+
- **Trained without BOS token**
|
| 36 |
+
|
| 37 |
+
## Tokenizer
|
| 38 |
+
|
| 39 |
+
A 4K Unigram SentencePiece tokenizer trained on the cleaned Basque corpus. The small vocabulary size was chosen based on evidence that lower vocab sizes achieve lower downstream perplexity for agglutinative low-resource languages (cf. QuechuaTok).
|
| 40 |
+
|
| 41 |
+
- `add_bos_token: false` (the model was trained without a BOS token)
|
| 42 |
+
- EOS token: `</s>` (id=2)
|
| 43 |
+
- UNK token: `<unk>` (id=0)
|
| 44 |
+
|
| 45 |
+
## Intended Use
|
| 46 |
+
|
| 47 |
+
On-device Basque text autocomplete and predictive keyboard input. The model is small enough to run on CPU via llama.cpp (see the GGUF quantized versions at [itzune/morpheus-gguf](https://huggingface.co/itzune/morpheus-gguf)).
|
| 48 |
+
|
| 49 |
+
## Training Data
|
| 50 |
+
|
| 51 |
+
Trained on a ~22 GB cleaned Basque text corpus comprising Wikipedia, news (Berria), literature, and other web-crawled sources. The corpus underwent a multi-stage cleaning pipeline (deduplication, language filtering, quality auditing).
|
| 52 |
+
|
| 53 |
+
## Quantized Versions
|
| 54 |
+
|
| 55 |
+
GGUF quantized models (Q4_K_M, Q5_K_M) for llama.cpp inference are available at:
|
| 56 |
+
[itzune/morpheus-gguf](https://huggingface.co/itzune/morpheus-gguf)
|
| 57 |
+
|
| 58 |
+
## Citation
|
| 59 |
+
|
| 60 |
+
```bibtex
|
| 61 |
+
@misc{morpheus_v2_mamba,
|
| 62 |
+
author = {Xabier Ezpeleta},
|
| 63 |
+
title = {Morpheus v2: On-Device Basque Autocompletion with Mamba-2},
|
| 64 |
+
year = {2026},
|
| 65 |
+
}
|
| 66 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"d_model": 768,
|
| 3 |
+
"n_layer": 24,
|
| 4 |
+
"vocab_size": 4000,
|
| 5 |
+
"d_conv": 4,
|
| 6 |
+
"expand": 2,
|
| 7 |
+
"d_state": 64,
|
| 8 |
+
"head_dim": 64,
|
| 9 |
+
"d_inner": 1536,
|
| 10 |
+
"n_heads": 24,
|
| 11 |
+
"rms_norm_eps": 1e-05,
|
| 12 |
+
"pad_vocab_size_multiple": 16,
|
| 13 |
+
"tie_word_embeddings": true,
|
| 14 |
+
"model_type": "mamba2",
|
| 15 |
+
"architectures": [
|
| 16 |
+
"Mamba2ForCausalLM"
|
| 17 |
+
],
|
| 18 |
+
"torch_dtype": "float16",
|
| 19 |
+
"transformers_version": "4.40.0"
|
| 20 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"eos_token_id": 2,
|
| 3 |
+
"transformers_version": "4.40.0"
|
| 4 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:60eeda065f795d4e0596b02eb47e2d2efcb036312fd665208a2d1d164a0a890d
|
| 3 |
+
size 188298360
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:72c5d481f9875ff63edb8b9d33c8a6ab46ccb3fcc71d1238100f7483ec18705f
|
| 3 |
+
size 305450
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 3 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 4 |
+
"add_bos_token": false,
|
| 5 |
+
"add_eos_token": false,
|
| 6 |
+
"bos_token": null,
|
| 7 |
+
"eos_token": "</s>",
|
| 8 |
+
"unk_token": "<unk>",
|
| 9 |
+
"pad_token": null,
|
| 10 |
+
"sp_model_kwargs": {}
|
| 11 |
+
}
|