Downloads · 30 days
0
ovinduG/sinllama-nawarasa-lora
sinllama-nawarasa-lora is a machine learning model from ovinduG. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A Sinhala emotion classification model based on the classical Nawarasa framework. This LoRA adapter is fine-tuned on top of polyglots/SinLlamav01.
Downloads · 30 days
0
Access
Public
Updated Feb 27, 2026
Repo size
7.5 GB
Likes
0
Public
Click a slice to open those files.
.safetensors7.5 GB · 100%
From the Hugging Face model README
A Sinhala emotion classification model based on the classical Nawarasa framework.
This LoRA adapter is fine-tuned on top of polyglots/SinLlama_v01.
language:
This model is a culturally grounded emotion classification system for Sinhala text, based on the classical Nawarasa framework. It is a LoRA adapter fine-tuned on top of polyglots/SinLlama_v01 (a Sinhala-extended Llama-3-8B model).
The objective of this model is to accurately identify the dominant emotional category expressed in Sinhala song lyrics and poetic text. It maps complex poetic metaphors and idioms into one of the 9 classical aesthetic emotions (Nawarasa).
polyglots/SinLlama_v01The model was trained on a custom, manually annotated dataset of Sinhala song lyrics and poetic segments.
Each segment was:
bfloat16This model is intended for:
This model is not designed for:
Classical Sinhala poetry and modern lyrics skew toward:
As a result, the model may statistically favor these classes when handling ambiguous or emotionally mixed text.
Because this model was trained using an Alpaca-style instruction format, performance depends heavily on correct prompt formatting. Deviating from the expected format may reduce classification accuracy.
The model performs best on:
Performance may degrade on:
As a LoRA adapter built on Llama-3 architecture, it inherits the general limitations of large language models, including:
For best performance and memory efficiency, use Unsloth for inference.
pip install "unsloth @ git+https://github.com/unslothai/unsloth.git"
pip install transformers huggingface_hub torch
---
# 📦 Installation
```bash
pip install "unsloth @ git+https://github.com/unslothai/unsloth.git"
pip install transformers huggingface_hub torch
from unsloth import FastLanguageModel
import torch
# Load the base model + LoRA adapter
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="ovinduG/sinllama-nawarasa-lora",
max_seq_length=2048,
dtype=torch.bfloat16,
load_in_4bit=True,
resize_model_vocab=139336, # Required for SinLlama's extended vocabulary
)
# Enable optimized inference
FastLanguageModel.for_inference(model)
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
පහත පදය තුළ පවතින ප්රමුඛ රසය නවරස අනුව හඳුනාගන්න: Shringara, Hasya, Karuna, Roudhra, Veera, Bhayanakam, Bhibatsa, Adbhutha, Shantha.
### Input:
{}
### Response:
"""
def predict_nawarasa(lyric_text):
prompt = alpaca_prompt.format(lyric_text)
inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=10,
use_cache=True,
temperature=0.1, # Low temperature for classification stability
do_sample=False
)
decoded = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
return decoded.split("### Response:\n")[-1].strip()
lyric = "කඩුව අතට ගෙන පෙරමුණටම යන්නෙමි, මව්බිම වෙනුවෙන් රුධිරය දන් දෙන්නෙමි"
prediction = predict_nawarasa(lyric)
print("Predicted Nawarasa:", prediction)
# Expected Output:
# Veera
polyglots/SinLlama_v01For research collaboration, issues, or feature requests: