Installing pre-built binaries¶
torchaudio
has binary distributions for PyPI (pip
) and Anaconda (conda
).
Please refer to https://pytorch.org/get-started/locally/ for the details.
Note
Each torchaudio
package is compiled against specific version of torch
.
Please refer to the following table and install the correct pair of torch
and torchaudio
.
Note
Starting 0.10
, torchaudio has CPU-only and CUDA-enabled binary distributions,
each of which requires a corresponding PyTorch distribution.
Note
This software was compiled against an unmodified copies of FFmpeg, with the specific rpath removed so as to enable the use of system libraries. The LGPL source can be downloaded from the following locations: n4.1.8 (license), n5.0.3 (license) and n6.0 (license).
Dependencies¶
-
Please refer to the compatibility matrix bellow for supported PyTorch versions.
Optional Dependencies¶
-
Required to use
torchaudio.io
module. andbackend="ffmpeg"
in I/O functions.Starting version 2.1, TorchAudio official binary distributions are compatible with FFmpeg version 6, 5 and 4. (>=4.4, <7). At runtime, TorchAudio first looks for FFmpeg 6, if not found, then it continues to looks for 5 and move on to 4.
There are multiple ways to install FFmpeg libraries. Please refer to the official documentation for how to install FFmpeg. If you are using Anaconda Python distribution,
conda install -c conda-forge 'ffmpeg<7'
will install compatible FFmpeg libraries.If you need to specify the version of FFmpeg TorchAudio searches and links, you can specify it via the environment variable
TORIO_USE_FFMPEG_VERSION
. For example, by settingTORIO_USE_FFMPEG_VERSION=5
, TorchAudio will only look for FFmpeg 5.If for some reason, this search mechanism is causing an issue, you can disable the FFmpeg integration entirely by setting the environment variable
TORIO_USE_FFMPEG=0
.There are multiple ways to install FFmpeg libraries. If you are using Anaconda Python distribution,
conda install -c conda-forge 'ffmpeg<7'
will install compatible FFmpeg libraries.Note
When searching for FFmpeg installation, TorchAudio looks for library files which have names with version numbers. That is,
libavutil.so.<VERSION>
for Linux,libavutil.<VERSION>.dylib
for macOS, andavutil-<VERSION>.dll
for Windows. Many public pre-built binaries follow this naming scheme, but some distributions have un-versioned file names. If you are having difficulties detecting FFmpeg, double check that the library files you installed follow this naming scheme, (and then make sure that they are in one of the directories listed in library search path.) -
Required to use
backend="sox"
in I/O functions.Starting version 2.1, TorchAudio requires separately installed libsox.
If dynamic linking is causing an issue, you can set the environment variable
TORCHAUDIO_USE_SOX=0
, and TorchAudio won’t use SoX.Note
TorchAudio looks for a library file with unversioned name, that is
libsox.so
for Linux, andlibsox.dylib
for macOS. Some package managers install the library file with different name. For example, aptitude on Ubuntu installslibsox.so.3
. To have TorchAudio link against it, you can create a symbolic link to it with namelibsox.so
(and put the symlink in a library search path).Note
TorchAudio is tested on libsox 14.4.2. (And it is unlikely that other versions would work.)
-
Required to use
backend="soundfile"
in I/O functions. -
Required for performing automatic speech recognition with Emformer RNN-T. You can install it by running
pip install sentencepiece
. -
Required for performing text-to-speech with Tacotron2 Text-To-Speech.
-
Required to use
torchaudio.kaldi_io
module.
Compatibility Matrix¶
The official binary distributions of TorchAudio contain extension modules which are written in C++ and linked against specific versions of PyTorch.
TorchAudio and PyTorch from different releases cannot be used together. Please refer to the following table for the matching versions.
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|