Skip to content

Commit b262eed

Browse files
maziyarpanahijsl-modelsNaveen-004ahmedlone127prabod
authored
Models hub (#13793)
* Add model 2023-04-13-CyberbullyingDetection_ClassifierDL_tfhub_en (#13757) Co-authored-by: Naveen-004 <[email protected]> * 2023-04-20-distilbert_base_uncased_mnli_en (#13761) * Add model 2023-04-20-distilbert_base_uncased_mnli_en * Add model 2023-04-20-distilbert_base_turkish_cased_allnli_tr * Add model 2023-04-20-distilbert_base_turkish_cased_snli_tr * Add model 2023-04-20-distilbert_base_turkish_cased_multinli_tr * Update and rename 2023-04-20-distilbert_base_turkish_cased_allnli_tr.md to 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_allnli_tr.md * Update and rename 2023-04-20-distilbert_base_turkish_cased_multinli_tr.md to 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_multinli_tr.md * Update and rename 2023-04-20-distilbert_base_turkish_cased_snli_tr.md to 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_snli_tr.md * Update and rename 2023-04-20-distilbert_base_uncased_mnli_en.md to distilbert_base_zero_shot_classifier_turkish_cased_snli * Rename distilbert_base_zero_shot_classifier_turkish_cased_snli to distilbert_base_zero_shot_classifier_turkish_cased_snli_en.md * Update 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_snli_tr.md * Update 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_multinli_tr.md * Update 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_allnli_tr.md --------- Co-authored-by: ahmedlone127 <[email protected]> * 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_multinli_tr (#13763) * Add model 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_multinli_tr * Add model 2023-04-20-distilbert_base_zero_shot_classifier_uncased_mnli_en * Add model 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_snli_tr * Add model 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_allnli_tr * Update 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_multinli_tr.md * Update 2023-04-20-distilbert_base_zero_shot_classifier_turkish_cased_snli_tr.md --------- Co-authored-by: ahmedlone127 <[email protected]> * 2023-05-04-roberta_base_zero_shot_classifier_nli_en (#13781) * Add model 2023-05-04-roberta_base_zero_shot_classifier_nli_en * Fix Spark version to 3.0 --------- Co-authored-by: ahmedlone127 <[email protected]> Co-authored-by: Maziyar Panahi <[email protected]> * 2023-05-09-distilbart_xsum_6_6_en (#13788) * Add model 2023-05-09-distilbart_xsum_6_6_en * Add model 2023-05-09-distilbart_xsum_12_6_en * Add model 2023-05-09-distilbart_cnn_12_6_en * Add model 2023-05-09-distilbart_cnn_6_6_en * Add model 2023-05-09-bart_large_cnn_en * Update 2023-05-09-bart_large_cnn_en.md * Update 2023-05-09-distilbart_cnn_12_6_en.md * Update 2023-05-09-distilbart_cnn_6_6_en.md * Update 2023-05-09-distilbart_xsum_12_6_en.md * Update 2023-05-09-distilbart_xsum_6_6_en.md --------- Co-authored-by: prabod <[email protected]> Co-authored-by: Maziyar Panahi <[email protected]> --------- Co-authored-by: jsl-models <[email protected]> Co-authored-by: Naveen-004 <[email protected]> Co-authored-by: ahmedlone127 <[email protected]> Co-authored-by: prabod <[email protected]>
1 parent 4569b1d commit b262eed

6 files changed

+533
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
layout: model
3+
title: RoBertaZero-Shot Classification Base roberta_base_zero_shot_classifier_nli
4+
author: John Snow Labs
5+
name: roberta_base_zero_shot_classifier_nli
6+
date: 2023-05-04
7+
tags: [en, open_source, tensorflow]
8+
task: Zero-Shot Classification
9+
language: en
10+
edition: Spark NLP 4.4.2
11+
spark_version: [3.0]
12+
supported: true
13+
engine: tensorflow
14+
annotator: RoBertaForZeroShotClassification
15+
article_header:
16+
type: cover
17+
use_language_switcher: "Python-Scala-Java"
18+
---
19+
20+
## Description
21+
22+
This model is intended to be used for zero-shot text classification, especially in English. It is fine-tuned on NLI by using Roberta Base model.
23+
24+
RoBertaForZeroShotClassificationusing a ModelForSequenceClassification trained on NLI (natural language inference) tasks. Equivalent of RoBertaForZeroShotClassification models, but these models don’t require a hardcoded number of potential classes, they can be chosen at runtime. It usually means it’s slower but it is much more flexible.
25+
26+
We used TFRobertaForSequenceClassification to train this model and used RoBertaForZeroShotClassification annotator in Spark NLP 🚀 for prediction at scale!
27+
28+
## Predicted Entities
29+
30+
31+
32+
{:.btn-box}
33+
<button class="button button-orange" disabled>Live Demo</button>
34+
<button class="button button-orange" disabled>Open in Colab</button>
35+
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/roberta_base_zero_shot_classifier_nli_en_4.4.2_3.0_1683228241365.zip){:.button.button-orange}
36+
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/public/models/roberta_base_zero_shot_classifier_nli_en_4.4.2_3.0_1683228241365.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3}
37+
38+
## How to use
39+
40+
41+
42+
<div class="tabs-box" markdown="1">
43+
{% include programmingLanguageSelectScalaPythonNLU.html %}
44+
```python
45+
document_assembler = DocumentAssembler() \
46+
.setInputCol('text') \
47+
.setOutputCol('document')
48+
49+
tokenizer = Tokenizer() \
50+
.setInputCols(['document']) \
51+
.setOutputCol('token')
52+
53+
zeroShotClassifier = RobertaForSequenceClassification \
54+
.pretrained('roberta_base_zero_shot_classifier_nli', 'en') \
55+
.setInputCols(['token', 'document']) \
56+
.setOutputCol('class') \
57+
.setCaseSensitive(True) \
58+
.setMaxSentenceLength(512) \
59+
.setCandidateLabels(["urgent", "mobile", "travel", "movie", "music", "sport", "weather", "technology"])
60+
61+
pipeline = Pipeline(stages=[
62+
document_assembler,
63+
tokenizer,
64+
zeroShotClassifier
65+
])
66+
67+
example = spark.createDataFrame([['I have a problem with my iphone that needs to be resolved asap!!']]).toDF("text")
68+
result = pipeline.fit(example).transform(example)
69+
```
70+
```scala
71+
val document_assembler = DocumentAssembler()
72+
.setInputCol("text")
73+
.setOutputCol("document")
74+
75+
val tokenizer = Tokenizer()
76+
.setInputCols("document")
77+
.setOutputCol("token")
78+
79+
val zeroShotClassifier = RobertaForSequenceClassification.pretrained("roberta_base_zero_shot_classifier_nli", "en")
80+
.setInputCols("document", "token")
81+
.setOutputCol("class")
82+
.setCaseSensitive(true)
83+
.setMaxSentenceLength(512)
84+
.setCandidateLabels(Array("urgent", "mobile", "travel", "movie", "music", "sport", "weather", "technology"))
85+
86+
val pipeline = new Pipeline().setStages(Array(document_assembler, tokenizer, zeroShotClassifier))
87+
val example = Seq("I have a problem with my iphone that needs to be resolved asap!!").toDS.toDF("text")
88+
val result = pipeline.fit(example).transform(example)
89+
```
90+
</div>
91+
92+
{:.model-param}
93+
## Model Information
94+
95+
{:.table-model}
96+
|---|---|
97+
|Model Name:|roberta_base_zero_shot_classifier_nli|
98+
|Compatibility:|Spark NLP 4.4.2+|
99+
|License:|Open Source|
100+
|Edition:|Official|
101+
|Input Labels:|[token, document]|
102+
|Output Labels:|[multi_class]|
103+
|Language:|en|
104+
|Size:|466.4 MB|
105+
|Case sensitive:|true|
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
layout: model
3+
title: BART (large-sized model), fine-tuned on CNN Daily Mail
4+
author: John Snow Labs
5+
name: bart_large_cnn
6+
date: 2023-05-09
7+
tags: [bart, summarization, cnn, text_to_text, en, open_source, tensorflow]
8+
task: Summarization
9+
language: en
10+
edition: Spark NLP 4.4.2
11+
spark_version: 3.0
12+
supported: true
13+
engine: tensorflow
14+
annotator: BartTransformer
15+
article_header:
16+
type: cover
17+
use_language_switcher: "Python-Scala-Java"
18+
---
19+
20+
## Description
21+
22+
BART model pre-trained on English language, and fine-tuned on [CNN Daily Mail](https://huggingface.co/datasets/cnn_dailymail). It was introduced in the paper [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/abs/1910.13461) by Lewis et al. and first released in [this repository (https://github.com/pytorch/fairseq/tree/master/examples/bart).
23+
24+
Disclaimer: The team releasing BART did not write a model card for this model so this model card has been written by the Hugging Face team.
25+
26+
### Model description
27+
28+
BART is a transformer encoder-encoder (seq2seq) model with a bidirectional (BERT-like) encoder and an autoregressive (GPT-like) decoder. BART is pre-trained by (1) corrupting text with an arbitrary noising function, and (2) learning a model to reconstruct the original text.
29+
30+
BART is particularly effective when fine-tuned for text generation (e.g. summarization, translation) but also works well for comprehension tasks (e.g. text classification, question answering). This particular checkpoint has been fine-tuned on CNN Daily Mail, a large collection of text-summary pairs.
31+
32+
## Predicted Entities
33+
34+
35+
36+
{:.btn-box}
37+
<button class="button button-orange" disabled>Live Demo</button>
38+
<button class="button button-orange" disabled>Open in Colab</button>
39+
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/bart_large_cnn_en_4.4.2_3.0_1683645394389.zip){:.button.button-orange}
40+
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/public/models/bart_large_cnn_en_4.4.2_3.0_1683645394389.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3}
41+
42+
## How to use
43+
44+
You can use this model for text summarization.
45+
46+
<div class="tabs-box" markdown="1">
47+
{% include programmingLanguageSelectScalaPythonNLU.html %}
48+
```python
49+
bart = BartTransformer.pretrained("bart_large_cnn") \
50+
.setTask("summarize:") \
51+
.setMaxOutputLength(200) \
52+
.setInputCols(["documents"]) \
53+
.setOutputCol("summaries")
54+
```
55+
```scala
56+
val bart = BartTransformer.pretrained("bart_large_cnn")
57+
.setTask("summarize:")
58+
.setMaxOutputLength(200)
59+
.setInputCols("documents")
60+
.setOutputCol("summaries")
61+
```
62+
</div>
63+
64+
{:.model-param}
65+
## Model Information
66+
67+
{:.table-model}
68+
|---|---|
69+
|Model Name:|bart_large_cnn|
70+
|Compatibility:|Spark NLP 4.4.2+|
71+
|License:|Open Source|
72+
|Edition:|Official|
73+
|Language:|en|
74+
|Size:|975.3 MB|
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
layout: model
3+
title: Abstractive Summarization by BART - DistilBART CNN
4+
author: John Snow Labs
5+
name: distilbart_cnn_12_6
6+
date: 2023-05-09
7+
tags: [bart, summarization, cnn, distill, text_to_text, en, open_source, tensorflow]
8+
task: Summarization
9+
language: en
10+
edition: Spark NLP 4.4.2
11+
spark_version: 3.0
12+
supported: true
13+
engine: tensorflow
14+
annotator: BartTransformer
15+
article_header:
16+
type: cover
17+
use_language_switcher: "Python-Scala-Java"
18+
---
19+
20+
## Description
21+
22+
"BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension Transformer" The Facebook BART (Bidirectional and Auto-Regressive Transformer) model is a state-of-the-art language generation model that was introduced by Facebook AI in 2019. It is based on the transformer architecture and is designed to handle a wide range of natural language processing tasks such as text generation, summarization, and machine translation.
23+
24+
This pre-trained model is DistilBART fine-tuned on the Extreme Summarization (CNN) Dataset.
25+
26+
## Predicted Entities
27+
28+
29+
30+
{:.btn-box}
31+
<button class="button button-orange" disabled>Live Demo</button>
32+
<button class="button button-orange" disabled>Open in Colab</button>
33+
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/distilbart_cnn_12_6_en_4.4.2_3.0_1683644937231.zip){:.button.button-orange}
34+
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/public/models/distilbart_cnn_12_6_en_4.4.2_3.0_1683644937231.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3}
35+
36+
## How to use
37+
38+
39+
40+
<div class="tabs-box" markdown="1">
41+
{% include programmingLanguageSelectScalaPythonNLU.html %}
42+
```python
43+
bart = BartTransformer.pretrained("distilbart_cnn_12_6") \
44+
.setTask("summarize:") \
45+
.setMaxOutputLength(200) \
46+
.setInputCols(["documents"]) \
47+
.setOutputCol("summaries")
48+
```
49+
```scala
50+
val bart = BartTransformer.pretrained("distilbart_cnn_12_6")
51+
.setTask("summarize:")
52+
.setMaxOutputLength(200)
53+
.setInputCols("documents")
54+
.setOutputCol("summaries")
55+
```
56+
</div>
57+
58+
{:.model-param}
59+
## Model Information
60+
61+
{:.table-model}
62+
|---|---|
63+
|Model Name:|distilbart_cnn_12_6|
64+
|Compatibility:|Spark NLP 4.4.2+|
65+
|License:|Open Source|
66+
|Edition:|Official|
67+
|Language:|en|
68+
|Size:|870.4 MB|
69+
70+
## Benchmarking
71+
72+
```bash
73+
### Metrics for DistilBART models
74+
| Model Name | MM Params | Inference Time (MS) | Speedup | Rouge 2 | Rouge-L |
75+
|:---------------------------|------------:|----------------------:|----------:|----------:|----------:|
76+
| distilbart-xsum-12-1 | 222 | 90 | 2.54 | 18.31 | 33.37 |
77+
| distilbart-xsum-6-6 | 230 | 132 | 1.73 | 20.92 | 35.73 |
78+
| distilbart-xsum-12-3 | 255 | 106 | 2.16 | 21.37 | 36.39 |
79+
| distilbart-xsum-9-6 | 268 | 136 | 1.68 | 21.72 | 36.61 |
80+
| bart-large-xsum (baseline) | 406 | 229 | 1 | 21.85 | 36.50 |
81+
| distilbart-xsum-12-6 | 306 | 137 | 1.68 | 22.12 | 36.99 |
82+
| bart-large-cnn (baseline) | 406 | 381 | 1 | 21.06 | 30.63 |
83+
| distilbart-12-3-cnn | 255 | 214 | 1.78 | 20.57 | 30.00 |
84+
| distilbart-12-6-cnn | 306 | 307 | 1.24 | 21.26 | 30.59 |
85+
| distilbart-6-6-cnn | 230 | 182 | 2.09 | 20.17 | 29.70 |
86+
```
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
layout: model
3+
title: Abstractive Summarization by BART - DistilBART CNN
4+
author: John Snow Labs
5+
name: distilbart_cnn_6_6
6+
date: 2023-05-09
7+
tags: [bart, summarization, cnn, distil, text_to_text, en, open_source, tensorflow]
8+
task: Summarization
9+
language: en
10+
edition: Spark NLP 4.4.2
11+
spark_version: 3.0
12+
supported: true
13+
engine: tensorflow
14+
annotator: BartTransformer
15+
article_header:
16+
type: cover
17+
use_language_switcher: "Python-Scala-Java"
18+
---
19+
20+
## Description
21+
22+
"BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension Transformer" The Facebook BART (Bidirectional and Auto-Regressive Transformer) model is a state-of-the-art language generation model that was introduced by Facebook AI in 2019. It is based on the transformer architecture and is designed to handle a wide range of natural language processing tasks such as text generation, summarization, and machine translation.
23+
24+
This pre-trained model is DistilBART fine-tuned on the Extreme Summarization (CNN) Dataset.
25+
26+
## Predicted Entities
27+
28+
29+
30+
{:.btn-box}
31+
<button class="button button-orange" disabled>Live Demo</button>
32+
<button class="button button-orange" disabled>Open in Colab</button>
33+
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/distilbart_cnn_6_6_en_4.4.2_3.0_1683645206157.zip){:.button.button-orange}
34+
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/public/models/distilbart_cnn_6_6_en_4.4.2_3.0_1683645206157.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3}
35+
36+
## How to use
37+
38+
39+
40+
<div class="tabs-box" markdown="1">
41+
{% include programmingLanguageSelectScalaPythonNLU.html %}
42+
```python
43+
bart = BartTransformer.pretrained("distilbart_cnn_6_6") \
44+
.setTask("summarize:") \
45+
.setMaxOutputLength(200) \
46+
.setInputCols(["documents"]) \
47+
.setOutputCol("summaries")
48+
```
49+
```scala
50+
val bart = BartTransformer.pretrained("distilbart_cnn_6_6")
51+
.setTask("summarize:")
52+
.setMaxOutputLength(200)
53+
.setInputCols("documents")
54+
.setOutputCol("summaries")
55+
```
56+
</div>
57+
58+
{:.model-param}
59+
## Model Information
60+
61+
{:.table-model}
62+
|---|---|
63+
|Model Name:|distilbart_cnn_6_6|
64+
|Compatibility:|Spark NLP 4.4.2+|
65+
|License:|Open Source|
66+
|Edition:|Official|
67+
|Language:|en|
68+
|Size:|551.9 MB|
69+
70+
## Benchmarking
71+
72+
```bash
73+
### Metrics for DistilBART models
74+
| Model Name | MM Params | Inference Time (MS) | Speedup | Rouge 2 | Rouge-L |
75+
|:---------------------------|------------:|----------------------:|----------:|----------:|----------:|
76+
| distilbart-xsum-12-1 | 222 | 90 | 2.54 | 18.31 | 33.37 |
77+
| distilbart-xsum-6-6 | 230 | 132 | 1.73 | 20.92 | 35.73 |
78+
| distilbart-xsum-12-3 | 255 | 106 | 2.16 | 21.37 | 36.39 |
79+
| distilbart-xsum-9-6 | 268 | 136 | 1.68 | 21.72 | 36.61 |
80+
| bart-large-xsum (baseline) | 406 | 229 | 1 | 21.85 | 36.50 |
81+
| distilbart-xsum-12-6 | 306 | 137 | 1.68 | 22.12 | 36.99 |
82+
| bart-large-cnn (baseline) | 406 | 381 | 1 | 21.06 | 30.63 |
83+
| distilbart-12-3-cnn | 255 | 214 | 1.78 | 20.57 | 30.00 |
84+
| distilbart-12-6-cnn | 306 | 307 | 1.24 | 21.26 | 30.59 |
85+
| distilbart-6-6-cnn | 230 | 182 | 2.09 | 20.17 | 29.70 |
86+
```

0 commit comments

Comments
 (0)