Update README.md
Browse files
README.md
CHANGED
@@ -7,3 +7,61 @@ tags:
|
|
7 |
widget:
|
8 |
- text: "১৮৯৭ খ্রিষ্টাব্দের ২৩ জানুয়ারি [SEP] সুভাষ ১৮৯৭ খ্রিষ্টাব্দের ২৩ জানুয়ারি ব্রিটিশ ভারতের অন্তর্গত বাংলা প্রদেশের উড়িষ্যা বিভাগের কটকে জন্মগ্রহণ করেন। </s> <2bn>"
|
9 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
widget:
|
8 |
- text: "১৮৯৭ খ্রিষ্টাব্দের ২৩ জানুয়ারি [SEP] সুভাষ ১৮৯৭ খ্রিষ্টাব্দের ২৩ জানুয়ারি ব্রিটিশ ভারতের অন্তর্গত বাংলা প্রদেশের উড়িষ্যা বিভাগের কটকে জন্মগ্রহণ করেন। </s> <2bn>"
|
9 |
---
|
10 |
+
|
11 |
+
|
12 |
+
## Intro
|
13 |
+
Trained on IndicNLGSuit [IndicQuestionGeneration](https://huggingface.co/datasets/ai4bharat/IndicQuestionGeneration) data for Bengali the model is finetuned from [IndicBART](https://huggingface.co/ai4bharat/IndicBART)
|
14 |
+
|
15 |
+
## Finetuned Command
|
16 |
+
|
17 |
+
python run_summarization.py --model_name_or_path bnQG_models/checkpoint-32000 --do_eval --train_file train_bn.json
|
18 |
+
--validation_file valid_bn.json --output_dir bnQG_models --overwrite_output_dir --per_device_train_batch_size=2
|
19 |
+
--per_device_eval_batch_size=4 --predict_with_generate --text_column src --summary_column tgt --save_steps 4000
|
20 |
+
--evaluation_strategy steps --gradient_accumulation_steps 4 --eval_steps 1000 --learning_rate 0.001 --num_beams 4
|
21 |
+
--forced_bos_token "<2bn>" --num_train_epochs 10 --warmup_steps 10000
|
22 |
+
|
23 |
+
## Sample Line from train data
|
24 |
+
|
25 |
+
{"src": "प्राणबादी [SEP] अर्थाॎ, तिनि छिलेन एकजन सर्बप्राणबादी। </s> <2bn>", "tgt": "<2bn> कोन दार्शनिक दृष्टिभङ्गि ओय़ाइटजेर छिल? </s>"}
|
26 |
+
|
27 |
+
## Inference
|
28 |
+
|
29 |
+
script = "সুভাষ ১৮৯৭ খ্রিষ্টাব্দের ২৩ জানুয়ারি ব্রিটিশ ভারতের অন্তর্গত বাংলা প্রদেশের উড়িষ্যা বিভাগের (অধুনা, ভারতের ওড়িশা রাজ্য) কটকে জন্মগ্রহণ করেন।"
|
30 |
+
answer = "১৮৯৭ খ্রিষ্টাব্দের ২৩ জানুয়ারি"
|
31 |
+
inp = answer +" [SEP] "+script + " </s> <2bn>"
|
32 |
+
inp_tok = tokenizer(inp, add_special_tokens=False, return_tensors="pt", padding=True).input_ids
|
33 |
+
model.eval() # Set dropouts to zero
|
34 |
+
|
35 |
+
model_output=model.generate(inp_tok, use_cache=True,
|
36 |
+
num_beams=4,
|
37 |
+
max_length=20,
|
38 |
+
min_length=1,
|
39 |
+
early_stopping=True,
|
40 |
+
pad_token_id=pad_id,
|
41 |
+
bos_token_id=bos_id,
|
42 |
+
eos_token_id=eos_id,
|
43 |
+
decoder_start_token_id=tokenizer._convert_token_to_id_with_added_voc("<2bn>")
|
44 |
+
)
|
45 |
+
decoded_output=tokenizer.decode(model_output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
## Citations
|
50 |
+
|
51 |
+
@inproceedings{dabre2021indicbart,
|
52 |
+
title={IndicBART: A Pre-trained Model for Natural Language Generation of Indic Languages},
|
53 |
+
author={Raj Dabre and Himani Shrotriya and Anoop Kunchukuttan and Ratish Puduppully and Mitesh M. Khapra and Pratyush Kumar},
|
54 |
+
year={2022},
|
55 |
+
booktitle={Findings of the Association for Computational Linguistics},
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
@misc{kumar2022indicnlg,
|
60 |
+
title={IndicNLG Suite: Multilingual Datasets for Diverse NLG Tasks in Indic Languages},
|
61 |
+
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},
|
62 |
+
year={2022},
|
63 |
+
eprint={2203.05437},
|
64 |
+
archivePrefix={arXiv},
|
65 |
+
primaryClass={cs.CL}
|
66 |
+
}
|
67 |
+
|