Downloads · 30 days
0
pandurangpatil/sample-marathi-bpe-tokenizer
sample-marathi-bpe-tokenizer is a machine learning model from pandurangpatil. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for tokenizers. The card lists the license as mit.
A Byte Pair Encoding (BPE) tokenizer trained on Marathi text using the Devanagari script.
Downloads · 30 days
0
Access
Public
Updated Nov 7, 2025
Repo size
—
Likes
1
Public
Click a slice to open those files.
.json697 KB · 99%
From the Hugging Face model README
A Byte Pair Encoding (BPE) tokenizer trained on Marathi text using the Devanagari script.
The tokenizer was trained using a custom Byte Pair Encoding implementation optimized for Devanagari script:
from tokenizers import Tokenizer
# Load the tokenizer
tokenizer = Tokenizer.from_pretrained("pandurangpatil/sample-marathi-bpe-tokenizer")
# Encode text
text = "नमस्कार! हे एक मराठी टोकनायझर आहे."
encoded = tokenizer.encode(text)
print(f"Token IDs: {encoded.ids}")
print(f"Tokens: {encoded.tokens}")
# Decode back to text
decoded = tokenizer.decode(encoded.ids)
print(f"Decoded: {decoded}")
If you want to use the raw artifacts:
import json
from tokenizer_utils import encode, decode
# Load artifacts
with open('vocab.json', 'r', encoding='utf-8') as f:
token_to_id = json.load(f)
with open('merges.json', 'r', encoding='utf-8') as f:
merges_str = json.load(f)
merges = {tuple(map(int, k.split(','))): v for k, v in merges_str.items()}
with open('id_to_token.json', 'r', encoding='utf-8') as f:
id_to_token = {int(k): v for k, v in json.load(f).items()}
# Encode and decode
text = "मराठी मजकूर"
token_ids = encode(merges, token_to_id, text)
reconstructed = decode(id_to_token, token_ids)
Unlike traditional byte-level BPE, this tokenizer:
Example of grapheme segmentation:
@misc{marathi-bpe-tokenizer,
author = {Your Name},
title = {Marathi BPE Tokenizer},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/pandurangpatil/sample-marathi-bpe-tokenizer}
}
MIT License - see LICENSE file for details.