Kotoba-Whisper-v2.2 is a Japanese ASR model based on kotoba-tech/kotoba-whisper-v2.0, with additional postprocessing stacks integrated as pipeline. The new features includes (i) speaker diarization with diarizers and (ii) adding punctuation with punctuators. The pipeline has been developed through the collaboration between Asahi Ushio and Kotoba Technologies
Kotoba-Whisper-v2.2 is supported in the Hugging Face 🤗 Transformers library from version 4.39 onwards. To run the model, first install the latest version of Transformers.
- result = pipe("sample_diarization_japanese.mp3")
+ result = pipe("sample_diarization_japanese.mp3", num_speakers=3)
or
- result = pipe("sample_diarization_japanese.mp3")
+ result = pipe("sample_diarization_japanese.mp3", min_speakers=2, max_speakers=5)
To add silence before/after the audio sometimes improves the transcription quality:
- result = pipe("sample_diarization_japanese.mp3")
+ result = pipe("sample_diarization_japanese.mp3", add_silence_end=0.5, add_silence_start=0.5) # adding 0.5 sec silence to before/after the audio
transformersSpeech recognition with the transformers pipeline.
import os
os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com"
from transformers import pipeline
asr = pipeline("automatic-speech-recognition", model="kotoba-tech/kotoba-whisper-v2.2", revision="9d33482a0eb9b57f1ad80708e8ac5538246d8355")
print(asr("audio.wav")["text"])