BanglaConformer / README.md
appledora's picture
update: model card
a910682
|
raw
history blame
3.32 kB
metadata
license: mit
language:
  - bn
metrics:
  - wer
  - cer
library_name: nemo
pipeline_tag: automatic-speech-recognition

Model

Conformer-CTC model trained on the OOD-Speech dataset to transcribe speech from Bangla audio. This is a large variant of the model, with ~121M parameters. To know more about the model architecture see the NeMo Documentation here.

Dataset

The training split contains 1100+ hours of audio data crowdsoruced from native Bangla speakers. We trained on this split for 164 epochs , then the model was evaluated on23+ hours of audio across 17 diverse domains, with a validation score of 22.4% WER .

Usage

The model can be used as a pretrained checkpoint for inference or for fine-tuning on another dataset through the NVIDIA NeMo toolkit. It is recommended to install the toolkit, after installing the pyTorch package.

apt-get update && apt-get install -y libsndfile1 ffmpeg sox
pip install Cython
pip install nemo_toolkit['all']
pip uninstall -y torchmetrics
pip install torchmetrics==0.9.2

After installing the required dependencies, download the .nemo file or the pretrained model to your local directory. you can instantiate the pretrained model like following:

import nemo.collections.asr as nemo_asr
asr_model = nemo_asr.models.EncDecCTCModelBPE.restore_from(restore_path="<MODEL PATH>")
Data Preprocessing

Prior to feeding the input audio to the pretrained model for inference, we need to resample the audio to 16KHz. We can achieve that using the sox library :

from sox import Transformer
if  not os.path.exists("<RESAMPLED AUDIO FILE PATH>"):
    tfm = Transformer()
    tfm.rate(samplerate=16000)
    tfm.channels(n_channels=1)
    tfm.build(input_filepath= "<AUDIO FILE PATH>", output_filepath= "<RESAMPLED AUDIO FILE PATH>") 
Inference using the library
asr_model.transcribe(paths2audio_files="<LIST OF RESAMPLED AUDIO FILES>")
Infer an entire batch of audio files
python [NEMO_GIT_FOLDER]/examples/asr/transcribe_speech.py \
 model_path="<PRETRAINED MODEL PATH>" \
 audio_dir="<DIRECTORY CONTAINING AUDIO FILES>" \
 output_filename="<PATH TO OUTPUT JSON>" \
 batch_size=1

Performance

The model has been separately evaluated across the different domain distributions of the test data. For more details please refer this paper: OOD-Speech: A Large Bengali Speech Recognition Dataset for Out-of-Distribution Benchmarking

If you this model in your work, please cite the following paper :

@misc{rakib2023oodspeech,
      title={OOD-Speech: A Large Bengali Speech Recognition Dataset for Out-of-Distribution Benchmarking}, 
      author={Fazle Rabbi Rakib and Souhardya Saha Dip and Samiul Alam and Nazia Tasnim and Md. Istiak Hossain Shihab and Md. Nazmuddoha Ansary and Syed Mobassir Hossen and Marsia Haque Meghla and Mamunur Mamun and Farig Sadeque and Sayma Sultana Chowdhury and Tahsin Reasat and Asif Sushmit and Ahmed Imtiaz Humayun},
      year={2023},
      eprint={2305.09688},
      archivePrefix={arXiv},
      primaryClass={eess.AS}
}