https://github.com/nwokike/igbo-bilingual-chat
Colab notebook and source code used to fine-tune Microsoft's Phi-3-mini to understand, translate, and converse in the Igbo language while retaining general English capabilities. Plus script for safely resuming training after timeouts.
https://github.com/nwokike/igbo-bilingual-chat
african-languages ai bilingual chatbot fine-tuning gguf igbo llm machine-learning nlp unsloth
Last synced: 3 months ago
JSON representation
Colab notebook and source code used to fine-tune Microsoft's Phi-3-mini to understand, translate, and converse in the Igbo language while retaining general English capabilities. Plus script for safely resuming training after timeouts.
- Host: GitHub
- URL: https://github.com/nwokike/igbo-bilingual-chat
- Owner: Nwokike
- License: mit
- Created: 2025-12-02T15:47:26.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-12-02T16:20:12.000Z (7 months ago)
- Last Synced: 2025-12-05T13:56:46.534Z (7 months ago)
- Topics: african-languages, ai, bilingual, chatbot, fine-tuning, gguf, igbo, llm, machine-learning, nlp, unsloth
- Language: Jupyter Notebook
- Homepage: https://huggingface.co/nwokikeonyeka/Igbo-Phi3-Bilingual-Chat-v1-merged-Q5_K_M-GGUF
- Size: 15.6 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# š¤ Igbo-Phi3-Bilingual-Chat

[-orange?style=for-the-badge)](https://huggingface.co/nwokikeonyeka/Igbo-Phi3-Bilingual-Chat-v1-merged-Q5_K_M-GGUF)
[-yellow?style=for-the-badge)](https://huggingface.co/nwokikeonyeka/Igbo-Phi3-Bilingual-Chat-v1-merged)
[](LICENSE)
A specialized **Bilingual AI Assistant** trained to converse fluently in **Igbo** and **English**.
Unlike my previous attempt which was a simple translation model, this AI is a **conversational agent**. It can chat, explain concepts, reason, and define words in both languages while retaining the general intelligence of its base model (Phi-3).
---
## š„ Download Models
| Version | Best For... | Link |
| :--- | :--- | :--- |
| **GGUF (Q5_K_M)** | **Running locally** on laptops (Mac/Windows/Linux). Fast & Low RAM. | [š Download Here](https://huggingface.co/nwokikeonyeka/Igbo-Phi3-Bilingual-Chat-v1-merged-Q5_K_M-GGUF) |
| **Merged (F16)** | **Developers** who want to fine-tune further or use PyTorch. | [š Download Here](https://huggingface.co/nwokikeonyeka/Igbo-Phi3-Bilingual-Chat-v1-merged) |
---
## ā” Quick Colab Demo
If you don't have a Python environment set up, you can copy-paste this code into a [Google Colab](https://colab.research.google.com/) cell to test the model immediately.
```python
# --- 1. Install Libraries ---
!pip install llama-cpp-python huggingface_hub
# --- 2. Download & Load Model ---
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
REPO_ID = "nwokikeonyeka/Igbo-Phi3-Bilingual-Chat-v1-merged-Q5_K_M-GGUF"
FILENAME = "igbo-phi3-bilingual-chat-v1-merged-q5_k_m.gguf"
print(f"Downloading {FILENAME}...")
model_path = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
print("Loading model...")
llm = Llama(model_path=model_path, n_ctx=2048, verbose=False)
# --- 3. Chat Loop ---
print("\nš¤ IGBO CHATBOT READY (Type 'exit' to quit)")
while True:
user_input = input("\nYou: ")
if user_input.lower() in ['exit', 'quit']: break
# Correct Phi-3 Prompt Template
prompt = f"<|user|>\n{user_input}<|end|>\n<|assistant|>\n"
output = llm(prompt, max_tokens=256, stop=["<|end|>"], echo=False)
print(f"AI: {output['choices'][0]['text']}")
```
---
## š Training Data & Credits
This model was trained on a curated mix of over **700,000 examples** to ensure a balance between language fluency and general logic. Grateful acknowledgment to the creators of these open datasets:
1. **Fluency (522k pairs):** [ccibeekeoc42/english_to_igbo](https://huggingface.co/datasets/ccibeekeoc42/english_to_igbo)
*Primary source for sentence-level translation and grammar.*
2. **Vocabulary (5k definitions):** [nkowaokwu/ibo-dict](https://huggingface.co/datasets/nkowaokwu/ibo-dict)
*Provides deep knowledge of specific Igbo words and definitions.*
3. **General Memory (200k chats):** [HuggingFaceH4/ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k)
*Used to maintain the model's ability to chat, reason, and follow instructions without "forgetting" general knowledge.*
---
## š Quick Start (Local)
You can run the GGUF model on any computer with Python installed.
### 1. Install Dependencies
```bash
pip install llama-cpp-python huggingface_hub
````
### 2\. Run the Chat Script
Download the `chat.py` file from this repository and run it:
```bash
python chat.py
```
-----
## š§ Training Methodology: "The Colab Relay Race"
Training a full LLM on a free Google Colab GPU usually causes timeouts before completion. This project used a **"Relay Race" strategy**:
1. **Checkpointing:** The training script saves progress every 500 steps to Hugging Face.
2. **Resuming:** When Colab times out (approx. every 4 hours), a new session is started.
3. **Relaying:** The script automatically pulls the last checkpoint and resumes training exactly where it stopped.
**Stats:**
* **Base Model:** Microsoft Phi-3-mini-4k-instruct
* **Total Steps:** 44,500
* **Epochs:** 1
* **Training Time:** \~20 Hours (across multiple sessions)
-----
## š ļø Prompt Template
If you use this model in **Ollama**, **LM Studio**, or **Jan.ai**, ensure you use the **Phi-3** prompt format for the best results:
```text
<|user|>
{Your Question Here}<|end|>
<|assistant|>
{AI Response Here}<|end|>
```