sahuPrachi commited on
Commit
c44c55f
·
1 Parent(s): 2f90406

readme updated

Browse files
Files changed (1) hide show
  1. README.md +79 -13
README.md CHANGED
@@ -1,23 +1,89 @@
 
1
  ---
2
- tags:
3
- - MultiIndicHeadlineGeneration
4
- - multilingual
5
- - nlp
6
- - indicnlp
7
- datasets:
8
- - ai4bharat/IndicHeadlineGeneration
9
- language:
10
  - as
11
  - bn
 
12
  - hi
13
  - kn
14
  - ml
 
15
  - or
16
  - pa
17
  - ta
18
  - te
19
- licenses:
20
- - cc-by-nc-4.0
21
- widget:
22
- - text: अनुभव सिन्हा के निर्देशन में बनी हाल ही में रिलीज हुई फिल्म 'तुम बिन 2' को लेकर इन दिनों काफी चर्चा है।खासकर फिल्म के गानों की बात करें तो इसने दर्शकों पर अपना अलग ही जादू चलाया है।फिल्म का गीत और संगीत लोगों के सिर चढ़ कर बोल रहा है।फिल्म की रिलीज से पहले ही इसके गानों ने लोगों की काफी तारीफ हासिल की।इस फिल्म के संगीतकार मशहूर गायक व संगीत निर्देशक अंकित तिवारी हैं और उनका कहना है कि उन्हें इस फिल्म के सारे गाने पसंद हैं।इसे भी पढ़ेः- नोटबंदी से 'तुम बिन 2' पर पड़ेगा असर? जानिए क्या बोले अनुभव सिन्हा अंकित इससे पहले फिल्म 'आशिकी-2' के 'सुन रहा है' और 'एक था विलेन' के 'गलियां' गीत से लोगों को अपना दीवाना बना चुके हैं।अपनी मदहोश आवाज के लिए प्रसिद्ध अंकित तिवारी ने फिल्म 'तुम बिन 2' के गानों को संगीतबद्ध किया है, और यही नहीं इस फिल्म के गाने 'तुम बिन' में उन्होंने अपनी आवाज का जादू बिखेरकर लोगों को एक बार फिर मदहोश कर दिया है।अंकित ने बातचीत में कहा कि यह फिल्म उनके लिए बहुत खास है, और इसके सभी गानें उन्हें बहुत पसंद हैं।18 नवंबर को रिलीज हुई फिल्म 'तुम बिन 2' 2001 में आई फिल्म 'तुम बिन' का सीक्वल है।फिल्म 'तुम बिन 2' में अभिनेत्री नेहा शर्मा अभिनेता आशिम गुलाटी और आदित्य सील भी मुख्य भूमिका में हैं।इस फिल्म का निर्देशन अनुभव सिन्हा ने किया है। </s> <2hi>
23
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
  ---
3
+ languages:
 
 
 
 
 
 
 
4
  - as
5
  - bn
6
+ - gu
7
  - hi
8
  - kn
9
  - ml
10
+ - mr
11
  - or
12
  - pa
13
  - ta
14
  - te
