Instructions to use lm-spell/mbart50-ft-ssc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lm-spell/mbart50-ft-ssc with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lm-spell/mbart50-ft-ssc")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("lm-spell/mbart50-ft-ssc") model = AutoModel.from_pretrained("lm-spell/mbart50-ft-ssc", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lm-spell/mbart50-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/mbart50-ft-ssc" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lm-spell/mbart50-ft-ssc", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/lm-spell/mbart50-ft-ssc
- SGLang
How to use lm-spell/mbart50-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/mbart50-ft-ssc" \ --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": "lm-spell/mbart50-ft-ssc", "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 "lm-spell/mbart50-ft-ssc" \ --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": "lm-spell/mbart50-ft-ssc", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use lm-spell/mbart50-ft-ssc with Docker Model Runner:
docker model run hf.co/lm-spell/mbart50-ft-ssc
mBART50 Fine-tuned for Sinhala Spell Correction
Model Details
- Developed by: Team Surgical Masks
- License: CC BY 4.0
- Model Type: mBART50
- Language: Sinhala (
si) - Fine-tuned from: facebook/mbart-large-50
- Dataset: Sinhala Spell Correction Dataset
- Project: LMSpell
Usage
from transformers import MBart50TokenizerFast, MBartForConditionalGeneration
model_name = "lm-spell/mbart50-ft-ssc"
language_code = "si_LK"
model = MBartForConditionalGeneration.from_pretrained(model_name)
tokenizer = MBart50TokenizerFast.from_pretrained(
model_name,
src_lang=language_code,
tgt_lang=language_code
)
ZWJ_token = '<ZWJ>'
ZWJ_unicode = '\u200D'
text = "යින් හැඟෙන්නේ පවත්නා අධ්යාපන ක්රමයේ පවතින උසස මට්ටමය ."
text = text.replace(ZWJ_unicode, ZWJ_token)
inputs = tokenizer(text, return_tensors="pt")
output = model.generate(**inputs)
zwj_id = tokenizer.convert_tokens_to_ids("<ZWJ>")
special_ids = set(tokenizer.all_special_ids) - {zwj_id}
tokens = [token for token in output[0].tolist() if token not in special_ids]
decoded = tokenizer.decode(tokens, skip_special_tokens=False)
decoded = decoded.replace(f'{ZWJ_token} ',ZWJ_unicode)
print(decoded)
Zero Width Joiner Handling
mbart model does not preserve the Unicode Zero Width Joiner (\u200D) during tokenization and generation. To address this, LMSpell represents the Zero Width Joiner using a custom special token, <ZWJ>, during inference.
Before tokenization, occurrences of \u200D are replaced with <ZWJ>. After generation and decoding, <ZWJ> is converted back to the original Unicode Zero Width Joiner (\u200D).
This ensures that Zero Width Joiners are preserved throughout the spell-correction process.
Limitations
- The model is specifically fine-tuned for Sinhala spell correction and may not generalize to other languages.
- Performance may vary for informal text, social media content, code-mixed text, and text containing uncommon or domain-specific vocabulary.
- The model may occasionally modify text that is already correctly spelled.
Research
For details on the training methodology, dataset preparation, evaluation, results, limitations, and comparisons with other models, please refer to the LMSpell paper:
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}
}
- Downloads last month
- 62
Model tree for lm-spell/mbart50-ft-ssc
Base model
facebook/mbart-large-50