Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling TorchAudio

  1. Install dependencies.
    1
    2
    apt install cmake ninja-build build-essential git
    apt install python3-dev libsox-dev    # Audio processing dependency (if required)
    
  2. Obtain the TorchAudio source code.
    1
    git clone https://github.com/pytorch/audio.git -b v2.4.0 --depth 1
    

    You need to obtain a mapping TorchAudio version. For details, see Table 1.

  3. Go to the audio directory, and compile and install TorchAudio.
    1
    2
    cd audio
    python3 setup.py bdist_wheel
    

    After the installation is complete, the torchaudio*.whl file is generated in the dist directory.

  4. Verify the installation.
    1
    2
    pip3 install dist/torchaudio*.whl
    python3
    

    Run the following commands:

    1
    2
    import torchaudio
    print(torchaudio.__version__)
    

    If the version information is displayed, the installation is successful.