15
+ tags:
16
+ - multilingual
17
+ - nlp
18
+ - indicnlp
19
+ ---
20
+
21
+ MultiIndicHeadlineGeneration is a multilingual, sequence-to-sequence pre-trained model focusing only on Indic languages. It currently supports 11 Indian languages and is finetuned on [IndicBART](https://huggingface.co/ai4bharat/IndicBART) checkpoint. You can use MultiIndicHeadlineGeneration model to build natural language generation applications in Indian languages for tasks like summarization, headline generation and other summarization related tasks. Some salient features of the MultiIndicHeadlineGeneration are:
22
+
23
+ <ul>
24
+ <li >Supported languages: Assamese, Bengali, Gujarati, Hindi, Marathi, Odiya, Punjabi, Kannada, Malayalam, Tamil, and Telugu. Not all of these languages are supported by mBART50 and mT5. </li>
25
+ <li >The model is much smaller than the mBART and mT5(-base) models, so less computationally expensive for finetuning and decoding. </li>
26
+ <li> Trained on large Indic language corpora (1.316 million paragraphs and 5.9 million unique tokens) . </li>
27
+ <li> All languages have been represented in Devanagari script to encourage transfer learning among the related languages. </li>
28
+ </ul>
29
+
30
+
31
+ # Usage:
32
+
33
+ ```
34
+ from transformers import MBartForConditionalGeneration, AutoModelForSeq2SeqLM
35
+ from transformers import AlbertTokenizer, AutoTokenizer
36
+ tokenizer = AutoTokenizer.from_pretrained("ai4bharat/MultiIndicHeadlineGenerationSS", do_lower_case=False, use_fast=False, keep_accents=True)
37
+ # Or use tokenizer = AlbertTokenizer.from_pretrained("ai4bharat/MultiIndicHeadlineGenerationSS", do_lower_case=False, use_fast=False, keep_accents=True)
38
+ model = AutoModelForSeq2SeqLM.from_pretrained("ai4bharat/MultiIndicHeadlineGenerationSS")
39
+ # Or use model = MBartForConditionalGeneration.from_pretrained("ai4bharat/MultiIndicHeadlineGenerationSS")
40
+ # Some initial mapping
41
+ bos_id = tokenizer._convert_token_to_id_with_added_voc("<s>")
42
+ eos_id = tokenizer._convert_token_to_id_with_added_voc("</s>")
43
+ pad_id = tokenizer._convert_token_to_id_with_added_voc("<pad>")
44
+ # To get lang_id use any of ['<2as>', '<2bn>', '<2gu>', '<2hi>', '<2kn>', '<2ml>', '<2mr>', '<2or>', '<2pa>', '<2ta>', '<2te>']
45
+ # First tokenize the input and outputs. The format below is how MultiIndicHeadlineGenerationSS was trained so the input should be "Paragraph </s> <2xx>" where xx is the language code. Similarly, the output should be "<2yy> Sentence </s>".
46
+ inp = tokenizer("यूट्यूब या फेसबुक पर वीडियो देखते समय आप भी बफरिंग की वजह से परेशान होते हैं? इसका जवाब हां है तो जल्द ही आपकी सारी समस्या खत्म होने वाली है। दरअसल, टेलीकॉम मिनिस्टर अश्विनी वैष्णव ने पिछले सप्ताह कहा कि अगस्त के अंत तक हर-हाल में '5G' इंटरनेट लॉन्च हो जाएगा। उन्होंने यह भी कहा है कि स्पेक्ट्रम की बिक्री शुरू हो चुकी है और जून तक ये प्रोसेस खत्म होने की संभावना है।</s> <2hi>", add_special_tokens=False, return_tensors="pt", padding=True).input_ids # tensor([[58232, 76, 14514, 53, 5344, 10605, 1052, 680, 83, 648, . . . . , 12126, 725, 19, 13635, 17, 7, 64001, 64007]])
47
+ out = tokenizer("<2hi> 5G इंटरनेट का इंतजार हुआ खत्म:अगस्त तक देश में शुरू हो सकती है 5G सर्विस </s>", add_special_tokens=False, return_tensors="pt", padding=True).input_ids # tensor([[64007, 329, 1906, 15429, . . . . ,17, 329, 1906, 27241, 64001]])
48
+ # Note that if you use any language other than Hindi or Marathi, you should convert its script to Devanagari using the Indic NLP Library.
49
+ model_outputs=model(input_ids=inp, decoder_input_ids=out[:,0:-1], labels=out[:,1:])
50
+ # For loss
51
+ model_outputs.loss ## This is not label smoothed.
52
+ # For logits
53
+ model_outputs.logits
54
+ # For generation. Pardon the messiness. Note the decoder_start_token_id.
55
+ model.eval() # Set dropouts to zero
56
+ model_output=model.generate(inp, use_cache=True, num_beams=4, max_length=32, 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>"))
57
+ # Decode to get output strings
58
+ decoded_output=tokenizer.decode(model_output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
59
+ print(decoded_output) # अगस्त के अंत तक '5G' इंटरनेट लॉन्च हो जाएगा : अश्विनी वैष्णव
60
+
61
+ # Note that if your output language is not Hindi or Marathi, you should convert its script from Devanagari to the desired language using the Indic NLP Library.
62
+
63
+ ```
64
+
65
+ # Note:
66
+
67
+ If you wish to use any language written in a non-Devanagari script, then you should first convert it to Devanagari using the <a href="https://github.com/anoopkunchukuttan/indic_nlp_library">Indic NLP Library</a>. After you get the output, you should convert it back into the original script.
68
+
69
+ # Contributors
70
+ <ul>
71
+ <li> Aman Kumar </li>
72
+ <li> Prachi Sahu </li>
73
+ <li> Himani Shrotriya </li>
74
+ <li> Raj Dabre </li>
75
+ <li> Anoop Kunchukuttan </li>
76
+ <li> Ratish Puduppully </li>
77
+ <li> Mitesh M. Khapra </li>
78
+ <li> Pratyush Kumar </li>
79
+ </ul>
80
+ # Paper
81
+ If you use MultiIndicHeadlineGeneration, please cite the following paper:
82
+ ```
83
+ @inproceedings{Kumar2022IndicNLGSM,
84
+ title={IndicNLG Suite: Multilingual Datasets for Diverse NLG Tasks in Indic Languages},
85
+ author={Aman Kumar and Himani Shrotriya and Prachi Sahu and Raj Dabre and Ratish Puduppully and Anoop Kunchukuttan and Amogh Mishra and Mitesh M. Khapra and Pratyush Kumar},
86
+ year={2022},
87
+ url = "https://arxiv.org/abs/2203.05437"
88
+ }
89
+ ```