Anjaan-Khadka
commited on
Commit
•
07a2071
1
Parent(s):
6fb6093
Upload 6 files
Browse files- README.md +69 -0
- config.json +36 -0
- generation_config.json +11 -0
- new_sp.model +3 -0
- pytorch_model.bin +3 -0
- spiece.model +3 -0
README.md
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- summarization
|
4 |
+
- mT5
|
5 |
+
datasets:
|
6 |
+
- csebuetnlp/xlsum
|
7 |
+
language:
|
8 |
+
- ne
|
9 |
+
widget:
|
10 |
+
- text: तीन नगरपालिकालाई समेटेर भेरी किनारमा बन्न थालेको आधुनिक नमुना सहरको काम तीव्र गतिमा अघि बढेको छ । भेरीगंगा, गुर्भाकोट र लेकबेंसी नगरपालिकामा बन्न थालेको भेरीगंगा उपत्यका नमुना आधुनिक सहर निर्माण हुन लागेको हो । यसले नदी वारि र पारिको ४ सय ६० वर्ग किलोमिटर क्षेत्रलाई समेट्नेछ ।
|
11 |
+
model-index:
|
12 |
+
- name: Anjaan-Khadka/summarization_nepali
|
13 |
+
results:
|
14 |
+
- task:
|
15 |
+
type: summarization
|
16 |
+
name: Summarization
|
17 |
+
dataset:
|
18 |
+
name: xsum
|
19 |
+
type: xsum
|
20 |
+
config: default
|
21 |
+
split: test
|
22 |
+
metrics:
|
23 |
+
- name: ROUGE-1
|
24 |
+
type: rouge
|
25 |
+
value: 36.5002
|
26 |
+
verified: false
|
27 |
+
|
28 |
+
---
|
29 |
+
|
30 |
+
# adaptation of mT5-multilingual-XLSum for Nepali Lnaguage
|
31 |
+
|
32 |
+
This repository contains adapted version of mT5-multilinguag-XLSum for Single Language (Nepali). View original [mT5-multilinguag-XLSum model](https://huggingface.co/csebuetnlp/mT5_multilingual_XLSum)
|
33 |
+
|
34 |
+
## Using this model in `transformers` (tested on 4.11.0.dev0)
|
35 |
+
|
36 |
+
```python
|
37 |
+
import re
|
38 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
39 |
+
|
40 |
+
article_text = " तीन नगरपालिकालाई समेटेर भेरी किनारमा बन्न थालेको आधुनिक नमुना सहरको काम तीव्र गतिमा अघि बढेको छ । भेरीगंगा, गुर्भाकोट र लेकबेंसी नगरपालिकामा बन्न थालेको भेरीगंगा उपत्यका नमुना आधुनिक सहर निर्माण हुन लागेको हो । यसले नदी वारि र पारिको ४ सय ६० वर्ग किलोमिटर क्षेत्रलाई समेट्नेछ ।"
|
41 |
+
|
42 |
+
model_name = "Anjaan-Khadka/summarization_nepali"
|
43 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
44 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
45 |
+
|
46 |
+
input_ids = tokenizer(
|
47 |
+
(article_text),
|
48 |
+
return_tensors="pt",
|
49 |
+
padding="max_length",
|
50 |
+
truncation=True,
|
51 |
+
max_length=512
|
52 |
+
)["input_ids"]
|
53 |
+
|
54 |
+
output_ids = model.generate(
|
55 |
+
input_ids=input_ids,
|
56 |
+
max_length=84,
|
57 |
+
no_repeat_ngram_size=2,
|
58 |
+
num_beams=4
|
59 |
+
)[0]
|
60 |
+
|
61 |
+
summary = tokenizer.decode(
|
62 |
+
output_ids,
|
63 |
+
skip_special_tokens=True,
|
64 |
+
clean_up_tokenization_spaces=False
|
65 |
+
)
|
66 |
+
|
67 |
+
print(summary)
|
68 |
+
|
69 |
+
```
|
config.json
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "Anjaan-Khadka/summarization_nepali",
|
3 |
+
"architectures": [
|
4 |
+
"T5ForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"d_ff": 2048,
|
7 |
+
"d_kv": 64,
|
8 |
+
"d_model": 768,
|
9 |
+
"decoder_start_token_id": 0,
|
10 |
+
"dense_act_fn": "gelu_new",
|
11 |
+
"dropout_rate": 0.1,
|
12 |
+
"eos_token_id": 1,
|
13 |
+
"feed_forward_proj": "gated-gelu",
|
14 |
+
"initializer_factor": 1.0,
|
15 |
+
"is_encoder_decoder": true,
|
16 |
+
"is_gated_act": true,
|
17 |
+
"layer_norm_epsilon": 1e-06,
|
18 |
+
"length_penalty": 0.6,
|
19 |
+
"max_length": 84,
|
20 |
+
"model_type": "mt5",
|
21 |
+
"no_repeat_ngram_size": 2,
|
22 |
+
"num_beams": 4,
|
23 |
+
"num_decoder_layers": 12,
|
24 |
+
"num_heads": 12,
|
25 |
+
"num_layers": 12,
|
26 |
+
"output_past": true,
|
27 |
+
"pad_token_id": 0,
|
28 |
+
"relative_attention_max_distance": 128,
|
29 |
+
"relative_attention_num_buckets": 32,
|
30 |
+
"tie_word_embeddings": false,
|
31 |
+
"tokenizer_class": "T5Tokenizer",
|
32 |
+
"torch_dtype": "float32",
|
33 |
+
"transformers_version": "4.26.1",
|
34 |
+
"use_cache": true,
|
35 |
+
"vocab_size": 11685
|
36 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"decoder_start_token_id": 0,
|
4 |
+
"eos_token_id": 1,
|
5 |
+
"length_penalty": 0.6,
|
6 |
+
"max_length": 84,
|
7 |
+
"no_repeat_ngram_size": 2,
|
8 |
+
"num_beams": 4,
|
9 |
+
"pad_token_id": 0,
|
10 |
+
"transformers_version": "4.26.1"
|
11 |
+
}
|
new_sp.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6e310b3657115be7fb48b4d8b5f36485b34fa1788753aabe419f1a82268a85d3
|
3 |
+
size 452176
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:62809fe2026bb1a5e80c2402dac2e15d59608e3ce98bbc1f364ed14e18e44298
|
3 |
+
size 864802997
|
spiece.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6e310b3657115be7fb48b4d8b5f36485b34fa1788753aabe419f1a82268a85d3
|
3 |
+
size 452176
|