Automatic Speech Recognition
Transformers
Safetensors
English
Japanese
whisper
audio
hf-asr-leaderboard
Inference Endpoints
Edit model card

Kotoba-Whisper-Bilingual (v1.0)

faster-whisper weight, whisper.cpp weight

Kotoba-Whisper-Bilingual is a collection of distilled Whisper models trained for

  • Japanese ASR
  • English ASR
  • Speech-to-text translation (Japanese -> English)
  • Speech-to-text translation (English -> Japanese)

developed through the collaboration bewteen Asahi Ushio and Kotoba Technologies. Following the original work of distil-whisper (Robust Knowledge Distillation via Large-Scale Pseudo Labelling), we employ OpenAI's Whisper large-v3 as the teacher model for Japanese and English ASR, while we translate the transcription into English and Japanese by external LLM to obtain training dataset for speech-to-text translation. We employ ReazonSpeech for Japanese ASR and Japanese speech to English text translation, and Multilingual LibriSpeech for English ASR and English speech to Japanese text translation. Kotoba-whisper-bilingual's loss objective consists of cross-entropy on both of ASR and translation tasks, while KL divergence loss only for ASR task. The student model consists the full encoder of the teacher large-v3 model and the decoder with two layers initialized from the first and last layer of the large-v3 model.

As kotoba-whisper uses the same architecture as distil-whisper/distil-large-v3, it inherits the benefit of the improved latency compared to openai/whisper-large-v3 (6.3x faster than large-v3, see the table below taken from distil-whisper/distil-large-v3).

Evaluation

We compare our kotoba-whisper-bilingual with OpenAI whisper models, kotoba-whisper models, and cascaded models for translation. Worth noting that kotoba-whisper-bilingual is the only model that can do Japanese and English ASR and speech-to-text translation between Japanese and English, as OpenAI whisper is not trained for English to Japanese speech-to-text translation, and other models are specific to the Task (eg. kotoba-whisper is Japanese ASR and distil whisper is English ASR only).

Speech2Text Translation (Japanese->English): WER (smaller is better)

Speech2Text Translation (English->Japanese): CER (smaller is better)

ASR (Japanese): CER (smaller is better)

ASR (English): WER (smaller is better)

model ESB (ami) ESB (earnings22) ESB (librispeech) ESB (tedlium) ESB (voxpopuli)
kotoba-tech/kotoba-whisper-bilingual-v1.0 16.7 15.3 2.4 4.1 8.3
openai/whisper-large-v3 17.9 14.9 2.1 3.8 12.7
openai/whisper-large-v2 18.9 16.7 2.3 4.9 7.7
openai/whisper-large 18.8 14.9 2.6 4.2 7.7
openai/whisper-medium 18.3 14.9 2.5 4.3 7.9
openai/whisper-small 23.1 17.2 3.5 5.3 10.8
openai/whisper-base 26.6 21 6 6.1 11.3
openai/whisper-tiny 31.9 30.5 8.2 11.7 15.1
japanese-asr/distil-whisper-bilingual-v1.0 20.7 18.6 2.4 6.4 10

Inference Speed

Although the cascaded approach is better in translation task, due to the nature of cascaded approach, the pipeline has additional complexity and memory consumption compared to the single end2end models for the sake of high accuracy. Following table shows the mean inference time on a single RTX 4090 (VRAM 24 GB) in second averaged over 10 trials on audio sample with different durations, along with the parameter size.

model Param. (M) 10 (sec.) 30 (sec.) 60 (sec.) 300 (sec.)
kotoba-tech/kotoba-whisper-bilingual-v1.0 756 0.041 0.111 0.214 1.077
japanese-asr/en-cascaded-s2t-translation (facebook/nllb-200-3.3B) 4056 0.173 0.247 0.352 1.772
japanese-asr/en-cascaded-s2t-translation (facebook/nllb-200-1.3B) 2056 0.173 0.24 0.348 1.515
japanese-asr/en-cascaded-s2t-translation (facebook/nllb-200-distilled-1.3B) 2056 0.17 0.245 0.348 1.882
japanese-asr/en-cascaded-s2t-translation (facebook/nllb-200-distilled-600M) 1256 0.108 0.179 0.283 1.33

Transformers Usage

Kotoba-Whisper is supported in the Hugging Face 🤗 Transformers library from version 4.39 onwards. To run the model, first install the latest version of Transformers.

pip install --upgrade pip
pip install --upgrade transformers accelerate

The model can be used with the pipeline class to transcribe short-form audio files (< 30-seconds) as follows:

Download sample audio.

wget https://huggingface.co/datasets/japanese-asr/en_asr.esb_eval/resolve/main/sample.wav -O sample_en.wav
wget https://huggingface.co/datasets/japanese-asr/ja_asr.jsut_basic5000/resolve/main/sample.flac -O sample_ja.flac
import torch
from transformers import pipeline
from datasets import load_dataset

# config
torch_dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
device = "cuda:0" if torch.cuda.is_available() else "cpu"
model_kwargs = {"attn_implementation": "sdpa"} if torch.cuda.is_available() else {}
pipe = pipeline(
    "automatic-speech-recognition",
    model="kotoba-tech/kotoba-whisper-bilingual-v1.0",
    torch_dtype=torch_dtype,
    device=device,
    model_kwargs=model_kwargs,
    chunk_length_s=15,
    batch_size=16
)

# Japanese ASR
generate_kwargs = {"language": "ja", "task": "transcribe"}
result = pipe("sample_ja.flac", generate_kwargs=generate_kwargs)
print(result["text"])

# English ASR
generate_kwargs = {"language": "en", "task": "transcribe"}
result = pipe("sample_en.wav", generate_kwargs=generate_kwargs)
print(result["text"])

# Translate Japanese speech to English text
generate_kwargs = {"language": "en", "task": "translate"}
result = pipe("sample_ja.flac", generate_kwargs=generate_kwargs)
print(result["text"])

# Translate English speech to Japanese text
generate_kwargs = {"language": "ja", "task": "translate"}
result = pipe("sample_en.wav", generate_kwargs=generate_kwargs)
print(result["text"])
  • For segment-level timestamps, pass the argument return_timestamps=True and return the "chunks" output:
result = pipe(sample, return_timestamps=True, generate_kwargs=generate_kwargs)
print(result["chunks"])

Training

Please refer to https://github.com/kotoba-tech/kotoba-whisper for the model training detail. Datasets used in distillation and the whole model variations can be found at https://huggingface.co/japanese-asr.

Acknowledgements

Downloads last month
353
Safetensors
Model size
756M params
Tensor type
BF16
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Datasets used to train kotoba-tech/kotoba-whisper-bilingual-v1.0

Space using kotoba-tech/kotoba-whisper-bilingual-v1.0 1

Collection including kotoba-tech/kotoba-whisper-bilingual-v1.0