Installation#
Important
Kaldi and MFA are now built on Conda Forge , so installation of third party binaries is wholly through conda from 2.0.0b4 onwards. Installing MFA via conda will pick up Kaldi as well.
All platforms#
Install Miniconda/Conda installation
Create new environment and install MFA:
conda create -n aligner -c conda-forge montreal-forced-alignerYou can enable the
conda-forgechannel by default by runningconda config --add channels conda-forgein order to omit the-c conda-forgefrom these commands
Ensure you’re in the new environment created (
conda activate aligner)
Installing SpeechBrain#
Ensure you are in the conda environment created above
Install PyTorch a. CPU:
conda install pytorch torchvision torchaudio cpuonly -c pytorchb. GPU:conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidiaInstall Speechbrain via pip:
pip install speechbrain
Upgrading from non-conda version#
In general, it’s recommend to create a new environment. If you want to update,
Activate your conda environment (i.e.,
conda activate aligner)Upgrade all packages via
conda update --allRun
pip uninstall montreal-forced-aligner(to clean up previous pip installation)Run
conda install -c conda-forge montreal-forced-aligner
Installing from source#
If the Conda installation above does not work or the binaries don’t work on your system, you can try building Kaldi and OpenFst from source, along with MFA.
Download/clone the Kaldi GitHub and follow the installation instructions
If you’re on Mac or Linux and want G2P functionality, install OpenFst, OpenGrm-NGram, Baum-Welch, and Pynini
Make sure all Kaldi and other third party executables are on the system path
Download/clone the MFA GitHub Repo and install MFA via
python setup installorpip install -e .Double check everything’s working on the console with
mfa -h
Note
You can also clone the conda-forge feedstocks for OpenFst, SoX, Kaldi, and MFA and run them with conda build to build for your specific system.
Installing via pip#
To install with pip and install minimal dependencies from conda:
Create a conda environment:
Linux/ MacOSX:
conda create -n aligner kaldi pyniniWindows:
conda create -n aligner kaldi
Activate environment via
conda activate alignerInstall MFA
From PyPi:
pip install montreal-forced-alignerFrom GitHub:
pip install git+https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner.gitFrom inside the MFA repository root directory, you can install a local version via:
pip install -e .python setup.py installpython setup.py develop
MFA temporary files#
MFA uses a temporary directory for commands that can be specified in running commands with --temp_directory (or see Configuration), and it also uses a directory to store global configuration settings and saved models. By default this root directory is ~/Documents/MFA, but if you would like to put this somewhere else, you can set the environment variable MFA_ROOT_DIR to use that. MFA will raise an error on load if it’s unable to write the specified root directory.
Supported functionality#
As of version 2.0.6, all features are available on all platforms. Prior to this version, G2P and language model training was unavailable on native Windows, but could be used with Windows Subsystem for Linux (WSL).
Feature |
Linux support |
Windows support |
MacOS support |
|---|---|---|---|
Alignment |
Yes | Yes | Yes |
G2P training |
Yes | Yes | Yes |
G2P generation |
Yes | Yes | Yes |
Transcription |
Yes | Yes | Yes |
Training language model |
Yes | Yes | Yes |