Day 93 – Speech Recognition On Different Languages By SpeechBrain
Gopi Chandrakesan
?? Project Manager/Solution Architect ?? Blogger on SAP, ?? Artificial Intelligence, ?? Machine Learning, and ?? Deep Learning ?? Ask me about Data Intelligence
SpeechBrain is one of the topmost tools for Audio Analysis, Speech Recognition, Speaker Recognition, Speech Enhancement, etc.
We saw a post in the previous blog what is SpeechBrain, Features, PreTrained models, etc.
Let’s get into a code to check simple Speech Recognition in different languages.
I have used SpeechBrain Pretrained models and audio files and downloaded new audio files from the Free Open Speech Repository.
To check my full code in Google Colab as well as here.
#Install Torchaudio, SpeechBrain and Transformers
!pip install torchaudio==0.8.1 #Temporary (until pytorch 0.9 is supported in Colab)
!pip install speechbrain
!pip install transformers
#Import all libraries
import speechbrain as sb
from speechbrain.dataio.dataio import read_audio
from IPython.display import Audio
#Download pretrained EncoderDecoderASR model from SpeechBrain
#librispeech in English
from speechbrain.pretrained import EncoderDecoderASR
asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-crdnn-rnnlm-librispeech", savedir="pretrained_models/asr-crdnn-rnnlm-librispeech")
asr_model.transcribe_file('speechbrain/asr-crdnn-rnnlm-librispeech/example.wav')