Unverified Commit 89ea6955 authored by moto's avatar moto Committed by GitHub
Browse files

Default to BUILD_SOX=1 in non-Windows systems (#1725)

* Default to BUILD_SOX=1 in non-Windows systems

Since the adaptation of CMake and restricting to the static linking of libsox,
the build process has become much robust with libsox integration enabled.

This commit makes it default behavior to build libsox integration in non-Windows systems.
The build process still checks BUILD_SOX env var so, setting `BUILD_SOX=0` disables it.
parent 560c082e
......@@ -49,7 +49,7 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}"
# 2. Install torchaudio
printf "* Installing torchaudio\n"
git submodule update --init --recursive
BUILD_RNNT=1 BUILD_SOX=1 python setup.py install
python setup.py install
# 3. Install Test tools
printf "* Installing test tools\n"
......
......@@ -29,7 +29,7 @@ jobs:
python -m pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
- name: Build TorchAudio
run: BUILD_SOX=1 USE_CUDA=0 python setup.py develop --user
run: USE_CUDA=0 python setup.py develop --user
# If any code scanning alerts are found, they will be under Security -> CodeQL
# Link: https://github.com/pytorch/audio/security/code-scanning
......
......@@ -54,7 +54,7 @@ endif()
# Options
option(BUILD_SOX "Build libsox statically" OFF)
option(BUILD_SOX "Build libsox statically" ON)
option(BUILD_KALDI "Build kaldi statically" ON)
option(BUILD_RNNT "Enable RNN transducer" ON)
option(BUILD_LIBTORCHAUDIO "Build C++ Library" ON)
......
......@@ -52,20 +52,24 @@ conda install pytorch -c pytorch-nightly
### Install Torchaudio
```bash
pip install cmake ninja
# Install build-time dependencies
pip install cmake ninja pkgconfig
```
```bash
# Build torchaudio
git clone https://github.com/pytorch/audio.git
cd audio
git submodule update --init --recursive
BUILD_SOX=1 python setup.py develop
python setup.py develop
# or, for OSX
# BUILD_SOX=1 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py develop
# for C++ debugging, please use DEBUG=1
# DEBUG=1 python setup.py develop
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py develop
```
Some environmnet variables that change the build behavior
- `BUILD_SOX`: Deteremines whether build and bind libsox in non-Windows environments. (no effect in Windows as libsox integration is not available) Default value is 1 (build and bind). Use 0 for disabling it.
- `USE_CUDA`: Determines whether build the custom CUDA kernel. Default to the availability of CUDA-compatible GPUs.
If you built sox, set the `PATH` variable so that the tests properly use the newly built `sox` binary:
```bash
......
......@@ -80,16 +80,15 @@ conda install -y -c pytorch-nightly torchaudio
### From Source
The build process builds libsox and some codecs that torchaudio need to link to. This is achieved by setting the environment variable `BUILD_SOX=1`.
The build process will fetch and build libmad, lame, flac, vorbis, opus, and libsox before building extension. This process requires `cmake` and `pkg-config`.
On non-Windows platforms, the build process builds libsox and codecs that torchaudio need to link to. It will fetch and build libmad, lame, flac, vorbis, opus, and libsox before building extension. This process requires `cmake` and `pkg-config`. libsox-based features can be disabled with `BUILD_SOX=0`.
The build process also builds the RNN transducer loss. This functionality can be disabled by setting the environment variable `BUILD_RNNT=0`.
```bash
# Linux
BUILD_SOX=1 python setup.py install
python setup.py install
# OSX
BUILD_SOX=1 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
# Windows
# We need to use the MSVC x64 toolset for compilation, with Visual Studio's vcvarsall.bat or directly with vcvars64.bat.
......
......@@ -34,7 +34,7 @@ def _get_build(var, default=False):
return False
_BUILD_SOX = False if platform.system() == 'Windows' else _get_build("BUILD_SOX")
_BUILD_SOX = False if platform.system() == 'Windows' else _get_build("BUILD_SOX", True)
_BUILD_KALDI = False if platform.system() == 'Windows' else _get_build("BUILD_KALDI", True)
_BUILD_RNNT = _get_build("BUILD_RNNT", True)
_USE_ROCM = _get_build("USE_ROCM")
......
......@@ -15,5 +15,5 @@ if [[ "$OSTYPE" == "msys" ]]; then
python_tag="$(echo "cp$PYTHON_VERSION" | tr -d '.')"
"$script_dir/vc_env_helper.bat" python setup.py bdist_wheel --plat-name win_amd64 --python-tag $python_tag
else
BUILD_SOX=1 python setup.py bdist_wheel
python setup.py bdist_wheel
fi
#!/usr/bin/env bash
set -ex
BUILD_SOX=1 python setup.py install --single-version-externally-managed --record=record.txt
python setup.py install --single-version-externally-managed --record=record.txt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment