Instructions to use Aadhil96/gemma3-4b-sinhala-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Aadhil96/gemma3-4b-sinhala-v1 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-3-4b-it-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Aadhil96/gemma3-4b-sinhala-v1") - Transformers
How to use Aadhil96/gemma3-4b-sinhala-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Aadhil96/gemma3-4b-sinhala-v1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Aadhil96/gemma3-4b-sinhala-v1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Aadhil96/gemma3-4b-sinhala-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Aadhil96/gemma3-4b-sinhala-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Aadhil96/gemma3-4b-sinhala-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Aadhil96/gemma3-4b-sinhala-v1
- SGLang
How to use Aadhil96/gemma3-4b-sinhala-v1 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 "Aadhil96/gemma3-4b-sinhala-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Aadhil96/gemma3-4b-sinhala-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Aadhil96/gemma3-4b-sinhala-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Aadhil96/gemma3-4b-sinhala-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use Aadhil96/gemma3-4b-sinhala-v1 with Docker Model Runner:
docker model run hf.co/Aadhil96/gemma3-4b-sinhala-v1
Gemma 3 4B Sinhala v1 (experimental)
Experimental, not suitable for real use. In its one recorded test answer, this first version produced mostly meaningless Sinhala, and it did not meet its quality target. See "Known problems" below.
A LoRA adapter for unsloth/gemma-3-4b-it-bnb-4bit, fine-tuned on machine-translated Sinhala instructions.
Training notebook: https://www.kaggle.com/code/aadhilimam/sinhala-llm-fine-tuning-on-kaggle
Known problems
- Poor output: asked for the capital of Sri Lanka, the model replied with a mostly meaningless sentence containing stray non-Sinhala characters.
- Missed quality target: mean perplexity was 23.11 on 50 held-out rows, against a target of 15 or lower.
- Broken spelling in the training data: the translation step dropped the zero-width joiner, leaving a space in its place (for example
ප් රධානinstead ofප්රධාන). This affected 4,392 of the 5,000 translated rows, and the model was trained on that text. The data was not repaired before training. - Other data noise: about 7.7% of translated answers repeat themselves, and 228 were less than half Sinhala.
- No native-speaker review: no Sinhala speaker has reviewed the output.
- Limited training record: training loss was not captured in the run log.
Training
| Setting | Value |
|---|---|
| Base model | unsloth/gemma-3-4b-it-bnb-4bit |
| Data | First 5,000 rows of yahma/alpaca-cleaned, translated with facebook/nllb-200-distilled-600M, plus 2 hand-written rows |
| Split | 4,642 train, 245 held out, after cleaning |
| Method | QLoRA with Unsloth and TRL (r = 16, alpha = 16) |
| Training | 2 epochs, 582 steps, batch size 2 with 8 accumulation steps, learning rate 2e-4 |
| Hardware | One NVIDIA Tesla T4 on Kaggle |
License
Use of this adapter with the base model is subject to the Gemma terms of use: https://ai.google.dev/gemma/terms
- Downloads last month
- 23
Model tree for Aadhil96/gemma3-4b-sinhala-v1
Base model
google/gemma-3-4b-pt