CoolFace
Modelpublic

japanese-asr/en-cascaded-s2t-translation

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
1likes33downloads
Model Card

Cascaded English Speech2Text Translation

This is a pipeline for speech-to-text translation from English speech to any target language text based on the cascaded approach, that consists of ASR and translation. The pipeline employs distil-whisper/distil-large-v3 for ASR (English speech -> English text) and facebook/nllb-200-3.3B for text translation. The input must be English speech, while the translation can be in any languages NLLB trained on. Please find the all available languages and their language codes here.

Model for Japanese speech translation is available at [ja-cascaded-s2t-translation](https://huggingface.co/japanese-asr/ja-cascaded-s2t-translation).

Benchmark

The folloiwng table shows CER computed over the reference and predicted translation for translating English speech to Japanese text task (subsets of CoVoST2 and Fleurs) with different size of NLLB along with OpenAI Whisper models.

model[CoVoST2 (En->Ja)](https://huggingface.co/datasets/japanese-asr/en2ja.s2t_translation)[Fleurs (En->JA)](https://huggingface.co/datasets/japanese-asr/en2ja.s2t_translation)
japanese-asr/en-cascaded-s2t-translation (facebook/nllb-200-3.3B)62.463.5
japanese-asr/en-cascaded-s2t-translation (facebook/nllb-200-1.3B)64.467.2
japanese-asr/en-cascaded-s2t-translation (facebook/nllb-200-distilled-1.3B)62.462.9
japanese-asr/en-cascaded-s2t-translation (facebook/nllb-200-distilled-600M)63.466.2
openai/whisper-large-v3178.9209.5
openai/whisper-large-v2179.6201.8
openai/whisper-large178.7201.8
openai/whisper-medium178.7202
openai/whisper-small178.9206.8
openai/whisper-base179.5214.2
openai/whisper-tiny185.2200.5

See https://github.com/kotoba-tech/kotoba-whisper for the evaluation detail.

Inference Speed

Due to the nature of cascaded approach, the pipeline has additional complexity compared to the single end2end OpenAI whisper models for the sake of high accuracy. Following table shows the mean inference time in second averaged over 10 trials on audio sample with different durations.

Usage

Here is an example to translate English speech into Japanese text translation. First, download a sample speech.

bash
wget https://huggingface.co/datasets/japanese-asr/en_asr.esb_eval/resolve/main/sample.wav -O sample_en.wav

Then, run the pipeline as below.

python3
from transformers import pipeline

# load model
pipe = pipeline(
    model="japanese-asr/en-cascaded-s2t-translation",
    model_translation="facebook/nllb-200-distilled-600M",
    tgt_lang="jpn_Jpan",
    model_kwargs={"attn_implementation": "sdpa"},
    chunk_length_s=15,
    trust_remote_code=True,
)

# translate
output = pipe("./sample.wav")

Other NLLB models can be used by setting model_translation such as following.