Instructions to use MathematicianNLPer/GemMaroc-27b-it-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MathematicianNLPer/GemMaroc-27b-it-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MathematicianNLPer/GemMaroc-27b-it-GGUF", dtype="auto") - llama-cpp-python
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="MathematicianNLPer/GemMaroc-27b-it-GGUF", filename="GemMaroc-27b-it.IQ4_XS.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
Use Docker
docker model run hf.co/MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MathematicianNLPer/GemMaroc-27b-it-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MathematicianNLPer/GemMaroc-27b-it-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
- SGLang
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF 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 "MathematicianNLPer/GemMaroc-27b-it-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MathematicianNLPer/GemMaroc-27b-it-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "MathematicianNLPer/GemMaroc-27b-it-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MathematicianNLPer/GemMaroc-27b-it-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF with Ollama:
ollama run hf.co/MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
- Unsloth Studio new
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MathematicianNLPer/GemMaroc-27b-it-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MathematicianNLPer/GemMaroc-27b-it-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for MathematicianNLPer/GemMaroc-27b-it-GGUF to start chatting
- Docker Model Runner
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF with Docker Model Runner:
docker model run hf.co/MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
- Lemonade
How to use MathematicianNLPer/GemMaroc-27b-it-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MathematicianNLPer/GemMaroc-27b-it-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.GemMaroc-27b-it-GGUF-Q4_K_M
List all available models
lemonade list
About
static quants of https://huggingface.co/AbderrahmanSkiredj1/GemMaroc-27b-it
weighted/imatrix quants seem not to be available (by me) at this time. If they do not show up a week or so after the static ones, I have probably not planned for them. Feel free to request them by opening a Community Discussion.
Usage
If you are unsure how to use GGUF files, refer to one of TheBloke's READMEs for more details, including on how to concatenate multi-part files.
Provided Quants
(sorted by size, not necessarily quality. IQ-quants are often preferable over similar sized non-IQ quants)
| Link | Type | Size/GB | Notes |
|---|---|---|---|
| GGUF | Q2_K | 10.6 | |
| GGUF | Q3_K_S | 12.3 | |
| GGUF | Q3_K_M | 13.5 | lower quality |
| GGUF | Q3_K_L | 14.6 | |
| GGUF | IQ4_XS | 15.0 | |
| GGUF | Q4_K_S | 15.8 | fast, recommended |
| GGUF | Q4_K_M | 16.6 | fast, recommended |
| GGUF | Q5_K_S | 18.9 | |
| GGUF | Q5_K_M | 19.4 | |
| GGUF | Q6_K | 22.3 | very good quality |
| GGUF | Q8_0 | 28.8 | fast, best quality |
Here is a handy graph by ikawrakow comparing some lower-quality quant types (lower is better):
And here are Artefact2's thoughts on the matter: https://gist.github.com/Artefact2/b5f810600771265fc1e39442288e8ec9
GemMaroc‑27B
Unlocking Moroccan Darija proficiency in a state‑of‑the‑art large language model, trained with a minimal‑data, green‑AI recipe that preserves Gemma‑27B’s strong reasoning abilities while adding fluent Darija generation.
Model at a glance
| Details | |
|---|---|
| Model ID | AbderrahmanSkiredj1/GemMaroc-27b-it |
| Base model | google/gemma-3-27b |
| Architecture | Decoder‑only Transformer (Gemma 3) |
| Parameters | 27 billion |
| Context length | 2 048 tokens |
| Training regime | Supervised fine‑tuning (LoRA → merged) on 50 K high‑quality Darija/English instructions TULU‑50K slice |
| Compute budget | 48 GPU·h (8 × H100‑80GB × 6 h) – ≈ 26 kWh / 10 kg CO₂e |
| License | Apache 2.0 |
Why another Darija model?
- Inclusive AI > 36 million speakers of Moroccan Arabic remain underserved by open LLMs.
- Quality‑over‑quantity A carefully curated 50 K instruction set surfaces Darija competence without sacrificing cross‑lingual reasoning.
- Green AI GemMaroc achieves Atlas‑Chat‑level Darija scores using < 2 % of the energy.
Benchmark summary
| Model | Darija MMLU | Darija HellaSwag | GSM8K @5 | HellaSwag (EN) |
|---|---|---|---|---|
| Atlas‑Chat‑27B | 61.9 % | 48.4 % | 82.0 % | 77.8 % |
| GemMaroc‑27B | 61.6 % | 60.5 % | 84.2 % | 79.3 % |
Zero‑shot accuracy; full table in the paper.
Quick start
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_id = "AbderrahmanSkiredj1/GemMaroc-27b-it"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto"
)
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
device_map="auto",
max_new_tokens=1024,
temperature=0.7,
repetition_penalty=1.2,
no_repeat_ngram_size=3,
)
messages = [
{"role": "user", "content": "شنو هي نظرية ‘butterfly effect’؟ فسّرها بدارجة ونقّط مثال بسيط."}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print(pipe(prompt)[0]["generated_text"][len(prompt):])
Chat template (Gemma 3 format)
The tokenizer provides a baked‑in Jinja template that starts with a begin‑of‑sequence token (<bos>), then alternates user/model turns, each wrapped by <start_of_turn> … <end_of_turn> markers. When you set add_generation_prompt=True it ends after the opening model tag so the model can continue:
<bos><start_of_turn>user
{user message}<end_of_turn>
<start_of_turn>model
The assistant will keep generating tokens until it decides to emit <end_of_turn>.
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
No manual token juggling required—the call above handles BOS, turn delimiters, and newline placement automatically.
Pre‑quantised checkpoints will be published under the same repo tags (gemmaroc‑27b‑awq‑int4, gemmaroc‑27b‑gguf‑q4_k_m).
Training recipe (one‑paragraph recap)
- Data Translate a 44 K reasoning slice of TULU 50K into Darija, keeping 20 % English for cross‑lingual robustness.
- LoRA SFT Rank 16, α = 32, 3 epochs, bf16, context 2 048.
- Merge & push Merge LoRA into base weights (
peft.merge_and_unload), convert to safetensors, upload.
Limitations & ethical considerations
- Sentiment and abstractive summarisation still trail state‑of‑the‑art.
- Tokeniser is unchanged; rare Darija spellings may fragment.
- Model may inherit societal biases present in pre‑training data.
- No RLHF / RLAIF safety alignment yet – apply a moderation layer in production.
Citation
If you use GemMaroc in your work, please cite:
@misc{skiredj2025gemmarocunlockingdarijaproficiency,
title={GemMaroc: Unlocking Darija Proficiency in LLMs with Minimal Data},
author={Abderrahman Skiredj and Ferdaous Azhari and Houdaifa Atou and Nouamane Tazi and Ismail Berrada},
year={2025},
eprint={2505.17082},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2505.17082},
}
- Downloads last month
- 55
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for MathematicianNLPer/GemMaroc-27b-it-GGUF
Base model
google/gemma-3-27b-pt