Downloads · 30 days
0
tspersian/mana_tokenizer
mana_tokenizer is a machine learning model from tspersian. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
The Mana Tokenizer is a custom-trained BPE tokenizer designed for Persian text. It is trained on a combination of huge Persian corpus. The tokenizer is built using the BPE with high character coverage to handle divers…
Downloads · 30 days
0
Access
Public
Updated Dec 7, 2024
Repo size
37.4 MB
Likes
0
Public
Click a slice to open those files.
.vocab11.1 MB · 79%
From the Hugging Face model README
The Mana Tokenizer is a custom-trained BPE tokenizer designed for Persian text. It is trained on a combination of huge Persian corpus. The tokenizer is built using the BPE with high character coverage to handle diverse Persian text.
You can encode/decode your data using Mana Tokenizer like this:
from mana_tokenizer import ManaTokenizer
tokenizer = ManaTokenizer()
text = "سلام من یک متن تست برای تست این تست هستم."
print(tokenizer.encode(text))
print(tokenizer.decode(tokenizer.encode(text)))
this is the normal encoding of this text:
[216, 179, 217, 132, 216, 167, 217, 133, 32, 217, 133, 217, 134, 32, 219, 140, 218, 169, 32, 217, 133, 216, 170, 217, 134, 32, 216, 170, 216, 179, 216, 170, 32, 216, 168, 216, 177, 216, 167, 219, 140, 32, 216, 170, 216, 179, 216, 170, 32, 216, 167, 219, 140, 217, 134, 32, 216, 170, 216, 179, 216, 170, 32, 217, 135, 216, 179, 216, 170, 217, 133, 46]
سلام من یک متن تست برای تست این تست هستم.
and here is what Mana tokenizer generate:
[30318, 377, 363, 4340, 5828, 513, 5828, 378, 5828, 14471, 46]
سلام من یک متن تست برای تست این تست هستم.
You can also add special tokens:
tokenizer.register_special_tokens({"</s>": 100269})
Batch encode:
tokenizer.batch_encode(["یک متن طولانی"])
<|user|><|assistant|><|end|><|system|>Mana tokenizer is licensed under the MIT License.