The tokenizer model
Ansh-128k - is trained on a dataset of
22 Official Indic languages and English. We propose the name
Ansh as this
tokenizer is designed to meticulously identify every essential token (
Ansh in
Sanskrit) of our diverse Indic languages. This model is the advanced
version of the
Ansh-160k which was trained on 18 Indic languages and English.
India is a vast country that has a multi-lingual culture that covers 22 Official languages and more than 1700 languages and dialects. It has been observed
that various languages share words among themselves, sometimes even across language families. To capitalize on this observation, we trained our tokenization model
with a vocabulary size of 128,000 (128k) using the dataset of Wikipedia articles and Sangraha dataset in 22 Indic languages and English by applying the Byte-Pair Encoding (BPE) algorithm.
When compared among all the popular open-source tokenizers trained on multilingual Indic languages on fertility scores, our model outperformed them in 9 Indic languages.
Use the code below to get started with the model.
1from transformers import AutoTokenizer
2try:
3 tokenizer = tokenizer = AutoTokenizer.from_pretrained("LingoIITGN/Ansh-128k"))
4 print("Tokenizer loaded successfully!")
5except Exception as e:
6 print(f"Error loading tokenizer: {e}")
7 print("Please ensure you have the correct model name and are connected to the internet.")
8 exit()
9
10input_text = "Hello, world! This is an example of how to use the tokenizer."
11#input_text = 'मुझे यह presentation कल morning तक submit करना है। '
12#input_text = 'What is capital city of India?'
13
14encoded_input = tokenizer.encode(example_text)
15print("\nOriginal Text:", example_text)
16print("Encoded (Token IDs):", encoded_input)
17
18decoded_output = tokenizer.decode(encoded_input)
19print("Decoded Text:", decoded_output)
20