bhadresh-savani
commited on
Merge branch 'main' of https://huggingface.co/flax-community/byt5-base-wikisplit into main
Browse files
README.md
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- wiki_split
|
4 |
+
widget:
|
5 |
+
- text: "Mary likes to play football in her freetime whenever she meets with her friends that are very nice people."
|
6 |
+
---
|
7 |
+
# T5 model for sentence splitting in English
|
8 |
+
Sentence Split is the task of dividing a long sentence into multiple sentences.
|
9 |
+
E.g.:
|
10 |
+
```
|
11 |
+
Mary likes to play football in her freetime whenever she meets with her friends that are very nice people.
|
12 |
+
```
|
13 |
+
could be split into
|
14 |
+
```
|
15 |
+
Mary likes to play football in her freetime whenever she meets with her friends.
|
16 |
+
```
|
17 |
+
```
|
18 |
+
Her friends are very nice people.
|
19 |
+
```
|
20 |
+
## How to use it in your code:
|
21 |
+
```python
|
22 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained("flax-community/byt5-base-wikisplit")
|
24 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("flax-community/byt5-base-wikisplit")
|
25 |
+
complex_sentence = "This comedy drama is produced by Tidy , the company she co-founded in 2008 with her husband David Peet , who is managing director ."
|
26 |
+
sample_tokenized = tokenizer(complex_sentence, return_tensors="pt")
|
27 |
+
answer = model.generate(sample_tokenized['input_ids'], attention_mask = sample_tokenized['attention_mask'], max_length=256, num_beams=5)
|
28 |
+
gene_sentence = tokenizer.decode(answer[0], skip_special_tokens=True)
|
29 |
+
gene_sentence
|
30 |
+
"""
|
31 |
+
Output:
|
32 |
+
This comedy drama is produced by Tidy. She co-founded Tidy in 2008 with her husband David Peet, who is managing director.
|
33 |
+
"""
|
34 |
+
```
|
35 |
+
## Datasets:
|
36 |
+
[Wiki_Split](https://research.google/tools/datasets/wiki-split/)
|
37 |
+
## Current Basline from [paper](https://arxiv.org/abs/1907.12461)
|
38 |
+
![baseline](./baseline.png)
|
39 |
+
## Our Results:
|
40 |
+
| Model | Exact | SARI | BLEU |
|
41 |
+
| --- | --- | --- | --- |
|
42 |
+
| t5-base-wikisplit | 17.93 | 67.5438 | 76.9 |
|
43 |
+
| t5-v1_1-base-wikisplit | 16.84 | 66.38 | 76.32 |
|
44 |
+
| byt5-base-wikisplit | 11.3582 | 67.2685 | 73.1682 |
|
45 |
+
| t5-large-wikisplit | 18.4295 | 67.882 | 77.1122 |
|