Text Generation
Transformers
Safetensors
GGUF
Sinhala
llama
experimental
low-resource-languages
research
proof-of-concept
text-generation-inference
Instructions to use Captainsl/SinhalaLLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Captainsl/SinhalaLLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Captainsl/SinhalaLLM")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Captainsl/SinhalaLLM") model = AutoModelForCausalLM.from_pretrained("Captainsl/SinhalaLLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Captainsl/SinhalaLLM 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 Captainsl/SinhalaLLM:F16 # Run inference directly in the terminal: llama cli -hf Captainsl/SinhalaLLM:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Captainsl/SinhalaLLM:F16 # Run inference directly in the terminal: llama cli -hf Captainsl/SinhalaLLM:F16
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 Captainsl/SinhalaLLM:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf Captainsl/SinhalaLLM:F16
Use Docker
docker model run hf.co/Captainsl/SinhalaLLM:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use Captainsl/SinhalaLLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Captainsl/SinhalaLLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Captainsl/SinhalaLLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Captainsl/SinhalaLLM:F16
- SGLang
How to use Captainsl/SinhalaLLM 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 "Captainsl/SinhalaLLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Captainsl/SinhalaLLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Captainsl/SinhalaLLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Captainsl/SinhalaLLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use Captainsl/SinhalaLLM with Ollama:
ollama run hf.co/Captainsl/SinhalaLLM:F16
- Unsloth Desktop
- Docker Model Runner
How to use Captainsl/SinhalaLLM with Docker Model Runner:
docker model run hf.co/Captainsl/SinhalaLLM:F16
- Lemonade
How to use Captainsl/SinhalaLLM with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Captainsl/SinhalaLLM:F16
Run and chat with the model
lemonade run user.SinhalaLLM-F16
List all available models
lemonade list
- Atomic Chat
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- si
|
| 5 |
+
base_model:
|
| 6 |
+
- HuggingFaceTB/SmolLM2-1.7B
|
| 7 |
+
library_name: transformers
|
| 8 |
+
tags:
|
| 9 |
+
- Genral
|
| 10 |
+
- text-generation-inference
|
| 11 |
+
---
|
| 12 |
+
# SinhalaLLM (Fine-tuned SmolLM2 + Sinhala tokenizer)
|
| 13 |
+
|
| 14 |
+
Model: HuggingFaceTB/SmolLM2-1.7B (base) + LoRA finetune (merged)
|
| 15 |
+
Tokenizer: polyglots/Extended-Sinhala-LLaMA (custom Sinhala tokenizer)
|
| 16 |
+
Language: Sinhala (si)
|
| 17 |
+
|
| 18 |
+
## Summary
|
| 19 |
+
This model is a SmolLM2-1.7B base model fine-tuned on Sinhala text (MADLAD_CulturaX_cleaned).
|
| 20 |
+
Finetuning method: 4-bit LoRA finetuning via Unsloth + PEFT; final artifact merged into a standard HF model.
|
| 21 |
+
|
| 22 |
+
## Training data
|
| 23 |
+
- Source: polyglots/MADLAD_CulturaX_cleaned (filtered to `lang == "si"`)
|
| 24 |
+
- Preprocessing: cleaned and deduplicated; chunked into sequences of length 256; tokenized with `polyglots/Extended-Sinhala-LLaMA`.
|
| 25 |
+
- Train/validation split: 99% / 1%.
|
| 26 |
+
|
| 27 |
+
## Hyperparameters (high-level)
|
| 28 |
+
- Sequence length: 256
|
| 29 |
+
- LoRA rank (r): 16
|
| 30 |
+
- LoRA alpha: 16
|
| 31 |
+
- LoRA dropout: 0.05
|
| 32 |
+
- Optimizer: AdamW fused
|
| 33 |
+
- Learning rate: 2e-4
|
| 34 |
+
- Batch size (effective): per-device batch 8, gradient accumulation 2 (effective 16)
|
| 35 |
+
- Mixed precision: bf16 or fp16 where available
|
| 36 |
+
|
| 37 |
+
## Evaluation
|
| 38 |
+
- Quick evaluation performed on a held-out 1% validation sample,
|
| 39 |
+
- Reported metric: perplexity (see run logs in the repo)
|
| 40 |
+
|
| 41 |
+
## How to use
|
| 42 |
+
Install transformers and load:
|
| 43 |
+
```python
|
| 44 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 45 |
+
tok = AutoTokenizer.from_pretrained("path_or_repo/sinhala_merged")
|
| 46 |
+
model = AutoModelForCausalLM.from_pretrained("path_or_repo/sinhala_merged", device_map="auto")
|
| 47 |
+
````
|
| 48 |
+
|
| 49 |
+
## Export / Run locally
|
| 50 |
+
|
| 51 |
+
* To run on CPU or inference frameworks you can create a GGUF with `llama.cpp` converters and quantize to Q4 variants.
|
| 52 |
+
|
| 53 |
+
## Limitations and risks
|
| 54 |
+
|
| 55 |
+
* Model trained on web-scraped data; it may reproduce harmful content or biases present in the training data.
|
| 56 |
+
* Not safe for high-stakes medical, legal, or safety-critical advice.
|
| 57 |
+
|
| 58 |
+
## License
|
| 59 |
+
|
| 60 |
+
Specify dataset and model license here.
|