abhik1505040
commited on
Commit
•
cbbbc24
1
Parent(s):
b85a1d8
Created README.md
Browse files
README.md
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- summarization
|
4 |
+
- mT5
|
5 |
+
language:
|
6 |
+
- am
|
7 |
+
- ar
|
8 |
+
- az
|
9 |
+
- bn
|
10 |
+
- my
|
11 |
+
- zh
|
12 |
+
- en
|
13 |
+
- fr
|
14 |
+
- gu
|
15 |
+
- ha
|
16 |
+
- hi
|
17 |
+
- ig
|
18 |
+
- id
|
19 |
+
- ja
|
20 |
+
- rn
|
21 |
+
- ko
|
22 |
+
- ky
|
23 |
+
- mr
|
24 |
+
- ne
|
25 |
+
- om
|
26 |
+
- ps
|
27 |
+
- fa
|
28 |
+
- pcm
|
29 |
+
- pt
|
30 |
+
- pa
|
31 |
+
- ru
|
32 |
+
- gd
|
33 |
+
- sr
|
34 |
+
- si
|
35 |
+
- so
|
36 |
+
- es
|
37 |
+
- sw
|
38 |
+
- ta
|
39 |
+
- te
|
40 |
+
- th
|
41 |
+
- ti
|
42 |
+
- tr
|
43 |
+
- uk
|
44 |
+
- ur
|
45 |
+
- uz
|
46 |
+
- vi
|
47 |
+
- cy
|
48 |
+
- yo
|
49 |
+
licenses:
|
50 |
+
- cc-by-nc-sa-4.0
|
51 |
+
widget:
|
52 |
+
- text: "Videos that say approved vaccines are dangerous and cause autism, cancer or infertility are among those that will be taken down, the company said. The policy includes the termination of accounts of anti-vaccine influencers. Tech giants have been criticised for not doing more to counter false health information on their sites. In July, US President Joe Biden said social media platforms were largely responsible for people's scepticism in getting vaccinated by spreading misinformation, and appealed for them to address the issue. YouTube, which is owned by Google, said 130,000 videos were removed from its platform since last year, when it implemented a ban on content spreading misinformation about Covid vaccines. In a blog post, the company said it had seen false claims about Covid jabs \"spill over into misinformation about vaccines in general\". The new policy covers long-approved vaccines, such as those against measles or hepatitis B. \"We're expanding our medical misinformation policies on YouTube with new guidelines on currently administered vaccines that are approved and confirmed to be safe and effective by local health authorities and the WHO,\" the post said, referring to the World Health Organization."
|
53 |
+
|
54 |
+
---
|
55 |
+
|
56 |
+
# mT5-m2m-CrossSum
|
57 |
+
|
58 |
+
This repository contains the many-to-many (m2m) mT5 checkpoint finetuned on all cross-lingual pairs of the [CrossSum](https://huggingface.co/datasets/csebuetnlp/CrossSum) dataset. This model tries to **summarize text written in any language in the provided target language.** For finetuning details and scripts, see the [paper](https://arxiv.org/abs/2112.08804) and the [official repository](https://github.com/csebuetnlp/CrossSum).
|
59 |
+
|
60 |
+
|
61 |
+
## Using this model in `transformers` (tested on 4.11.0.dev0)
|
62 |
+
|
63 |
+
```python
|
64 |
+
import re
|
65 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
66 |
+
|
67 |
+
WHITESPACE_HANDLER = lambda k: re.sub('\s+', ' ', re.sub('\n+', ' ', k.strip()))
|
68 |
+
|
69 |
+
article_text = """Videos that say approved vaccines are dangerous and cause autism, cancer or infertility are among those that will be taken down, the company said. The policy includes the termination of accounts of anti-vaccine influencers. Tech giants have been criticised for not doing more to counter false health information on their sites. In July, US President Joe Biden said social media platforms were largely responsible for people's scepticism in getting vaccinated by spreading misinformation, and appealed for them to address the issue. YouTube, which is owned by Google, said 130,000 videos were removed from its platform since last year, when it implemented a ban on content spreading misinformation about Covid vaccines. In a blog post, the company said it had seen false claims about Covid jabs "spill over into misinformation about vaccines in general". The new policy covers long-approved vaccines, such as those against measles or hepatitis B. "We're expanding our medical misinformation policies on YouTube with new guidelines on currently administered vaccines that are approved and confirmed to be safe and effective by local health authorities and the WHO," the post said, referring to the World Health Organization."""
|
70 |
+
|
71 |
+
model_name = "csebuetnlp/mT5_m2m_crossSum"
|
72 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
|
73 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
74 |
+
|
75 |
+
get_lang_id = lambda lang: tokenizer._convert_token_to_id(
|
76 |
+
model.config.task_specific_params["langid_map"][lang][1]
|
77 |
+
)
|
78 |
+
|
79 |
+
target_lang = "english" # for a list of available language names see below
|
80 |
+
|
81 |
+
input_ids = tokenizer(
|
82 |
+
[WHITESPACE_HANDLER(article_text)],
|
83 |
+
return_tensors="pt",
|
84 |
+
padding="max_length",
|
85 |
+
truncation=True,
|
86 |
+
max_length=512
|
87 |
+
)["input_ids"]
|
88 |
+
|
89 |
+
output_ids = model.generate(
|
90 |
+
input_ids=input_ids,
|
91 |
+
decoder_start_token_id=get_lang_id(target_lang),
|
92 |
+
max_length=84,
|
93 |
+
no_repeat_ngram_size=2,
|
94 |
+
num_beams=4,
|
95 |
+
)[0]
|
96 |
+
|
97 |
+
summary = tokenizer.decode(
|
98 |
+
output_ids,
|
99 |
+
skip_special_tokens=True,
|
100 |
+
clean_up_tokenization_spaces=False
|
101 |
+
)
|
102 |
+
|
103 |
+
print(summary)
|
104 |
+
```
|
105 |
+
|
106 |
+
### Available target language names
|
107 |
+
- `amharic`
|
108 |
+
- `arabic`
|
109 |
+
- `azerbaijani`
|
110 |
+
- `bengali`
|
111 |
+
- `burmese`
|
112 |
+
- `chinese_simplified`
|
113 |
+
- `chinese_traditional`
|
114 |
+
- `english`
|
115 |
+
- `french`
|
116 |
+
- `gujarati`
|
117 |
+
- `hausa`
|
118 |
+
- `hindi`
|
119 |
+
- `igbo`
|
120 |
+
- `indonesian`
|
121 |
+
- `japanese`
|
122 |
+
- `kirundi`
|
123 |
+
- `korean`
|
124 |
+
- `kyrgyz`
|
125 |
+
- `marathi`
|
126 |
+
- `nepali`
|
127 |
+
- `oromo`
|
128 |
+
- `pashto`
|
129 |
+
- `persian`
|
130 |
+
- `pidgin`
|
131 |
+
- `portuguese`
|
132 |
+
- `punjabi`
|
133 |
+
- `russian`
|
134 |
+
- `scottish_gaelic`
|
135 |
+
- `serbian_cyrillic`
|
136 |
+
- `serbian_latin`
|
137 |
+
- `sinhala`
|
138 |
+
- `somali`
|
139 |
+
- `spanish`
|
140 |
+
- `swahili`
|
141 |
+
- `tamil`
|
142 |
+
- `telugu`
|
143 |
+
- `thai`
|
144 |
+
- `tigrinya`
|
145 |
+
- `turkish`
|
146 |
+
- `ukrainian`
|
147 |
+
- `urdu`
|
148 |
+
- `uzbek`
|
149 |
+
- `vietnamese`
|
150 |
+
- `welsh`
|
151 |
+
- `yoruba`
|
152 |
+
|
153 |
+
|
154 |
+
|
155 |
+
## Citation
|
156 |
+
|
157 |
+
If you use this model, please cite the following paper:
|
158 |
+
```
|
159 |
+
@article{hasan2021crosssum,
|
160 |
+
author = {Tahmid Hasan and Abhik Bhattacharjee and Wasi Uddin Ahmad and Yuan-Fang Li and Yong-bin Kang and Rifat Shahriyar},
|
161 |
+
title = {CrossSum: Beyond English-Centric Cross-Lingual Abstractive Text Summarization for 1500+ Language Pairs},
|
162 |
+
journal = {CoRR},
|
163 |
+
volume = {abs/2112.08804},
|
164 |
+
year = {2021},
|
165 |
+
url = {https://arxiv.org/abs/2112.08804},
|
166 |
+
eprinttype = {arXiv},
|
167 |
+
eprint = {2112.08804}
|
168 |
+
}
|
169 |
+
```
|