Downloads · 30 days
0
indiaaiofficial/HTGM2-Hindi-Tokenizer
HTGM2-Hindi-Tokenizer is a text generation model from indiaaiofficial. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
A research-grade Hindi-first BPE tokenizer trained on ~41GB corpus using a streaming architecture designed for low-memory systems and large-scale Hindi language modeling.
Downloads · 30 days
0
Access
Public
Updated May 17, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.json8.7 MB · 100%
From the Hugging Face model README
A research-grade Hindi-first BPE tokenizer trained on ~41GB corpus using a streaming architecture designed for low-memory systems and large-scale Hindi language modeling.
This tokenizer is part of the HTGM.2 Hindi LLM project and was built with one goal:
👉 create a scalable, production-usable Hindi tokenizer optimized for Devanagari understanding instead of generic multilingual compression.
If you care about:
then this repository is worth exploring.
Most open-source tokenizers are heavily optimized for English.
This tokenizer was built differently.
Instead of prioritizing:
this tokenizer focuses on:
The result is a tokenizer where many Hindi phrases tokenize nearly word-to-token while maintaining scalable runtime performance.
| Component | Value |
|---|---|
| Tokenizer Type | HuggingFace BPE |
| Vocabulary Size | 100,000 |
| Merge Count | 95,690 |
| Training Method | Streaming train_from_iterator() |
| Normalization | NFC |
| Pre-tokenizer | Whitespace |
| Corpus Scale | ~41GB |
| Special Tokens | <pad>, <unk>, <s>, </s> |
Verified from:
The tokenizer was trained using a streaming generator instead of loading the full dataset into RAM.
This is the key reason training remained stable on limited Kaggle hardware.
def stream_data():
for file in files:
with open(file, "r", encoding="utf-8", errors="ignore") as f:
for line in f:
if line.strip():
yield line.strip()
This design allowed:
without crashing the runtime.
from tokenizers import Tokenizer, models, trainers, pre_tokenizers, normalizers
tokenizer = Tokenizer(models.BPE(unk_token="<unk>"))
tokenizer.normalizer = normalizers.NFC()
tokenizer.pre_tokenizer = pre_tokenizers.Whitespace()
trainer = trainers.BpeTrainer(
vocab_size=100000,
min_frequency=2,
special_tokens=["<pad>", "<unk>", "<s>", "</s>"]
)
tokenizer.train_from_iterator(
stream_data(),
trainer=trainer
)
tokenizer.save("tokenizer.json")
The tokenizer was trained on approximately:
The corpus structure behaves more like:
instead of short chat prompts.
This strongly influences:
One of the most important observations from the benchmark analysis:
Many common Hindi phrases tokenize almost one word → one token.
Meanwhile:
fragment more aggressively.
This is expected behavior for a Hindi-first tokenizer architecture.
भारत एक विशाल देश है
→ near 1:1 word-token behavior
Hyperparameterization
→ Hy + per + par + am + eter + ization
https://openai.com
→ fragmented into multiple subwords
This tokenizer intentionally prioritizes Hindi linguistic efficiency over universal multilingual compression.
Benchmark throughput:
| Metric | Value |
|---|---|
| Benchmark Input | 60,000 tokens |
| Measured Time | 0.2159 sec |
| Throughput | ~277,915 tokens/sec |
This indicates strong runtime efficiency for a research-grade BPE tokenizer.
Verified tokenizer configuration:
{
"type": "BPE",
"unk_token": "<unk>",
"byte_fallback": false,
"dropout": null,
"pre_tokenizer": "Whitespace",
"normalizer": "NFC"
}
Verified directly from:
<pad>
<unk>
<s>
</s>
These are reserved core control tokens used during training and inference.
Efficient large-scale training on low-memory hardware.
Strong Devanagari subword preservation.
100k vocabulary improves Hindi coverage.
Efficient tokenizer throughput.
Verified encode/decode functionality.
This tokenizer is NOT intended to be:
Known limitations include:
| File | Description |
|---|---|
README.md | Technical overview and engineering documentation |
HTGM.2_Tokenizer_A_to_Z.pdf | Full tokenizer forensic and benchmark report |
tokenizer.json | Complete trained tokenizer |
train_tokenizer.py | Original streaming tokenizer training script |
This tokenizer is suitable for:
This is a research tokenizer optimized primarily for Hindi.
It should not be presented as:
The design decisions clearly favor:
Building Hindi AI infrastructure requires more than just training models.
It requires:
This tokenizer is one small step toward building better open Hindi AI systems.
And this is only the beginning.
— Mahesh Editor