A fine-tuned Gemma tokenizer on Persian text, optimized to handle the nuances of the Persian language with improved efficiency and accuracy. This tokenizer is available via the Hugging Face Hub as
mshojaei77/PersianGemmaTokenizerFast.
1from transformers import AutoTokenizer
2
3# Load the tokenizer
4tokenizer = AutoTokenizer.from_pretrained("mshojaei77/PersianGemmaTokenizerFast")
5
6# Example Persian text
7text = "سلام، حال شما چطور است؟"
8
9# Tokenize the text
10encoded = tokenizer(text)
11
12# Print token IDs and tokens
13print("Token IDs:", encoded["input_ids"])
14print("Tokens:", tokenizer.convert_ids_to_tokens(encoded["input_ids"]))
The following image compares the performance of the PersianGemmaTokenizerFast on a paragraph of Persian text, showcasing its efficiency relative to other tokenizers (fewer tokens imply better performance):
Contributions to improve the tokenizer or its documentation are welcome! If you encounter any issues or have suggestions, please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.