From 1497d0fafcc1685ef39e99f5bc4f18d727ad338d Mon Sep 17 00:00:00 2001 From: Vladimir Bataev Date: Tue, 24 Jan 2023 18:06:35 +0400 Subject: [PATCH 1/3] Fail if torchaudio not installed Signed-off-by: Vladimir Bataev --- scripts/installers/install_torchaudio_latest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/installers/install_torchaudio_latest.sh b/scripts/installers/install_torchaudio_latest.sh index f9f9da63b0d7..36b489d062b4 100755 --- a/scripts/installers/install_torchaudio_latest.sh +++ b/scripts/installers/install_torchaudio_latest.sh @@ -41,7 +41,7 @@ git submodule update --init --recursive && \ BUILD_SOX=1 BUILD_VERSION=${TORCHAUDIO_BUILD_VERSION} python setup.py install && \ cd .. && \ pytest -rs audio/test/torchaudio_unittest/transforms/torchscript_consistency_cpu_test.py -k 'test_MFCC' || \ -(echo "ERROR: Failed to install torchaudio!"; exit 1); +{ echo "ERROR: Failed to install torchaudio!"; exit 1; }; # RNNT loss is built with CUDA, so checking it will suffice # This test will be skipped if CUDA is not available (e.g. when building from docker) pytest -rs audio/test/torchaudio_unittest/functional/torchscript_consistency_cuda_test.py -k 'test_rnnt_loss' || \ From 8033598e5cd3e0e3183fad56354ba02a0fc4eadf Mon Sep 17 00:00:00 2001 From: Vladimir Bataev Date: Tue, 24 Jan 2023 18:50:56 +0400 Subject: [PATCH 2/3] Fix torchaudio matching version Signed-off-by: Vladimir Bataev --- scripts/installers/install_torchaudio_latest.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/installers/install_torchaudio_latest.sh b/scripts/installers/install_torchaudio_latest.sh index 36b489d062b4..ab2233bab825 100755 --- a/scripts/installers/install_torchaudio_latest.sh +++ b/scripts/installers/install_torchaudio_latest.sh @@ -26,16 +26,29 @@ LATEST_RELEASE=$(git -c 'versionsort.suffix=-' \ # expected TORCHAUDIO_BUILD_VERSION=*.**.* TORCHAUDIO_BUILD_VERSION=${LATEST_RELEASE:8:1}${PYTORCH_VERSION:1:5} +TORCH_MINOR_VERSION=$(python3 -c "minor_version = \"${PYTORCH_VERSION}\".split('.')[1]; print(minor_version)") +TORCHAUDIO_MINOR_VERSION=$(python3 -c "minor_version = \"${LATEST_RELEASE}\".rsplit('.')[-1]; print(minor_version)") + echo "Latest torchaudio release: ${LATEST_RELEASE:8:4}" echo "Pytorch version: ${PYTORCH_VERSION:0:6}" echo "Torchaudio build version: ${TORCHAUDIO_BUILD_VERSION}" +if [[ "$TORCH_MINOR_VERSION" -lt "$TORCHAUDIO_MINOR_VERSION" ]]; then + # for old containers, we need to install matching torchaudio version + INSTALL_BRANCH="release/0.${TORCH_MINOR_VERSION}" +else + # for new containers use latest release + INSTALL_BRANCH=${LATEST_RELEASE} +fi + +echo "Installing torchaudio from branch: ${INSTALL_BRANCH}" + # we need parameterized to run torchaudio tests # suppose that we do not have parameterized installed yet pip install parameterized # Build torchaudio and run MFCC test -git clone --depth 1 --branch ${LATEST_RELEASE} https://github.com/pytorch/audio.git && \ +git clone --depth 1 --branch ${INSTALL_BRANCH} https://github.com/pytorch/audio.git && \ cd audio && \ git submodule update --init --recursive && \ BUILD_SOX=1 BUILD_VERSION=${TORCHAUDIO_BUILD_VERSION} python setup.py install && \ From 2efa97436cd79421fbb690b12c77e845a3e19b98 Mon Sep 17 00:00:00 2001 From: Vladimir Bataev Date: Mon, 6 Feb 2023 18:43:04 +0400 Subject: [PATCH 3/3] Warn if Pytorch major version changed Signed-off-by: Vladimir Bataev --- scripts/installers/install_torchaudio_latest.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/installers/install_torchaudio_latest.sh b/scripts/installers/install_torchaudio_latest.sh index ab2233bab825..b0ed52996ea2 100755 --- a/scripts/installers/install_torchaudio_latest.sh +++ b/scripts/installers/install_torchaudio_latest.sh @@ -26,9 +26,14 @@ LATEST_RELEASE=$(git -c 'versionsort.suffix=-' \ # expected TORCHAUDIO_BUILD_VERSION=*.**.* TORCHAUDIO_BUILD_VERSION=${LATEST_RELEASE:8:1}${PYTORCH_VERSION:1:5} +TORCH_MAJOR_VERSION=$(python3 -c "major_version = \"${PYTORCH_VERSION}\".split('.')[0]; print(major_version)") TORCH_MINOR_VERSION=$(python3 -c "minor_version = \"${PYTORCH_VERSION}\".split('.')[1]; print(minor_version)") TORCHAUDIO_MINOR_VERSION=$(python3 -c "minor_version = \"${LATEST_RELEASE}\".rsplit('.')[-1]; print(minor_version)") +if [[ $TORCH_MAJOR_VERSION -ne 1 ]]; then + echo "WARNING: Pytorch major version different from 1 not supported" +fi + echo "Latest torchaudio release: ${LATEST_RELEASE:8:4}" echo "Pytorch version: ${PYTORCH_VERSION:0:6}" echo "Torchaudio build version: ${TORCHAUDIO_BUILD_VERSION}"