jakobcassiman
commited on
Commit
·
7089928
1
Parent(s):
0414d68
Update README.md
Browse files
README.md
CHANGED
@@ -7,6 +7,7 @@ tags:
|
|
7 |
- summarization
|
8 |
datasets:
|
9 |
- ml6team/cnn_dailymail_nl
|
|
|
10 |
---
|
11 |
|
12 |
# mbart-large-cc25-cnn-dailymail-nl
|
@@ -21,26 +22,31 @@ It's meant for summarizing Dutch news articles.
|
|
21 |
|
22 |
```python
|
23 |
import transformers
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
26 |
summarization_pipeline = transformers.pipeline(
|
27 |
-
task=
|
28 |
model=undisputed_best_model,
|
29 |
tokenizer=tokenizer,
|
30 |
)
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
```
|
45 |
|
46 |
## Training data
|
|
|
7 |
- summarization
|
8 |
datasets:
|
9 |
- ml6team/cnn_dailymail_nl
|
10 |
+
|
11 |
---
|
12 |
|
13 |
# mbart-large-cc25-cnn-dailymail-nl
|
|
|
22 |
|
23 |
```python
|
24 |
import transformers
|
25 |
+
|
26 |
+
undisputed_best_model = transformers.MBartForConditionalGeneration.from_pretrained(
|
27 |
+
"ml6team/mbart-large-cc25-cnn-dailymail-nl"
|
28 |
+
)
|
29 |
+
tokenizer = transformers.MBartTokenizer.from_pretrained("facebook/mbart-large-cc25")
|
30 |
summarization_pipeline = transformers.pipeline(
|
31 |
+
task="summarization",
|
32 |
model=undisputed_best_model,
|
33 |
tokenizer=tokenizer,
|
34 |
)
|
35 |
+
summarization_pipeline.model.config.decoder_start_token_id = tokenizer.lang_code_to_id[
|
36 |
+
"nl_XX"
|
37 |
+
]
|
38 |
+
|
39 |
+
article = "Kan je dit even samenvatten alsjeblief." # Dutch
|
40 |
+
summarization_pipeline(
|
41 |
+
article,
|
42 |
+
do_sample=True,
|
43 |
+
top_p=0.75,
|
44 |
+
top_k=50,
|
45 |
+
# num_beams=4,
|
46 |
+
min_length=50,
|
47 |
+
early_stopping=True,
|
48 |
+
truncation=True,
|
49 |
+
)[0]["summary_text"]
|
50 |
```
|
51 |
|
52 |
## Training data
|