Coder Social home page Coder Social logo

prateekralhan / automatic-end-to-end-speech-recognition-using-pytorch Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 907 KB

ASR using Pytorch and huggingface transformers

License: MIT License

Python 97.64% Dockerfile 1.38% Procfile 0.16% Shell 0.82%
automatic-speech-recognition huggingface-transformers opensourceforgood python3 pytorch streamlit webapps

automatic-end-to-end-speech-recognition-using-pytorch's Introduction

Automatic-End-to-End-Speech-Recognition-using-pytorch Project Status: Active

Dependencies:

  1. Pytorch
  2. Torchaudio
  3. Numpy
  4. CUDA Toolkit 10.1
  5. Nvidia cuDNN

Note:

  • You may need to create Nvidia Developer account for downloading cuDNN for your appropriate CUDA version. Don't worry it's free !! ๐Ÿ˜„
  • Also, ensure whether your GPU is CUDA compatible or not. You can check this here.

Hardware Config:

  1. GPU - Nvidia Geforce GTX 1050Ti - Get latest Drivers for your GPU from here
  2. CPU - i7 7700 , processor speed - 3.8 GHz
  3. RAM - 12 GB DDR4

Dataset:

For handling the audio data, I am using torchaudio here which is a library built by the PyTorch team specifically for audio data. trained on a subset of LibriSpeech, which is a corpus of read English speech data derived from audiobooks, comprising 100 hours of transcribed audio data. THe dataset will be automatically downloaded when you execute the script. Each sample of the dataset contains the waveform, sample rate of audio, the utterance/label, and more metadata on the sample.

Model:

The model built here inspired by Deep Speech 2 (Baidu's second revision of their now-famous model) with some personal improvements to the architecture. The model will have two main neural network modules - N layers of Residual Convolutional Neural Networks (ResCNN) to learn the relevant audio features, and a set of Bidirectional Recurrent Neural Networks (BiRNN) to leverage the learned ResCNN audio features. The model is topped off with a fully connected layer used to classify characters per time step.The output of the model will be a probability matrix of characters, and we'll use that probability matrix to decode the most likely characters spoken from the audio.

Streamlit Webapp

I also developed a lightweight streamlit based webapp for performing ASR which is using wav2vec2-base-960h huggingface ๐Ÿค— model provided by Facebook AI.

1 2

Installation:

  • Simply run the command pip install -r requirements.txt to install the dependencies.

Usage:

  1. Clone this repository and install the dependencies as mentioned above.
  2. Make a directory within the directory streamlit_app with the name .streamlit (Don't forget the dot !!).
  3. Create a file config.toml in this directory (Be aware of the file extension !!).
  4. Copy-Paste the following contents in this file and save :
[theme]
base="dark"
primaryColor="#0fffcf"
textColor="#0dd2c8"
  1. Navigate to the root directory of this repository and simply run the command:
streamlit run app.py
  1. Navigate to http://localhost:8501 in your web-browser.
  2. By default, streamlit allows us to upload files of max. 200MB. If you want to have more size for uploading files, execute the command :
streamlit run app.py --server.maxUploadSize=1028

Results:

  1. Perform ASR on the fly! 1 2

Running the Dockerized App

  1. Ensure you have Docker Installed and Setup in your OS (Windows/Mac/Linux). For detailed Instructions, please refer this.
  2. Navigate to the folder where you have cloned this repository ( where the Dockerfile is present ).
  3. Build the Docker Image (don't forget the dot!! ๐Ÿ˜„ ):
docker build -f Dockerfile -t app:latest .
  1. Run the docker:
docker run -p 8501:8501 app:latest

This will launch the dockerized app. Navigate to http://localhost:8501/ in your browser to have a look at your application. You can check the status of your all available running dockers by:

docker ps

automatic-end-to-end-speech-recognition-using-pytorch's People

Contributors

prateekralhan avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rachidio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.