Skip to content

General building instructions

Jacob Kahn edited this page Dec 28, 2020 · 7 revisions

Build Options

Option Configuration Default Value
W2L_BUILD_LIBRARIES_ONLY ON, OFF OFF
W2L_LIBRARIES_USE_CUDA ON, OFF ON
W2L_LIBRARIES_USE_KENLM ON, OFF ON
W2L_LIBRARIES_USE_MKL ON, OFF ON
W2L_BUILD_FOR_PYTHON ON, OFF OFF
W2L_BUILD_TESTS ON, OFF ON
W2L_BUILD_EXAMPLES ON, OFF ON
W2L_BUILD_EXPERIMENTAL ON, OFF OFF
W2L_BUILD_RECIPES ON, OFF ON
W2L_BUILD_SCRIPTS ON, OFF OFF
W2L_BUILD_TOOLS ON, OFF OFF
CMAKE_BUILD_TYPE Debug

Inference Pipeline Options

Option Configuration Default Value
W2L_BUILD_INFERENCE ON, OFF OFF
W2L_INFERENCE_BUILD_TESTS ON, OFF ON
W2L_INFERENCE_BUILD_EXAMPLES ON, OFF ON
W2L_INFERENCE_BACKEND [fbgemm,] fbgemm

General Build Instructions

Once you have the needed dependencies installed, clone the repository:

git clone --recursive https://github.com/facebookresearch/wav2letter.git

and follow the build instructions for your specific OS.

There is no install procedure currently supported for wav2letter++. Building produces three binaries in the build directory:

  • Train: given a dataset of input audio and corresponding transcriptions in sub-word units (graphemes, phonemes, etc), trains the acoustic model.
  • Test: performs inference on a given dataset with an acoustic model.
  • Decode: given an acoustic model/pre-computed network emissions and a language model, computes the most likely sequence of words for a given dataset.

Building on Linux

wav2letter++ has been tested on many Linux distributions including Ubuntu, Debian, CentOS, Amazon Linux, and RHEL.

Assuming you have ArrayFire, flashlight, libsndfile, and KenLM built/installed, install the below dependencies with apt (or your distribution's package manager):

sudo apt-get update
sudo apt-get install \
    # Audio encoding libs for libsndfile \
    libasound2-dev \
    libflac-dev \
    libogg-dev \
    libtool \
    libvorbis-dev \
    # FFTW for Fourier transforms \
    libfftw3-dev \
    # Compression libraries for KenLM \
    zlib1g-dev \
    libbz2-dev \
    liblzma-dev \
    libboost-all-dev \
    # gflags \
    libgflags-dev \
    libgflags2v5 \
    # glog \
    libgoogle-glog-dev \
    libgoogle-glog0v5 \

MKL and KenLM aren't easily discovered by CMake by default; export environment variables to make sure they're found. On most Linux-based systems, MKL is installed in /opt/intel/mkl. Since KenLM doesn't support an install step, after building KenLM, point CMake to wherever you downloaded and built KenLM:

export MKLROOT=/opt/intel/mkl # or path to MKL
export KENLM_ROOT_DIR=[path to KenLM]

Once you've downloaded wav2letter++ and built and installed the required dependencies:

# in your wav2letter++ directory
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4 # (or any number of threads)