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")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Captainsl/SinhalaLLM") model = AutoModelForCausalLM.from_pretrained("Captainsl/SinhalaLLM") - llama-cpp-python
How to use Captainsl/SinhalaLLM with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Captainsl/SinhalaLLM", filename="SinhalaLLM.f16.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use Captainsl/SinhalaLLM with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -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-server -hf Captainsl/SinhalaLLM:F16 # Run inference directly in the terminal: llama-cli -hf Captainsl/SinhalaLLM:F16
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 Captainsl/SinhalaLLM:F16 # Run inference directly in the terminal: ./llama-cli -hf Captainsl/SinhalaLLM:F16
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 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
- 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 Studio new
How to use Captainsl/SinhalaLLM 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 Captainsl/SinhalaLLM 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 Captainsl/SinhalaLLM to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Captainsl/SinhalaLLM to start chatting
- 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
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf Captainsl/SinhalaLLM:F16# Run inference directly in the terminal:
llama-cli -hf Captainsl/SinhalaLLM:F16Use 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 Captainsl/SinhalaLLM:F16# Run inference directly in the terminal:
./llama-cli -hf Captainsl/SinhalaLLM:F16Build 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 Captainsl/SinhalaLLM:F16# Run inference directly in the terminal:
./build/bin/llama-cli -hf Captainsl/SinhalaLLM:F16Use Docker
docker model run hf.co/Captainsl/SinhalaLLM:F16- Sinhala Language Model Research - SmolLM2 Fine-tuning Attempt
Sinhala Language Model Research - SmolLM2 Fine-tuning Attempt
⚠️ EXPERIMENTAL MODEL - NOT FOR PRODUCTION USE
Model Description
- Base Model: HuggingFaceTB/SmolLM2-1.7B
- Fine-tuning Method: QLoRA (4-bit quantization with LoRA)
- Target Language: Sinhala (සිංහල)
- Status: Research prototype with significant limitations
Research Context
This model represents an undergraduate research attempt to adapt SmolLM2-1.7B for Sinhala language generation. Part of thesis: "Developing a Fluent Sinhala Language Model: Enhancing AI's Cultural and Linguistic Adaptability" (NSBM Green University, 2025).
Training Details
Dataset
- Size: 427,000 raw examples → 406,532 after cleaning
- Sources:
- YouTube comments (32%)
- Web scraped content (35%)
- Translated instructions (23%)
- Curated texts (10%)
- Data Quality: Mixed (social media, news, translated content)
- Processing: Custom cleaning pipeline removing URLs, emails, duplicates
Training Configuration
- Hardware: NVIDIA RTX 4090 (24GB VRAM) via Vast.ai
- Training Time: 48 hours
- Total Cost: $19.20 (budget-constrained research)
- Framework: Unsloth for memory efficiency
- LoRA Parameters:
- Rank (r): 16
- Alpha: 16
- Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Trainable parameters: 8.4M/1.7B (99.5% reduction)
Hyperparameters
- Learning rate: 2e-5
- Batch size: 8 (gradient accumulation: 1)
- Max sequence length: 2048 (reduced to 512 for memory)
- Mixed precision: FP16
- Optimizer: adamw_8bit
Evaluation Results
Quantitative Metrics
- Perplexity: 218,443 (target was <50) ❌
- BLEU Score: 0.0000 ❌
- Training Loss: 1.847 (converged)
- Task Completion Rate:
- General conversation: 0%
- Mathematics: 100% (but output corrupted)
- Cultural context: 0%
- Instruction following: 33%
Critical Issues Discovered
⚠️ Tokenizer Incompatibility: The model exhibits catastrophic tokenizer-model mismatch, generating English vocabulary tokens ("Drum", "Chiefs", "RESP") instead of Sinhala text. This represents a fundamental architectural incompatibility between SmolLM2's tokenizer and Sinhala script.
Sample Outputs (Showing Failure Pattern)
Input: "ඔබේ නම කුමක්ද?"
Expected: "මගේ නම [name] වේ"
Actual: "Drum Chiefs RESP frontend(direction..."
Research Contributions
Despite technical failure, this research provides:
- Dataset: 427,000 curated Sinhala examples (largest publicly available)
- Pipeline: Reproducible training framework for low-resource languages
- Discovery: Documentation of critical tokenizer challenges for non-Latin scripts
- Methodology: Budget-conscious approach ($30 total) for LLM research
Limitations & Warnings
- ❌ Does NOT generate coherent Sinhala text
- ❌ Tokenizer fundamentally incompatible with Sinhala
- ❌ Not suitable for any production use
- ✅ Useful only as research artifact and negative result documentation
Intended Use
This model is shared for:
- Academic transparency and reproducibility
- Documentation of challenges in low-resource language AI
- Foundation for future research improvements
- Example of tokenizer-model compatibility issues
Recommendations for Future Work
- Use multilingual base models (mT5, XLM-R, BLOOM)
- Develop Sinhala-specific tokenizer
- Increase dataset to 1M+ examples
- Consider character-level or byte-level models
How to Reproduce Issues
# This will demonstrate the tokenizer problem
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("path/to/model")
tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolLM2-1.7B")
input_text = "ශ්රී ලංකාව"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=50)
print(tokenizer.decode(outputs[0]))
# Output will be gibberish English tokens
Citation
@thesis{dharmasiri2025sinhala,
title={Developing a Fluent Sinhala Language Model: Enhancing AI's Cultural and Linguistic Adaptability},
author={Dharmasiri, H.M.A.H.},
year={2025},
school={NSBM Green University},
note={Undergraduate thesis documenting challenges in low-resource language AI}
}
Ethical Considerations
- Model outputs are not reliable for Sinhala generation
- Should not be used for any decision-making
- Shared for research transparency only
License
MIT License - for research and educational purposes
- Downloads last month
- 19
Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf Captainsl/SinhalaLLM:F16# Run inference directly in the terminal: llama-cli -hf Captainsl/SinhalaLLM:F16