linux_manywheel.sh 1.69 KB
Newer Older
1
2
3
4
5
6
#!/bin/bash

set -ex

export TORCHAUDIO_PACKAGE_NAME="torchaudio_nightly"
export TORCHAUDIO_BUILD_VERSION="0.4.0.dev$(date "+%Y%m%d")"
7
export TORCHAUDIO_BUILD_NUMBER="1"
8
export OUT_DIR="/remote/cpu"
9
10
11
12
13
14
15
16
17
18

cd /opt/python
DESIRED_PYTHON=(*/)
for desired_py in "${DESIRED_PYTHON[@]}"; do
    python_installations+=("/opt/python/$desired_py")
done

OLD_PATH=$PATH
cd /tmp
rm -rf audio
19
git clone https://github.com/pytorch/audio
20
21
mkdir audio/third_party

22
export PREFIX="/tmp/audio"
23
24
25
26
27
28
29
. /remote/wheel/build_from_source.sh

cd /tmp/audio

for PYDIR in "${python_installations[@]}"; do
    export PATH=$PYDIR/bin:$OLD_PATH
    pip install --upgrade pip
30

31
32
33
34
35
36
    # For true hermetic builds, you ought to be constructing the docker
    # from scratch each time.  But this makes things marginally safer if
    # you aren't doing this.
    pip uninstall -y torch || true
    pip uninstall -y torch_nightly || true

37
    export TORCHAUDIO_PYTORCH_DEPENDENCY_NAME=torch_nightly
38
    pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
39
    # CPU/CUDA variants of PyTorch have ABI compatible PyTorch.  Therefore, we
40
41
    # strip off the local package qualifier.  Also, we choose to build against
    # the CPU build, because it takes less time to download.
42
43
44
    export TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION="$(pip show torch_nightly | grep ^Version: | sed 's/Version: \+//' | sed 's/+.\+//')"
    echo "Building against ${TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION}"

45
46
47
    # NB: do not actually install requirements.txt; that is only needed for
    # testing
    pip install numpy future
48
49
50
51
52
    IS_WHEEL=1 python setup.py clean
    IS_WHEEL=1 python setup.py bdist_wheel
    mkdir -p $OUT_DIR
    cp dist/*.whl $OUT_DIR/
done