Instructions to use baltoche/futo-keyboard-lm-fr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use baltoche/futo-keyboard-lm-fr with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf baltoche/futo-keyboard-lm-fr:Q4_K_M # Run inference directly in the terminal: llama cli -hf baltoche/futo-keyboard-lm-fr:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf baltoche/futo-keyboard-lm-fr:Q4_K_M # Run inference directly in the terminal: llama cli -hf baltoche/futo-keyboard-lm-fr:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf baltoche/futo-keyboard-lm-fr:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf baltoche/futo-keyboard-lm-fr:Q4_K_M
Use Docker
docker model run hf.co/baltoche/futo-keyboard-lm-fr:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use baltoche/futo-keyboard-lm-fr with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "baltoche/futo-keyboard-lm-fr" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "baltoche/futo-keyboard-lm-fr", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/baltoche/futo-keyboard-lm-fr:Q4_K_M
- Ollama
How to use baltoche/futo-keyboard-lm-fr with Ollama:
ollama run hf.co/baltoche/futo-keyboard-lm-fr:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use baltoche/futo-keyboard-lm-fr with Docker Model Runner:
docker model run hf.co/baltoche/futo-keyboard-lm-fr:Q4_K_M
- Lemonade
How to use baltoche/futo-keyboard-lm-fr with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull baltoche/futo-keyboard-lm-fr:Q4_K_M
Run and chat with the model
lemonade run user.futo-keyboard-lm-fr-Q4_K_M
List all available models
lemonade list
- Atomic Chat
FUTO Keyboard β French Transformer Language Model (fr)
A French (fr) next-word-prediction + autocorrect transformer model for
FUTO Keyboard, trained locally on a consumer GPU (NVIDIA RTX 2080).
The pipeline adapts the most advanced existing community implementation β
jblechert/keyboard-lm-de (German,
full data pipeline + XBU autocorrect generation) β to French, and matches the
official FUTO English model (ml4) exactly in architecture, tokenizer
format and GGUF metadata, verified against
futo-org/android-keyboard native loader code and the official
ml4_1_f16_meta_fixed.gguf (see reference/).
Model spec (identical to official FUTO English model)
| Property | Value |
|---|---|
| Architecture | LlamaForCausalLM, 8 layers, hidden 512, 8 heads (head_dim 64), FFN 1024 SwiGLU, RoPE base 10000, RMSNorm eps 1e-6 |
| Parameters | 36.3M |
| Context | 2048 (trained at 256) |
| Tokenizer | SentencePiece unigram, vocab 15008, byte_fallback, treat_whitespace_as_suffix=true ("inverted space"), add_dummy_prefix=false, meta tokens <pad>=0 <s>=1 </s>=2 <unk>=3 |
| Control tokens | <FUTO0..23> <XBU> <XBC> <XEC> <XC0..4> <CHAR_A..Z> (consecutive, as required by the runtime) |
| GGUF features | base_v1 inverted_space xbu_char_autocorrect_v1 xc0_swipe_typing_v1 char_embed_mixing_v1 lora_finetunable_v1 |
keyboardlm.languages |
fr |
Install on the phone
- Copy one of
output/fr_keyboard_*.ggufto the Android device. - FUTO Keyboard β Settings β Predictive Text β Transformer Models β Import from file β pick the
.gguf. - Add French under Languages & Models, then select the model for
fr.
| File | Size | Note |
|---|---|---|
fr_keyboard_Q8_0.gguf |
39 MB | near-lossless, start here |
fr_keyboard_Q6_K.gguf |
31 MB | same size class as the official ml4_q6_k.gguf (30.7 MB), best for phones |
fr_keyboard_Q4_K_M.gguf |
24 MB | older/slower devices |
fr_keyboard_f16.gguf |
74 MB | unquantized reference |
Compute time (configuration: NVIDIA RTX 2080 8 GB, 16 CPU cores, 31 GB RAM, Ubuntu)
| Step | Measured time |
|---|---|
| 01 β corpus download (Tatoeba, OpenSubtitles, FineWeb2 ~8 GB, French Wikipedia) | ~30 min |
| 02 β cleaning + dedup (193 M raw lines β 45 M train lines) | ~50 min |
| 03 β SentencePiece tokenizer (8 M sampled lines) | ~5 min |
| 04 β XBU data generation (5 M sentences β 19.9 M lines) | ~18 min |
| 05 β LLaMA 36 M pretraining (80,000 steps, 655 M tokens, ~66 k tok/s) | 2 h 45 |
| 09 β XBU LoRA round 1 (15,000 steps) + round 2 (20,000 steps) | ~20 min + ~27 min |
| 06 β GGUF F16 export + Q8_0/Q6_K/Q4_K_M quantization | ~2 min |
| 08 β benchmark (PPL + top-k + XBU) per checkpoint | ~2 min |
| Total | β 4 h 40 |
Measured quality (local training run, RTX 2080)
| Model | conversational PPL | next-word top-1 / top-5 | XBU autocorrect exact (greedy) |
|---|---|---|---|
final (models/fr_keyboard_merged2 β output/) |
27.4 | 40.2% / 61.7% | 29.3% |
plain LM before LoRA (fr_keyboard_v1_final_backup) |
22.1 | 40.9% / 63.0% | 0% |
(For reference: naively mixing XBU lines into pretraining at ~5% of tokens degraded the plain LM to PPL ~319 while reaching only 42% XBU β hence the pretrain-then-LoRA strategy, same as the German pipeline.)
Pipeline (scripts/)
01_download_data.py Tatoeba FR (CC BY) + OpenSubtitles v2018 FR + FineWeb2 fra_Latn (ODC-By) + Wikipedia FR (CC BY-SA)
02_clean_data.py normalize, French-heuristic filter, dedupe, train/eval split
03_train_tokenizer.py SentencePiece unigram 15008, FUTO special tokens, inverted-space format
04_generate_xbu_data.py AZERTY-aware typo generation, XBU/CHAR autocorrect format (+ accent-restore: "cafe" -> "cafΓ©")
05_train_model.py trains the 36M LLaMA on the RTX 2080 (~70k tok/s)
06_export_gguf.py F16 GGUF with official keyboardlm metadata + llama-quantize to Q8_0/Q6_K/Q4_K_M
07_evaluate.py perplexity / top-k / XBU autocorrect eval (HF or GGUF)
08_benchmark.py conversational PPL/top-k + XBU exact-match, compare checkpoints
09_lora_finetune.py LoRA-finetunes the plain LM on XBU data (preserves LM quality), --merge-only merges
check_gguf.py replicates FUTO's native loader checks against the final .gguf
Full run used here:
python3 scripts/05_train_model.py --steps 80000 --batch 32 --lr 6e-4 --warmup 2000 \
--xbu-weight 0.10 --out models/fr_keyboard_v1 # NOTE: XBU in pretraining hurts; keep weight ~0 or omit
# better: pretrain on plain text only, then:
python3 scripts/09_lora_finetune.py --base models/fr_keyboard_v1_final_backup --steps 15000 --out models/fr_keyboard_lora
python3 scripts/09_lora_finetune.py --base models/fr_keyboard_v1_final_backup --resume-lora models/fr_keyboard_lora \
--steps 20000 --lr 3e-4 --xbu-weight 0.75 --out models/fr_keyboard_lora2
python3 scripts/09_lora_finetune.py --merge-only --lora models/fr_keyboard_lora2 \
--base models/fr_keyboard_v1_final_backup --merged-out models/fr_keyboard_merged2
python3 scripts/06_export_gguf.py --model-dir models/fr_keyboard_merged2 --out output/fr_keyboard_f16.gguf
python3 scripts/check_gguf.py output/fr_keyboard_Q6_K.gguf
Run end-to-end:
pip install torch --index-url https://download.pytorch.org/whl/cu124
pip install "transformers>=4.49,<5" datasets sentencepiece gguf protobuf
python3 scripts/01_download_data.py
python3 scripts/02_clean_data.py
python3 scripts/03_train_tokenizer.py
python3 scripts/04_generate_xbu_data.py
python3 scripts/05_train_model.py --steps 25000 --batch 32
python3 scripts/06_export_gguf.py
python3 scripts/check_gguf.py output/fr_keyboard_Q6_K.gguf
Training data licenses
Tatoeba CC BY 2.0 Β· OpenSubtitles CC BY Β· FineWeb2 ODC-By Β· Wikipedia CC BY-SA 3.0. Check the licenses of the sources before redistributing the trained weights.
License
- Code (
scripts/): MIT β seeLICENSE. - Model weights (
output/*.gguf): CC BY-SA 4.0 (chosen), because the training data includes Wikipedia content under CC BY-SA; the other sources (Tatoeba CC BY 2.0, OpenSubtitles CC BY, FineWeb2 ODC-By) require attribution. Any redistribution of the weights must keep this license and credit the sources listed above. reference/: FUTO's official English model, for local validation only β do not redistribute; re-download from https://huggingface.co/breadlicker45/futo-keyboard-lm.
References
- FUTO Keyboard source: https://github.com/futo-org/android-keyboard (
native/jni/src/ggml/ModelMeta.*,org_futo_inputmethod_latin_xlm_LanguageModel.cpp,java/.../xlm/TrainingDataGenerator.kt) - Official English model (reference):
reference/ml4_1_f16_meta_fixed.gguf(frombreadlicker45/futo-keyboard-lmon Hugging Face) - German pipeline this is adapted from: https://github.com/jblechert/keyboard-lm-de
- Greek pipeline matching the official 36M spec: https://github.com/stamchry/greek-keyboard-lm
- llama.cpp (quantize/inference): https://github.com/ggml-org/llama.cpp
- Downloads last month
- 301
4-bit
6-bit
8-bit
16-bit