Instructions to use lm-spell/llama-3.1-8b-it-ft-ssc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use lm-spell/llama-3.1-8b-it-ft-ssc with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/meta-llama-3.1-8b-instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "lm-spell/llama-3.1-8b-it-ft-ssc") - Transformers
How to use lm-spell/llama-3.1-8b-it-ft-ssc with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lm-spell/llama-3.1-8b-it-ft-ssc") 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("lm-spell/llama-3.1-8b-it-ft-ssc", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lm-spell/llama-3.1-8b-it-ft-ssc with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lm-spell/llama-3.1-8b-it-ft-ssc" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lm-spell/llama-3.1-8b-it-ft-ssc", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lm-spell/llama-3.1-8b-it-ft-ssc
- SGLang
How to use lm-spell/llama-3.1-8b-it-ft-ssc 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 "lm-spell/llama-3.1-8b-it-ft-ssc" \ --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": "lm-spell/llama-3.1-8b-it-ft-ssc", "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 "lm-spell/llama-3.1-8b-it-ft-ssc" \ --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": "lm-spell/llama-3.1-8b-it-ft-ssc", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use lm-spell/llama-3.1-8b-it-ft-ssc with Docker Model Runner:
docker model run hf.co/lm-spell/llama-3.1-8b-it-ft-ssc
Llama 3.1 8B Instruct Fine-tuned for Sinhala Spell Correction
A Llama 3.1 8B Instruct model fine-tuned for Sinhala spell correction using LoRA as part of the LMSpell project.
Model Details
- Base model:
unsloth/meta-llama-3.1-8b-instruct-bnb-4bit - Model type: LoRA adapter
- Language: Sinhala (
si) - Task: Sinhala Spell Correction (SSC)
- Training method: Supervised Fine-Tuning (SFT) with LoRA
- Dataset: Sinhala Spell Correction Dataset
- License: CC BY 4.0
- Project: LMSpell
Uses
Direct Use
The model can be used to correct spelling errors in Sinhala text.
Out-of-Scope Use
The model is not intended for languages other than Sinhala or for tasks unrelated to spell correction.
Limitations
- Performance may vary across different domains and text styles.
- The model may occasionally modify text that is already correctly spelled.
- Performance may be lower on informal, code-mixed, or domain-specific text.
How to Get Started
### 1. Model Loading
#### Using Unsloth
```python
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="lm-spell/llama-3.1-8b-it-ft-ssc"
)
tokenizer.pad_token = tokenizer.eos_token
FastLanguageModel.for_inference(model)
Using Transformers and PEFT
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
adapter_name = "lm-spell/llama-3.1-8b-it-ft-ssc"
base_model = "unsloth/meta-llama-3.1-8b-instruct-bnb-4bit"
tokenizer = AutoTokenizer.from_pretrained(adapter_name)
model = AutoModelForCausalLM.from_pretrained(
base_model
)
model = PeftModel.from_pretrained(
model,
adapter_name
)
tokenizer.pad_token = tokenizer.eos_token
2. Inference
import re
def clean_text(text):
match = re.search(r'### Output:\n(.*)', text, re.DOTALL)
if match:
return match.group(1).replace("Text:\n", "").replace("Output:\n", "").replace("###", "").strip()
return text.strip()
alpaca_prompt = f"""You are an Expert Sinhala Spell Corrector. Below is a sentence in Sinhala Language. It may or may not have a spelling mistake. Give the corrected output in Sinhala.
### Text:
{{}}
### Output:
{{}}"""
text = "යින් හැඟෙන්නේ පවත්නා අධ්යාපන ක්රමයේ පවතින උසස මට්ටමය ."
inputs = tokenizer(
[alpaca_prompt.format("", text)],
return_tensors="pt"
) # .to("cuda") if using unsloth
outputs = model.generate(**inputs)
pred_text = tokenizer.decode(
outputs[0],
skip_special_tokens=True
)
print(clean_text(pred_text))
Training Details
Training Data
The model was fine-tuned using the Sinhala Spell Correction Dataset.
Training Procedure
The model was fine-tuned using Supervised Fine-Tuning (SFT) with LoRA using Unsloth.
Evaluation
The model was evaluated for Sinhala spell correction using the evaluation datasets and metrics described in the LMSpell paper.
For detailed training methodology, dataset preparation, evaluation results, and comparisons with other models, please refer to the paper.
Research
LMSpell: Spell Correction with Pre-Trained Language Models
A. Gunathilake, N. Karunarathna, T. Bandaranayake, S. Ranathunga, N. de Silva and N. Jayatilleke, "LMSpell: Spell Correction with Pre-Trained Language Models," 2026 Moratuwa Engineering Research Conference (MERCon), Moratuwa, Sri Lanka, 2026, pp. 503-508.
- Paper: https://doi.org/10.1109/MERCon71835.2026.11691371
- Extended Preprint: https://arxiv.org/html/2512.05414v3
Citation
@INPROCEEDINGS{11691371,
author={Gunathilake, Akesh and Karunarathna, Nadil and Bandaranayake, Tharusha and Ranathunga, Surangika and de Silva, Nisansa and Jayatilleke, Nevidu},
booktitle={2026 Moratuwa Engineering Research Conference (MERCon)},
title={LMSpell: Spell Correction with Pre-Trained Language Models},
year={2026},
pages={503-508},
doi={10.1109/MERCon71835.2026.11691371}
}
Framework Versions
- PEFT: 0.17.1
- Downloads last month
- -