Text Generation
Transformers
Nepali
English
tokenizer
sentencepiece
bpe
nepali
romanized-nepali
bilingual
multilingual
legal
qwen3
chatml
nyayalm
conversational
Instructions to use chhatramani/nyayalm-SentencePiece_BPE-64k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chhatramani/nyayalm-SentencePiece_BPE-64k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="chhatramani/nyayalm-SentencePiece_BPE-64k") 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("chhatramani/nyayalm-SentencePiece_BPE-64k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use chhatramani/nyayalm-SentencePiece_BPE-64k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chhatramani/nyayalm-SentencePiece_BPE-64k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chhatramani/nyayalm-SentencePiece_BPE-64k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/chhatramani/nyayalm-SentencePiece_BPE-64k
- SGLang
How to use chhatramani/nyayalm-SentencePiece_BPE-64k 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 "chhatramani/nyayalm-SentencePiece_BPE-64k" \ --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": "chhatramani/nyayalm-SentencePiece_BPE-64k", "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 "chhatramani/nyayalm-SentencePiece_BPE-64k" \ --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": "chhatramani/nyayalm-SentencePiece_BPE-64k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use chhatramani/nyayalm-SentencePiece_BPE-64k with Docker Model Runner:
docker model run hf.co/chhatramani/nyayalm-SentencePiece_BPE-64k
NyayaLM 64K SentencePiece-BPE Tokenizer
A production-grade 64 000-vocab SentencePiece BPE tokenizer trained for Nepali (Devanagari), Romanized Nepali, and English, with special focus on legal and institutional text.
This is the SentencePiece_BPE tokenizer, trained on the exact same corpus and vocabulary budget for fair comparison with BPE only Tokenizer.
Highlights
| Property | Value |
|---|---|
| Vocabulary size | 64 000 |
| Algorithm | SentencePiece BPE + byte_fallback |
| Scripts | Devanagari + Latin |
| Languages | Nepali, Romanized Nepali, English |
| Special tokens | Qwen3 style (high IDs) |
| EOS | `< |
| PAD / document sep. | `< |
| BOS | None (Qwen-style) |
| Character coverage | 0.9995 |
| License | Apache 2.0 |
Quick start
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("chhatramani/nyayalm-SentencePiece_BPE-64k")
text = "नेपालको संविधान २०७२ ले मौलिक हकको ग्यारेन्टी गर्दछ।"
ids = tok.encode(text, add_special_tokens=False)
print(len(ids), tok.decode(ids))
messages = [
{"role": "system", "content": "You are a helpful legal assistant for Nepal."},
{"role": "user", "content": "नेपालको संविधानमा मौलिक हक के-के छन्?"},
]
print(tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True))
Citation
@misc{nyayalm_tokenizer_64k_bpe,
title = {NyayaLM 64K SentencePiece-BPE Tokenizer for Nepali, Romanized Nepali, and English},
author = {Chhatramani Yadav},
year = {2026},
howpublished = {\url{https://huggingface.co/chhatramani/nyayalm-SentencePiece_BPE-64k}},
}
License
Apache License 2.0.