Swahili GPT-2 language model with a C-based inference server powered by ONNX Runtime and Mongoose, exposing an OpenAI-compatible chat completions API
## Swahili GPT-2 Submission
This project implements a Swahili GPT-2-style inference pipeline in C using ONNX Runtime, with a lightweight HTTP server stub built on Mongoose.
It demonstrates:
- training support via `train_swahili.py` and whole notebook in `train.ipynb`
- tokenizer export and model export workflows
- tokenization and inference plumbing in C
- a minimal OpenAI-style `/v1/chat/completions` server stub
---
## Repository Layout
- `src/` — core C sources and headers for the inference engine and server
- `model/` — model artifacts and tokenizer files
- `scripts/` — helper utilities for model file setup and build support
- `tools/` — testing and inference utilities
- `python_server/` — Python-based server/demo support
---
## IMPORTANT: Model Files (Download Required)
The large model files are not guaranteed to be included in the GitHub repository due to size limits.
Download them manually and place them in `model/`.
- **model.onnx**
drive.google.com
- **model.safetensors**
drive.google.com
Place both files inside:
```powershell
C:\Users\YourUser\Desktop\Swahili_gpt2\model
```
If `model.onnx` or `model.safetensors` are missing, the C inference and server builds will not work correctly.
---
## Build Requirements
- Windows with GCC or MSYS2/Mingw-w64 installed
- `mongoose.c` and `mongoose.h` available in `externals/mongoose/` or `third_party/mongoose/`
Optional for real inference:
- ONNX Runtime C SDK for Windows
- `ORT_INCLUDE` and `ORT_LIB` environment variables set to the ONNX Runtime SDK paths
Example PowerShell settings:
```powershell
$env:ORT_INCLUDE = 'C:\externals\onnxruntime\include'
$env:ORT_LIB = 'C:\externals\onnxruntime\lib'
```
If `ORT_INCLUDE`/`ORT_LIB` are not set, `build.ps1` will still compile a stub C server and engine. The stub s …