Instructions to use Ym512/amazigh-odyssey-gm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Ym512/amazigh-odyssey-gm with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-Nemo-Instruct-2407") model = PeftModel.from_pretrained(base_model, "Ym512/amazigh-odyssey-gm") - Notebooks
- Google Colab
- Kaggle
Amazigh Odyssey — Game Master (LoRA)
A fine-tuned LoRA adapter for Mistral Nemo 12B that acts as the Game Master of Amazigh Odyssey, a narrative RPG set in mythical ancient North Africa (Numidia).
The model generates immersive narration in French enriched with Kabyle vocabulary, Tifinagh script, Amazigh mythology, and structured game mechanics (choices, effects, combat).
Model Details
| Base model | mistralai/Mistral-Nemo-Instruct-2407 (12B) |
| Adapter type | LoRA (PEFT) |
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Trainable params | 114M / 12.2B (0.92%) |
| Adapter size | ~456 MB |
Training
| Dataset | 286 custom samples (139 KB JSONL) |
| Format | Mistral SFT chat format ({"messages": [...]}) |
| Categories | Narration, Kabyle dialogue, combat, Tifinagh magic, proverbs, cultural lore, exploration |
| Epochs | 3 |
| Batch size | 2 (effective 16 with grad_accum=8) |
| Learning rate | 2e-4 (cosine schedule, 10% warmup) |
| Precision | bf16 |
| Hardware | NVIDIA L40S 48GB |
| Training time | 2 min 54 sec |
Metrics
| Metric | Value |
|---|---|
| Train loss | 3.54 → 0.47 |
| Eval loss | 1.019 |
| Token accuracy | 90% |
| Peak VRAM | 35.3 GB |
Dataset
The training data covers 7 categories of game master interactions:
- Narration — Scene descriptions for locations (Cirta, Tassili caves, Atlas mountains, Sahara)
- Kabyle dialogue — NPC conversations with Kabyle phrases and Tifinagh script (Dihya, Tin Hinan, Jugurtha, Massinissa)
- Combat — Encounters with mythical creatures (djinns, stone guardians, cursed bulls)
- Tifinagh magic — Spell casting using glyph combinations (fire+air, water+earth, etc.)
- Proverbs — Integration of authentic Kabyle proverbs into gameplay
- Cultural lore — Amazigh pantheon (Ammon, Tanit, Anzar, Ifri, Gurzil, Tafukt)
- Exploration — Discovery events, environmental storytelling
Usage
With transformers + PEFT
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained(
"mistralai/Mistral-Nemo-Instruct-2407",
device_map="auto",
torch_dtype="auto",
)
model = PeftModel.from_pretrained(base, "Ym512/amazigh-odyssey-gm")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-Nemo-Instruct-2407")
messages = [
{"role": "user", "content": "Le joueur entre dans les Grottes du Tassili pour la première fois. Décris la scène."}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=512, temperature=0.8, do_sample=True)
print(tokenizer.decode(output[0], skip_special_tokens=True))
With vLLM (recommended for serving)
pip install vllm
vllm serve mistralai/Mistral-Nemo-Instruct-2407 \
--enable-lora \
--lora-modules amazigh-gm=Ym512/amazigh-odyssey-gm \
--port 8000
With the Amazigh Odyssey backend
# In .env:
USE_FINETUNED_GM=true
FINETUNED_GM_URL=http://localhost:8000
# Start serving, then start the game backend
python -m finetune.serve_model
python -m uvicorn backend.server:app --port 8765
Example Output
Prompt: "Le joueur rencontre Dihya pour la première fois."
Response:
Une femme se tient au sommet du rocher, son armure de cuir gravée de glyphes tifinagh, ses yeux d'ambre te transpercent.
"ⵜⵉⵍⴻⵍⵍⵉ... Tilelli. Liberté. C'est le premier mot qu'on apprend dans ces montagnes."
Elle croise les bras.
"Tu portes un glyphe que tu ne comprends pas encore. Qui t'a donné ce pouvoir, étranger ?"
Project
Part of Amazigh Odyssey — Numidia Mythica, a 3D RPG powered by Mistral AI multi-agents. Built for the Mistral AI hackathon.
- Game backend: FastAPI + WebSocket with 4 AI agents (Game Master, Narrator, Combat, Dialogue)
- 3D world: Godot 4 with AI-connected NPCs
- Cultural data: 289 entries of Kabyle vocabulary, proverbs, mythology, songs
License
Apache 2.0 (same as base model)
- Downloads last month
- 1
Model tree for Ym512/amazigh-odyssey-gm
Base model
mistralai/Mistral-Nemo-Base-2407