prajdabre commited on
Commit
23774b2
1 Parent(s): 6b7c5b4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -5
README.md CHANGED
@@ -1,6 +1,21 @@
1
- This is the IndicBARTSS model. For detailed documentation look here: https://indicnlp.ai4bharat.org/indic-bart/ and https://github.com/AI4Bharat/indic-bart/
2
 
3
- Usage:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  ```
6
  from transformers import MBartForConditionalGeneration, AutoModelForSeq2SeqLM
@@ -55,9 +70,56 @@ model_output=model.generate(inp, use_cache=True, num_beams=4, max_length=20, min
55
  decoded_output=tokenizer.decode(model_output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
56
 
57
  print(decoded_output) # I am happy
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  ```
59
 
60
- Notes:
61
  1. This is compatible with the latest version of transformers but was developed with version 4.3.2 so consider using 4.3.2 if possible.
62
- 2. While I have only shown how to let logits and loss and how to generate outputs, you can do pretty much everything the MBartForConditionalGeneration class can do as in https://huggingface.co/docs/transformers/model_doc/mbart#transformers.MBartForConditionalGeneration
63
- 3. Note that the tokenizer I have used is based on sentencepiece and not BPE. Therefore I use the AlbertTokenizer class and not the MBartTokenizer class.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ IndicBARTSS is a multilingual, sequence-to-sequence pre-trained model focusing on Indic languages and English. It currently supports 11 Indian languages and is based on the mBART architecture. You can use IndicBARTSS model to build natural language generation applications for Indian languages by finetuning the model with supervised training data for tasks like machine translation, summarization, question generation, etc. Some salient features of the IndicBARTSS are:
2
 
3
+ <ul>
4
+ <li >Supported languages: Assamese, Bengali, Gujarati, Hindi, Marathi, Odiya, Punjabi, Kannada, Malayalam, Tamil, Telugu and English. Not all of these languages are supported by mBART50 and mT5. </li>
5
+ <li >The model is much smaller than the mBART and mT5(-base) models, so less computationally expensive for finetuning and decoding. </li>
6
+ <li> Trained on large Indic language corpora (452 million sentences and 9 billion tokens) which also includes Indian English content. </li>
7
+ <li> Unlike ai4bharat/IndicBART each language is written in its own script so you do not need to perform any script mapping to/from Devanagari. </li>
8
+ </ul>
9
+
10
+ You can read more about IndicBARTSS in this <a href="https://arxiv.org/abs/2109.02903">paper</a>.
11
+
12
+ For detailed documentation, look here: https://github.com/AI4Bharat/indic-bart/ and https://indicnlp.ai4bharat.org/indic-bart/
13
+
14
+ # Pre-training corpus
15
+
16
+ We used the <a href="https://indicnlp.ai4bharat.org/corpora/">IndicCorp</a> data spanning 12 languages with 452 million sentences (9 billion tokens). The model was trained using the text-infilling objective used in mBART.
17
+
18
+ # Usage:
19
 
20
  ```
21
  from transformers import MBartForConditionalGeneration, AutoModelForSeq2SeqLM
 
70
  decoded_output=tokenizer.decode(model_output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
71
 
72
  print(decoded_output) # I am happy
73
+
74
+ inp = tokenizer("मैं [MASK] हूँ </s> <2hi>", add_special_tokens=False, return_tensors="pt", padding=True).input_ids
75
+
76
+ model_output=model.generate(inp, use_cache=True, num_beams=4, max_length=20, min_length=1, early_stopping=True, pad_token_id=pad_id, bos_token_id=bos_id, eos_token_id=eos_id, decoder_start_token_id=tokenizer._convert_token_to_id_with_added_voc("<2en>"))
77
+
78
+ decoded_output=tokenizer.decode(model_output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
79
+
80
+ print(decoded_output) # मैं जानता हूँ
81
+
82
+ inp = tokenizer("मला [MASK] पाहिजे </s> <2mr>", add_special_tokens=False, return_tensors="pt", padding=True).input_ids
83
+
84
+ model_output=model.generate(inp, use_cache=True, num_beams=4, max_length=20, min_length=1, early_stopping=True, pad_token_id=pad_id, bos_token_id=bos_id, eos_token_id=eos_id, decoder_start_token_id=tokenizer._convert_token_to_id_with_added_voc("<2en>"))
85
+
86
+ decoded_output=tokenizer.decode(model_output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
87
+
88
+ print(decoded_output) # मला ओळखलं पाहिजे
89
+
90
  ```
91
 
92
+ # Notes:
93
  1. This is compatible with the latest version of transformers but was developed with version 4.3.2 so consider using 4.3.2 if possible.
94
+ 2. While I have only shown how to get logits and loss and how to generate outputs, you can do pretty much everything the MBartForConditionalGeneration class can do as in https://huggingface.co/docs/transformers/model_doc/mbart#transformers.MBartForConditionalGeneration
95
+ 3. Note that the tokenizer I have used is based on sentencepiece and not BPE. Therefore, I used the AlbertTokenizer class and not the MBartTokenizer class.
96
+ # Fine-tuning on a downstream task
97
+
98
+ 1. If you wish to fine-tune this model, then you can do so using the <a href="https://github.com/prajdabre/yanmtt">YANMTT</a> toolkit, following the instructions <a href="https://github.com/AI4Bharat/indic-bart ">here</a>.
99
+ 2. (Untested) Alternatively, you may use the official huggingface scripts for <a href="https://github.com/huggingface/transformers/tree/master/examples/pytorch/translation">translation</a> and <a href="https://github.com/huggingface/transformers/tree/master/examples/pytorch/summarization">summarization</a>.
100
+
101
+ # Contributors
102
+ <ul>
103
+ <li> Raj Dabre </li>
104
+ <li> Himani Shrotriya </li>
105
+ <li> Anoop Kunchukuttan </li>
106
+ <li> Ratish Puduppully </li>
107
+ <li> Mitesh M. Khapra </li>
108
+ <li> Pratyush Kumar </li>
109
+ </ul>
110
+
111
+ # Paper
112
+ If you use IndicBARTSS, please cite the following paper:
113
+ ```
114
+ @misc{dabre2021indicbart,
115
+ title={IndicBART: A Pre-trained Model for Natural Language Generation of Indic Languages},
116
+ author={Raj Dabre and Himani Shrotriya and Anoop Kunchukuttan and Ratish Puduppully and Mitesh M. Khapra and Pratyush Kumar},
117
+ year={2021},
118
+ eprint={2109.02903},
119
+ archivePrefix={arXiv},
120
+ primaryClass={cs.CL}
121
+ }
122
+ ```
123
+
124
+ # License
125
+ The model is available under the MIT License.