Skip to content

Commit

Permalink
Models hub (#13832)
Browse files Browse the repository at this point in the history
* Update 2023-05-25-distilcamembert_french_legal_fr.md

---------

Co-authored-by: Mary-Sci <meryemyildiz366@gmail.com>
Co-authored-by: Merve Ertas Uslu <67653613+Mary-Sci@users.noreply.github.com>

* Update title for 2023-05-25-distilcamembert_french_legal_fr.md (#13831)

---------
Co-authored-by: Merve Ertas Uslu <67653613+Mary-Sci@users.noreply.github.com>
  • Loading branch information
3 people authored May 26, 2023
1 parent 9b76d23 commit d5abbc0
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 0 deletions.
96 changes: 96 additions & 0 deletions docs/_posts/Mary-Sci/2023-05-25-camembert_french_legal_fr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
layout: model
title: French Legal CamemBert Embeddings Model
author: John Snow Labs
name: camembert_french_legal
date: 2023-05-25
tags: [open_source, camembert_embeddings, camembertformaskedlm, fr, tensorflow]
task: Embeddings
language: fr
edition: Spark NLP 4.4.2
spark_version: 3.0
supported: true
engine: tensorflow
annotator: CamemBertEmbeddings
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---

## Description

Pretrained CamemBertEmbeddings model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. `legal-camembert` is a French model originally trained by `maastrichtlawtech`.

{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/camembert_french_legal_fr_4.4.2_3.0_1685035847575.zip){:.button.button-orange.button-orange-trans.arr.button-icon}
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/public/models/camembert_french_legal_fr_4.4.2_3.0_1685035847575.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3}

## How to use



<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}

```python
documentAssembler = DocumentAssembler() \
.setInputCols(["text"]) \
.setOutputCols("document")

tokenizer = Tokenizer() \
.setInputCols("document") \
.setOutputCol("token")

embeddings = CamemBertEmbeddings.pretrained("camembert_french_legal","fr") \
.setInputCols(["document", "token"]) \
.setOutputCol("embeddings") \
.setCaseSensitive(True)

pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings])

data = spark.createDataFrame([["J'adore Spark NLP"]]).toDF("text")

result = pipeline.fit(data).transform(data)
```
```scala
val documentAssembler = new DocumentAssembler()
.setInputCols(Array("text"))
.setOutputCols(Array("document"))

val tokenizer = new Tokenizer()
.setInputCols("document")
.setOutputCol("token")

val embeddings = CamemBertEmbeddings.pretrained("camembert_french_legal","fr")
.setInputCols(Array("document", "token"))
.setOutputCol("embeddings")
.setCaseSensitive(True)

val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, embeddings))

val data = Seq("J'adore Spark NLP").toDS.toDF("text")

val result = pipeline.fit(data).transform(data)
```
</div>

{:.model-param}
## Model Information

{:.table-model}
|---|---|
|Model Name:|camembert_french_legal|
|Compatibility:|Spark NLP 4.4.2+|
|License:|Open Source|
|Edition:|Official|
|Input Labels:|[sentence, token]|
|Output Labels:|[embeddings]|
|Language:|fr|
|Size:|415.8 MB|
|Case sensitive:|true|

## References

https://huggingface.co/maastrichtlawtech/legal-camembert
96 changes: 96 additions & 0 deletions docs/_posts/Mary-Sci/2023-05-25-distilcamembert_french_legal_fr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
layout: model
title: French Legal DistilCamemBert Embeddings Model
author: John Snow Labs
name: distilcamembert_french_legal
date: 2023-05-25
tags: [open_source, camembert_embeddings, camembertformaskedlm, fr, tensorflow]
task: Embeddings
language: fr
edition: Spark NLP 4.4.2
spark_version: 3.0
supported: true
engine: tensorflow
annotator: CamemBertEmbeddings
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---

## Description

Pretrained CamemBertEmbeddings model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. `legal-distilcamembert` is a French model originally trained by `maastrichtlawtech`.

{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/distilcamembert_french_legal_fr_4.4.2_3.0_1685031800112.zip){:.button.button-orange.button-orange-trans.arr.button-icon}
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/public/models/distilcamembert_french_legal_fr_4.4.2_3.0_1685031800112.zip){:.button.button-orange.button-orange-trans.button-icon.button-copy-s3}

## How to use



<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}

```python
documentAssembler = DocumentAssembler() \
.setInputCols(["text"]) \
.setOutputCols("document")

tokenizer = Tokenizer() \
.setInputCols("document") \
.setOutputCol("token")

embeddings = CamemBertEmbeddings.pretrained("distilcamembert_french_legal","fr") \
.setInputCols(["document", "token"]) \
.setOutputCol("embeddings") \
.setCaseSensitive(True)

pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings])

data = spark.createDataFrame([["J'adore Spark NLP"]]).toDF("text")

result = pipeline.fit(data).transform(data)
```
```scala
val documentAssembler = new DocumentAssembler()
.setInputCols(Array("text"))
.setOutputCols(Array("document"))

val tokenizer = new Tokenizer()
.setInputCols("document")
.setOutputCol("token")

val embeddings = CamemBertEmbeddings.pretrained("distilcamembert_french_legal","fr")
.setInputCols(Array("document", "token"))
.setOutputCol("embeddings")
.setCaseSensitive(True)

val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, embeddings))

val data = Seq("J'adore Spark NLP").toDS.toDF("text")

val result = pipeline.fit(data).transform(data)
```
</div>

{:.model-param}
## Model Information

{:.table-model}
|---|---|
|Model Name:|distilcamembert_french_legal|
|Compatibility:|Spark NLP 4.4.2+|
|License:|Open Source|
|Edition:|Official|
|Input Labels:|[sentence, token]|
|Output Labels:|[embeddings]|
|Language:|fr|
|Size:|256.1 MB|
|Case sensitive:|true|

## References

https://huggingface.co/maastrichtlawtech/legal-distilcamembert

0 comments on commit d5abbc0

Please sign in to comment.