-
Notifications
You must be signed in to change notification settings - Fork 720
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2023-08-22-asr_whisper_tiny_opt_xx (#13931)
* Add model 2023-08-22-asr_whisper_tiny_opt_xx * Add model 2023-08-22-asr_whisper_tiny_xx * Update 2023-08-22-asr_whisper_tiny_opt_xx.md * Update 2023-08-22-asr_whisper_tiny_xx.md --------- Co-authored-by: DevinTDHa <duc.hatrung95@gmail.com> Co-authored-by: Maziyar Panahi <maziyar.panahi@iscpif.fr>
- Loading branch information
1 parent
a11908a
commit 06f07da
Showing
2 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
109 changes: 109 additions & 0 deletions
109
docs/_posts/DevinTDHa/2023-08-22-asr_whisper_tiny_opt_xx.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
layout: model | ||
title: Official whisper-tiny Optimized | ||
author: John Snow Labs | ||
name: asr_whisper_tiny_opt | ||
date: 2023-08-22 | ||
tags: [whisper, en, audio, open_source, asr, onnx, xx] | ||
task: Automatic Speech Recognition | ||
language: xx | ||
edition: Spark NLP 5.1.0 | ||
spark_version: 3.0 | ||
supported: true | ||
engine: onnx | ||
annotator: WhisperForCTC | ||
article_header: | ||
type: cover | ||
use_language_switcher: "Python-Scala-Java" | ||
--- | ||
|
||
## Description | ||
|
||
Official pretrained Whisper model, adapted from HuggingFace transformer and curated to provide scalability and production-readiness using Spark NLP. | ||
|
||
This is a multilingual model and supports the following languages: | ||
|
||
Afrikaans, Arabic, Armenian, Azerbaijani, Belarusian, Bosnian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, Galician, German, Greek, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Italian, Japanese, Kannada, Kazakh, Korean, Latvian, Lithuanian, Macedonian, Malay, Marathi, Maori, Nepali, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Tagalog, Tamil, Thai, Turkish, Ukrainian, Urdu, Vietnamese, and Welsh. | ||
|
||
## Predicted Entities | ||
|
||
|
||
|
||
{:.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/asr_whisper_tiny_opt_xx_5.1.0_3.0_1692721787993.zip){:.button.button-orange.button-orange-trans.arr.button-icon} | ||
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/public/models/asr_whisper_tiny_opt_xx_5.1.0_3.0_1692721787993.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 | ||
import sparknlp | ||
from sparknlp.base import * | ||
from sparknlp.annotator import * | ||
from pyspark.ml import Pipeline | ||
|
||
audioAssembler = AudioAssembler() \ | ||
.setInputCol("audio_content") \ | ||
.setOutputCol("audio_assembler") | ||
|
||
speechToText = WhisperForCTC.pretrained("asr_whisper_tiny_opt", "xx") \ | ||
.setInputCols(["audio_assembler"]) \ | ||
.setOutputCol("text") | ||
|
||
pipeline = Pipeline().setStages([audioAssembler, speechToText]) | ||
processedAudioFloats = spark.createDataFrame([[rawFloats]]).toDF("audio_content") | ||
result = pipeline.fit(processedAudioFloats).transform(processedAudioFloats) | ||
result.select("text.result").show(truncate = False) | ||
``` | ||
```scala | ||
import spark.implicits._ | ||
import com.johnsnowlabs.nlp.base._ | ||
import com.johnsnowlabs.nlp.annotators._ | ||
import com.johnsnowlabs.nlp.annotators.audio.WhisperForCTC | ||
import org.apache.spark.ml.Pipeline | ||
|
||
val audioAssembler: AudioAssembler = new AudioAssembler() | ||
.setInputCol("audio_content") | ||
.setOutputCol("audio_assembler") | ||
|
||
val speechToText: WhisperForCTC = WhisperForCTC | ||
.pretrained("asr_whisper_tiny_opt", "xx") | ||
.setInputCols("audio_assembler") | ||
.setOutputCol("text") | ||
|
||
val pipeline: Pipeline = new Pipeline().setStages(Array(audioAssembler, speechToText)) | ||
|
||
val bufferedSource = | ||
scala.io.Source.fromFile("src/test/resources/audio/txt/librispeech_asr_0.txt") | ||
|
||
val rawFloats = bufferedSource | ||
.getLines() | ||
.map(_.split(",").head.trim.toFloat) | ||
.toArray | ||
bufferedSource.close | ||
|
||
val processedAudioFloats = Seq(rawFloats).toDF("audio_content") | ||
|
||
val result = pipeline.fit(processedAudioFloats).transform(processedAudioFloats) | ||
result.select("text.result").show(truncate = false) | ||
``` | ||
</div> | ||
|
||
{:.model-param} | ||
## Model Information | ||
|
||
{:.table-model} | ||
|---|---| | ||
|Model Name:|asr_whisper_tiny_opt| | ||
|Compatibility:|Spark NLP 5.1.0+| | ||
|License:|Open Source| | ||
|Edition:|Official| | ||
|Input Labels:|[audio_assembler]| | ||
|Output Labels:|[text]| | ||
|Language:|xx| | ||
|Size:|242.7 MB| |
109 changes: 109 additions & 0 deletions
109
docs/_posts/DevinTDHa/2023-08-22-asr_whisper_tiny_xx.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
layout: model | ||
title: Official whisper-tiny | ||
author: John Snow Labs | ||
name: asr_whisper_tiny | ||
date: 2023-08-22 | ||
tags: [whisper, en, audio, open_source, asr, xx, tensorflow] | ||
task: Automatic Speech Recognition | ||
language: xx | ||
edition: Spark NLP 5.1.0 | ||
spark_version: 3.0 | ||
supported: true | ||
engine: tensorflow | ||
annotator: WhisperForCTC | ||
article_header: | ||
type: cover | ||
use_language_switcher: "Python-Scala-Java" | ||
--- | ||
|
||
## Description | ||
|
||
Official pretrained Whisper model, adapted from HuggingFace transformer and curated to provide scalability and production-readiness using Spark NLP. | ||
|
||
This is a multilingual model and supports the following languages: | ||
|
||
Afrikaans, Arabic, Armenian, Azerbaijani, Belarusian, Bosnian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, Galician, German, Greek, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Italian, Japanese, Kannada, Kazakh, Korean, Latvian, Lithuanian, Macedonian, Malay, Marathi, Maori, Nepali, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Tagalog, Tamil, Thai, Turkish, Ukrainian, Urdu, Vietnamese, and Welsh. | ||
|
||
## Predicted Entities | ||
|
||
|
||
|
||
{:.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/asr_whisper_tiny_xx_5.1.0_3.0_1692723111563.zip){:.button.button-orange.button-orange-trans.arr.button-icon} | ||
[Copy S3 URI](s3://auxdata.johnsnowlabs.com/public/models/asr_whisper_tiny_xx_5.1.0_3.0_1692723111563.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 | ||
import sparknlp | ||
from sparknlp.base import * | ||
from sparknlp.annotator import * | ||
from pyspark.ml import Pipeline | ||
|
||
audioAssembler = AudioAssembler() \ | ||
.setInputCol("audio_content") \ | ||
.setOutputCol("audio_assembler") | ||
|
||
speechToText = WhisperForCTC.pretrained("asr_whisper_tiny", "xx") \ | ||
.setInputCols(["audio_assembler"]) \ | ||
.setOutputCol("text") | ||
|
||
pipeline = Pipeline().setStages([audioAssembler, speechToText]) | ||
processedAudioFloats = spark.createDataFrame([[rawFloats]]).toDF("audio_content") | ||
result = pipeline.fit(processedAudioFloats).transform(processedAudioFloats) | ||
result.select("text.result").show(truncate = False) | ||
``` | ||
```scala | ||
import spark.implicits._ | ||
import com.johnsnowlabs.nlp.base._ | ||
import com.johnsnowlabs.nlp.annotators._ | ||
import com.johnsnowlabs.nlp.annotators.audio.WhisperForCTC | ||
import org.apache.spark.ml.Pipeline | ||
|
||
val audioAssembler: AudioAssembler = new AudioAssembler() | ||
.setInputCol("audio_content") | ||
.setOutputCol("audio_assembler") | ||
|
||
val speechToText: WhisperForCTC = WhisperForCTC | ||
.pretrained("asr_whisper_tiny", "xx") | ||
.setInputCols("audio_assembler") | ||
.setOutputCol("text") | ||
|
||
val pipeline: Pipeline = new Pipeline().setStages(Array(audioAssembler, speechToText)) | ||
|
||
val bufferedSource = | ||
scala.io.Source.fromFile("src/test/resources/audio/txt/librispeech_asr_0.txt") | ||
|
||
val rawFloats = bufferedSource | ||
.getLines() | ||
.map(_.split(",").head.trim.toFloat) | ||
.toArray | ||
bufferedSource.close | ||
|
||
val processedAudioFloats = Seq(rawFloats).toDF("audio_content") | ||
|
||
val result = pipeline.fit(processedAudioFloats).transform(processedAudioFloats) | ||
result.select("text.result").show(truncate = false) | ||
``` | ||
</div> | ||
|
||
{:.model-param} | ||
## Model Information | ||
|
||
{:.table-model} | ||
|---|---| | ||
|Model Name:|asr_whisper_tiny| | ||
|Compatibility:|Spark NLP 5.1.0+| | ||
|License:|Open Source| | ||
|Edition:|Official| | ||
|Input Labels:|[audio_assembler]| | ||
|Output Labels:|[text]| | ||
|Language:|xx| | ||
|Size:|156.6 MB| |