Guide To LibriSpeech Datasets With Implementation in PyTorch and TensorFlow

The Librispeech dataset is SLR12 which is the audio recording of reading English speech.

LibriSpeech is developed by OpenSLR with all data collected by his research student. Danial Povey is an assistant professor at Johns Hopkins University in the Center for Language and Speech Processing as a speech recognition researcher. LibriSpeech is a collection of more than 1000 hours of speech data which is collected by Vassil Panayotov with the assistance of Daniel Povey. It is used in many applications such as speaker recognition and automatic speaker verification.


Download Size: 58GB Approx.


Sign up for your weekly dose of what's up in emerging technology.

Dataset Size: 305GB Approx.

To Download the dataset on a local computer visit the link here:

About DataSet:

OpenSLR(Open speech and language resources) has 93 SLRs in the domain of software, audio, music, speech, and text dataset open for download. The Librispeech dataset is SLR12 which is the audio recording of reading English speech. The file format of data is in the form of FLAC(Free Lossless Audio Codec) without any loss in quality or loss of any original audio data.

Using Pytorch:

 import os
 import torch
 import pickle
 import random
 import torchaudio
 import numpy as np
 import pandas as pd
 from tqdm import tqdm
 from librosa.util import find_files
 from import DataLoader
 from import Dataset
 from torch.nn.utils.rnn import pad_sequence
 from utility.preprocessor import OnlinePreprocessor
 from transformer.mam import process_train_MAM_data,     process_test_MAM_data
 def get_online_Dataloader(args, config, is_train=True):
     # create waveform dataset
     dataset = OnlineDataset(**config['online'])
     print('[Dataset] - Using Online Dataset.')
     # create dataloader for extracting features
     def collate_fn(samples):
         # samples: [(seq_len, channel), ...]
         samples = pad_sequence(samples, batch_first=True)
         # samples: (batch_size, max_len, channel)
         return samples.transpose(-1, -2).contiguous()
         # return: (batch_size, channel, max_len)
     dataloader = DataLoader(dataset, batch_size=config['dataloader']['batch_size'],
           shuffle=is_train, num_workers=config['dataloader']['n_jobs'],
                             pin_memory=True, collate_fn=collate_fn)
     return dataloader 

For Implementation in Pytorch visit the following link.

Using Tensorflow:

 import os
 import sys
 import numpy as np
 import tensorflow as tf
 import yaml
 import argparse
 from import Dataset
 from models.ctc.vanilla_ctc import CTC
 from import mkdir_join
 parser = argparse.ArgumentParser()
 parser.add_argument('--epoch', type=int, default=-1,
                     help='the epoch to restore')
 parser.add_argument('--model_path', type=str,
                     help='path to the model to evaluate')
 parser.add_argument('--eval_batch_size', type=str, default=1,
                     help='the size of mini-batch in evaluation')

 For implementation in TensorFlow visit the link. 


1. Kaldi Speech Recognition toolkit:

LibriSpeech Dataset is used in the Kaldi Speech recognition to extract text from speech. It is useful in a speech to text generation. There are many software developed using the Kaldi toolkit for speech recognition.


2.Sentiment classification of  spoken speech:

The sentiment of the speech using LibreSpeech dataset to train the model to automatically detect their emotion in speech.

3.Speaker recognition:

To verify the gender and emotion of the speaker, their accent to catch their range of age.

4. Automatic speech recognition:

Automatic speech recognition is used in the process of speech to text and text to speech recognition. Model is trained using a natural language processing toolkit.


We have learned about the LibriSpeech dataset, how we can download it from the source. Librispeech dataset creator and their researcher. Implementation of model in PyTorch data loader for Kaldi speech recognition toolkit. Using Tensorflow for the end-to-end speech recognition and some of the application is used in daily life using Librispeech Datasets.

More Great AIM Stories

Amit Singh
Amit Singh is Data Scientist, graduated in Computer Science and Engineering. Data Science writer at Analytics India Magazine.

Our Upcoming Events

Conference, in-person (Bangalore)
Machine Learning Developers Summit (MLDS) 2023
19-20th Jan, 2023

Conference, in-person (Bangalore)
Rising 2023 | Women in Tech Conference
16-17th Mar, 2023

Conference, in-person (Bangalore)
Data Engineering Summit (DES) 2023
27-28th Apr, 2023

Conference, in-person (Bangalore)
MachineCon 2023
23rd Jun, 2023

Conference, in-person (Bangalore)
Cypher 2023
20-22nd Sep, 2023

3 Ways to Join our Community

Whatsapp group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our newsletter

Get the latest updates from AIM