From 737970b5efa0416514b2d9ec2eb32977ead177dd Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Tue, 13 Oct 2020 16:39:29 -0400 Subject: [PATCH 01/18] Set release version to 0.7.0 and pytorch to 1.7.0 for release (#951) --- .circleci/config.yml | 4 ++-- .circleci/config.yml.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b2b0dd45c3..b4cd58fee2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,11 +52,11 @@ binary_common: &binary_common build_version: description: "version number of release binary; by default, build a nightly" type: string - default: "" + default: "0.7.0" pytorch_version: description: "PyTorch version to build against; by default, use a nightly" type: string - default: "" + default: "1.7.0" # Don't edit these python_version: description: "Python version to build against (e.g., 3.8)" diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index b1f40c24c0..147edcc4e1 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -52,11 +52,11 @@ binary_common: &binary_common build_version: description: "version number of release binary; by default, build a nightly" type: string - default: "" + default: "0.7.0" pytorch_version: description: "PyTorch version to build against; by default, use a nightly" type: string - default: "" + default: "1.7.0" # Don't edit these python_version: description: "Python version to build against (e.g., 3.8)" From cf00ef5bc60dc96c4db3226e18fe8e72af0fc97b Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Tue, 13 Oct 2020 17:17:17 -0400 Subject: [PATCH 02/18] Upload to "test" channel on release branch (#952) --- .circleci/config.yml | 8 ++++---- .circleci/config.yml.in | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b4cd58fee2..2eedff66b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,7 +34,7 @@ commands: command: | our_upload_channel=nightly # On tags upload to test instead - if [[ -n "${CIRCLE_TAG}" ]]; then + if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then our_upload_channel=test fi echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} @@ -301,7 +301,7 @@ jobs: command: | set -x source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION} - pip install $(ls ~/workspace/torchaudio*.whl) -f https://download.pytorch.org/whl/nightly/torch_nightly.html -f https://download.pytorch.org/whl/test/torch_test.html + pip install $(ls ~/workspace/torchaudio*.whl) -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/torch_${UPLOAD_CHANNEL}.html" - run: name: smoke test command: | @@ -323,7 +323,7 @@ jobs: conda env remove -n python${PYTHON_VERSION} || true conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION} conda activate python${PYTHON_VERSION} - conda install -v -y -c pytorch-test -c pytorch-nightly pytorch + conda install -v -y -c pytorch-${UPLOAD_CHANNEL} pytorch conda install -v -y $(ls ~/workspace/torchaudio*.tar.bz2) - run: name: smoke test @@ -347,7 +347,7 @@ jobs: conda env remove -n python${PYTHON_VERSION} || true conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION} conda activate python${PYTHON_VERSION} - pip install $(ls ~/workspace/torchaudio*.whl) -f https://download.pytorch.org/whl/nightly/torch_nightly.html -f https://download.pytorch.org/whl/test/torch_test.html + pip install $(ls ~/workspace/torchaudio*.whl) -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/torch_${UPLOAD_CHANNEL}.html" - run: name: smoke test command: | diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index 147edcc4e1..bb3f2e1e24 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -34,7 +34,7 @@ commands: command: | our_upload_channel=nightly # On tags upload to test instead - if [[ -n "${CIRCLE_TAG}" ]]; then + if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then our_upload_channel=test fi echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} @@ -301,7 +301,7 @@ jobs: command: | set -x source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION} - pip install $(ls ~/workspace/torchaudio*.whl) -f https://download.pytorch.org/whl/nightly/torch_nightly.html -f https://download.pytorch.org/whl/test/torch_test.html + pip install $(ls ~/workspace/torchaudio*.whl) -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/torch_${UPLOAD_CHANNEL}.html" - run: name: smoke test command: | @@ -323,7 +323,7 @@ jobs: conda env remove -n python${PYTHON_VERSION} || true conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION} conda activate python${PYTHON_VERSION} - conda install -v -y -c pytorch-test -c pytorch-nightly pytorch + conda install -v -y -c pytorch-${UPLOAD_CHANNEL} pytorch conda install -v -y $(ls ~/workspace/torchaudio*.tar.bz2) - run: name: smoke test @@ -347,7 +347,7 @@ jobs: conda env remove -n python${PYTHON_VERSION} || true conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION} conda activate python${PYTHON_VERSION} - pip install $(ls ~/workspace/torchaudio*.whl) -f https://download.pytorch.org/whl/nightly/torch_nightly.html -f https://download.pytorch.org/whl/test/torch_test.html + pip install $(ls ~/workspace/torchaudio*.whl) -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/torch_${UPLOAD_CHANNEL}.html" - run: name: smoke test command: | From 53643bf137f949df36ca0ac6a90ab16b9708dbfe Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Tue, 13 Oct 2020 19:53:52 -0400 Subject: [PATCH 03/18] Use PyTorch RC for unittest in release branch (#953) --- .circleci/config.yml | 6 ++++++ .circleci/config.yml.in | 6 ++++++ .circleci/unittest/linux/scripts/install.sh | 2 +- .circleci/unittest/windows/scripts/install.sh | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2eedff66b9..5b74ea40f3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -391,6 +391,7 @@ jobs: - checkout - attach_workspace: at: third_party + - designate_upload_channel - generate_cache_key - restore_cache: @@ -433,6 +434,7 @@ jobs: - checkout - attach_workspace: at: third_party + - designate_upload_channel - generate_cache_key - restore_cache: @@ -470,6 +472,7 @@ jobs: name: windows-cpu steps: - checkout + - designate_upload_channel - generate_cache_key - restore_cache: @@ -506,6 +509,7 @@ jobs: CUDA_VERSION: "10.1" steps: - checkout + - designate_upload_channel - generate_cache_key - restore_cache: @@ -544,6 +548,7 @@ jobs: - install_build_tools_macos - attach_workspace: at: third_party + - designate_upload_channel - generate_cache_key - restore_cache: @@ -582,6 +587,7 @@ jobs: resource_class: medium steps: - checkout + - designate_upload_channel - generate_cache_key - restore_cache: diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index bb3f2e1e24..2b09a6c426 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -391,6 +391,7 @@ jobs: - checkout - attach_workspace: at: third_party + - designate_upload_channel - generate_cache_key - restore_cache: {% raw %} @@ -433,6 +434,7 @@ jobs: - checkout - attach_workspace: at: third_party + - designate_upload_channel - generate_cache_key - restore_cache: {% raw %} @@ -470,6 +472,7 @@ jobs: name: windows-cpu steps: - checkout + - designate_upload_channel - generate_cache_key - restore_cache: {% raw %} @@ -506,6 +509,7 @@ jobs: CUDA_VERSION: "10.1" steps: - checkout + - designate_upload_channel - generate_cache_key - restore_cache: {% raw %} @@ -544,6 +548,7 @@ jobs: - install_build_tools_macos - attach_workspace: at: third_party + - designate_upload_channel - generate_cache_key - restore_cache: {% raw %} @@ -582,6 +587,7 @@ jobs: resource_class: medium steps: - checkout + - designate_upload_channel - generate_cache_key - restore_cache: {% raw %} diff --git a/.circleci/unittest/linux/scripts/install.sh b/.circleci/unittest/linux/scripts/install.sh index 8346e6c825..f037d1dbad 100755 --- a/.circleci/unittest/linux/scripts/install.sh +++ b/.circleci/unittest/linux/scripts/install.sh @@ -17,7 +17,7 @@ else cudatoolkit="cudatoolkit=${version}" fi printf "Installing PyTorch with %s\n" "${cudatoolkit}" -conda install -y -c pytorch-nightly pytorch "${cudatoolkit}" +conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}" printf "* Installing torchaudio\n" BUILD_SOX=1 python setup.py install diff --git a/.circleci/unittest/windows/scripts/install.sh b/.circleci/unittest/windows/scripts/install.sh index 2b9c88b4af..c294dc74a3 100644 --- a/.circleci/unittest/windows/scripts/install.sh +++ b/.circleci/unittest/windows/scripts/install.sh @@ -17,7 +17,7 @@ else cudatoolkit="cudatoolkit=${version}" fi printf "Installing PyTorch with %s\n" "${cudatoolkit}" -conda install -y -c pytorch-nightly pytorch "${cudatoolkit}" +conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}" printf "* Installing torchaudio\n" python setup.py install From 1cbf8193cee11f807dc0d075f714daa12d8a5076 Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Fri, 16 Oct 2020 16:19:53 -0400 Subject: [PATCH 04/18] Fix binary smoke test (#964) --- .circleci/config.yml | 3 +++ .circleci/config.yml.in | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b74ea40f3..ef0060200c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -296,6 +296,7 @@ jobs: steps: - attach_workspace: at: ~/workspace + - designate_upload_channel - run: name: install binaries command: | @@ -315,6 +316,7 @@ jobs: steps: - attach_workspace: at: ~/workspace + - designate_upload_channel - run: name: install binaries command: | @@ -339,6 +341,7 @@ jobs: steps: - attach_workspace: at: ~/workspace + - designate_upload_channel - run: name: install binaries command: | diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index 2b09a6c426..bb073c6625 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -296,6 +296,7 @@ jobs: steps: - attach_workspace: at: ~/workspace + - designate_upload_channel - run: name: install binaries command: | @@ -315,6 +316,7 @@ jobs: steps: - attach_workspace: at: ~/workspace + - designate_upload_channel - run: name: install binaries command: | @@ -339,6 +341,7 @@ jobs: steps: - attach_workspace: at: ~/workspace + - designate_upload_channel - run: name: install binaries command: | From 26bea3c6fc9cbb1eb94352a5b7f24fea14b61d1b Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Fri, 16 Oct 2020 16:27:25 -0400 Subject: [PATCH 05/18] Make removal version explicit for sox deprecations (#959) * Make removal version explicit for sox deprecations * Move SoxEffectsChain deprecation into `__init__` and use plain `wranings.warn`, to avoid documentation build issue. --- torchaudio/__init__.py | 6 ++++-- torchaudio/sox_effects/sox_effects.py | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/torchaudio/__init__.py b/torchaudio/__init__.py index 389d91f635..0d6b495eb1 100644 --- a/torchaudio/__init__.py +++ b/torchaudio/__init__.py @@ -37,7 +37,8 @@ @_mod_utils.deprecated( "Please remove the function call to initialize_sox. " - "Resource initialization is now automatically handled.") + "Resource initialization is now automatically handled.", + "0.8.0") def initialize_sox(): """Initialize sox effects. @@ -50,7 +51,8 @@ def initialize_sox(): "Please remove the function call to torchaudio.shutdown_sox. " "Resource clean up is now automatically handled. " "In the unlikely event that you need to manually shutdown sox, " - "please use torchaudio.sox_effects.shutdown_sox_effects.") + "please use torchaudio.sox_effects.shutdown_sox_effects.", + "0.8.0") def shutdown_sox(): """Shutdown sox effects. diff --git a/torchaudio/sox_effects/sox_effects.py b/torchaudio/sox_effects/sox_effects.py index 9262786541..6cd77b0ff4 100644 --- a/torchaudio/sox_effects/sox_effects.py +++ b/torchaudio/sox_effects/sox_effects.py @@ -1,3 +1,4 @@ +import warnings from typing import Any, Callable, List, Optional, Tuple, Union import torch @@ -260,7 +261,7 @@ def apply_effects_file( @_mod_utils.requires_module('torchaudio._torchaudio') -@_mod_utils.deprecated('Please migrate to `apply_effects_file` or `apply_effects_tensor`.') +@_mod_utils.deprecated('Please migrate to `apply_effects_file` or `apply_effects_tensor`.', "0.8.0") def SoxEffect(): r"""Create an object for passing sox effect information between python and c++ @@ -275,7 +276,6 @@ def SoxEffect(): return _torchaudio.SoxEffect() -@_mod_utils.deprecated('Please migrate to `apply_effects_file` or `apply_effects_tensor`.') class SoxEffectsChain(object): r"""SoX effects chain class. @@ -339,6 +339,11 @@ def __init__(self, out_siginfo: Any = None, out_encinfo: Any = None, filetype: str = "raw") -> None: + warnings.warn( + 'torchaudio.sox_effects.SoxEffectsChain has been deprecated and ' + 'will be removed from 0.8.0 release. ' + 'Please migrate to `apply_effects_file` or `apply_effects_tensor`.' + ) self.input_file: Optional[str] = None self.chain: List[str] = [] self.MAX_EFFECT_OPTS = 20 From 49f426057ced6d664a0c10abe2f8ff0d2c78db25 Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Mon, 19 Oct 2020 13:52:41 -0400 Subject: [PATCH 06/18] Resolve setup issue of macOS CI Unittest on release/0.7 (#946) --- .circleci/config.yml | 16 ---------------- .circleci/config.yml.in | 16 ---------------- .../unittest/linux/scripts/environment.yml | 17 ----------------- .circleci/unittest/linux/scripts/install.sh | 19 +++++++++++++++++-- .../linux/scripts/run_style_checks.sh | 2 ++ .circleci/unittest/linux/scripts/setup_env.sh | 17 ----------------- 6 files changed, 19 insertions(+), 68 deletions(-) delete mode 100644 .circleci/unittest/linux/scripts/environment.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index ef0060200c..fefff2523a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -552,25 +552,9 @@ jobs: - attach_workspace: at: third_party - designate_upload_channel - - generate_cache_key - - restore_cache: - - keys: - - env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }} - - run: name: Setup command: .circleci/unittest/linux/scripts/setup_env.sh - - save_cache: - - key: env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }} - - paths: - - conda - - env - - third_party/build - - third_party/install - - third_party/src - run: name: Install torchaudio command: .circleci/unittest/linux/scripts/install.sh diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index bb073c6625..6aa6d9738f 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -552,25 +552,9 @@ jobs: - attach_workspace: at: third_party - designate_upload_channel - - generate_cache_key - - restore_cache: - {% raw %} - keys: - - env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }} - {% endraw %} - run: name: Setup command: .circleci/unittest/linux/scripts/setup_env.sh - - save_cache: - {% raw %} - key: env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }} - {% endraw %} - paths: - - conda - - env - - third_party/build - - third_party/install - - third_party/src - run: name: Install torchaudio command: .circleci/unittest/linux/scripts/install.sh diff --git a/.circleci/unittest/linux/scripts/environment.yml b/.circleci/unittest/linux/scripts/environment.yml deleted file mode 100644 index 4315a2205b..0000000000 --- a/.circleci/unittest/linux/scripts/environment.yml +++ /dev/null @@ -1,17 +0,0 @@ -# a comment for these trying times -channels: - - conda-forge - - defaults -dependencies: - - flake8 - - numpy >= 1.11 - - pytest - - pytest-cov - - codecov - - librosa>=0.8.0 - - llvmlite==0.31 # See https://github.com/pytorch/audio/pull/766 - - pip - - pip: - - kaldi-io - - scipy - - parameterized diff --git a/.circleci/unittest/linux/scripts/install.sh b/.circleci/unittest/linux/scripts/install.sh index f037d1dbad..bde82ff9ee 100755 --- a/.circleci/unittest/linux/scripts/install.sh +++ b/.circleci/unittest/linux/scripts/install.sh @@ -11,13 +11,28 @@ eval "$(./conda/bin/conda shell.bash hook)" conda activate ./env if [ -z "${CUDA_VERSION:-}" ] ; then - cudatoolkit="cpuonly" + case "$(uname -s)" in + Darwin*) cudatoolkit="";; + *) cudatoolkit="cpuonly" + esac else version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")" cudatoolkit="cudatoolkit=${version}" fi printf "Installing PyTorch with %s\n" "${cudatoolkit}" -conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}" +conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch ${cudatoolkit} + +printf "* Installing dependencies for test\n" +conda install -y -c conda-forge pytest pytest-cov codecov 'librosa>=0.8.0' scipy parameterized +pip install kaldi-io + +printf "* Building codecs\n" +mkdir -p third_party/build +( + cd third_party/build + cmake .. + cmake --build . +) printf "* Installing torchaudio\n" BUILD_SOX=1 python setup.py install diff --git a/.circleci/unittest/linux/scripts/run_style_checks.sh b/.circleci/unittest/linux/scripts/run_style_checks.sh index 70b83e19f5..8eff8a2b52 100755 --- a/.circleci/unittest/linux/scripts/run_style_checks.sh +++ b/.circleci/unittest/linux/scripts/run_style_checks.sh @@ -5,6 +5,8 @@ set -u eval "$(./conda/bin/conda shell.bash hook)" conda activate ./env +pip install clang-format flake8 + # We want to run all the style checks even if one of them fail. exit_status=0 diff --git a/.circleci/unittest/linux/scripts/setup_env.sh b/.circleci/unittest/linux/scripts/setup_env.sh index 290f0f8f97..09c10bb3b1 100755 --- a/.circleci/unittest/linux/scripts/setup_env.sh +++ b/.circleci/unittest/linux/scripts/setup_env.sh @@ -7,7 +7,6 @@ set -e -this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" root_dir="$(git rev-parse --show-toplevel)" conda_dir="${root_dir}/conda" env_dir="${root_dir}/env" @@ -32,19 +31,3 @@ if [ ! -d "${env_dir}" ]; then printf "* Creating a test environment\n" conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION" fi -conda activate "${env_dir}" - -# 3. Install Conda dependencies -printf "* Installing dependencies (except PyTorch)\n" -conda env update --file "${this_dir}/environment.yml" --prune -if [ "${os}" == Linux ] ; then - pip install clang-format -fi - -# 4. Buld codecs -mkdir -p third_party/build -( - cd third_party/build - cmake .. - cmake --build . -) From b5ea3f35ca2fd1792a11159c1ac38c921efd099d Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Tue, 20 Oct 2020 12:53:16 -0400 Subject: [PATCH 07/18] Skip failing tests on macOS Python 3.6/3.7 (#970) --- test/torchaudio_unittest/sox_effect/dataset_test.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/torchaudio_unittest/sox_effect/dataset_test.py b/test/torchaudio_unittest/sox_effect/dataset_test.py index e98095d0dd..647e4d2a81 100644 --- a/test/torchaudio_unittest/sox_effect/dataset_test.py +++ b/test/torchaudio_unittest/sox_effect/dataset_test.py @@ -1,3 +1,6 @@ +import sys +import platform +from unittest import skipIf from typing import List, Tuple import numpy as np @@ -68,6 +71,13 @@ def init_random_seed(worker_id): @skipIfNoExtension +@skipIf( + platform.system() == 'Darwin' and + sys.version_info.major == 3 and + sys.version_info.minor in [6, 7], + 'This test is known to get stuck for macOS with Python < 3.8. ' + 'See https://github.com/pytorch/pytorch/issues/46409' +) class TestSoxEffectsDataset(TempDirMixin, PytorchTestCase): """Test `apply_effects_file` in multi-process dataloader setting""" From 09a6c442ecd5145507e08113d950c98f4eabee33 Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Tue, 20 Oct 2020 12:53:42 -0400 Subject: [PATCH 08/18] Set doc version to 0.7.0 (#969) --- docs/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 9d8faaa61b..9a7b31b47a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -82,10 +82,10 @@ # # The short X.Y version. # TODO: change to [:2] at v1.0 -version = 'master ' +version = '0.7.0' # The full version, including alpha/beta/rc tags. # TODO: verify this works as expected -release = 'master' +release = '0.7.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From a0df39cb27423b16843c62e146b88adc60ab735c Mon Sep 17 00:00:00 2001 From: Vincent QB Date: Tue, 20 Oct 2020 13:16:53 -0400 Subject: [PATCH 09/18] Update index.rst (#968) (#971) Adds introductory context and links to the PyTorch Libraries to audio docs. Co-authored-by: Brian Johnson --- docs/source/index.rst | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/source/index.rst b/docs/source/index.rst index 8146e545c3..596a636b1b 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,5 +1,27 @@ torchaudio ========== +This library is part of the `PyTorch +`_ project. PyTorch is an open source +machine learning framework. + +Features described in this documentation are classified by release status: + + *Stable:* These features will be maintained long-term and there should generally + be no major performance limitations or gaps in documentation. + We also expect to maintain backwards compatibility (although + breaking changes can happen and notice will be given one release ahead + of time). + + *Beta:* Features are tagged as Beta because the API may change based on + user feedback, because the performance needs to improve, or because + coverage across operators is not yet complete. For Beta features, we are + committing to seeing the feature through to the Stable classification. + We are not, however, committing to backwards compatibility. + + *Prototype:* These features are typically not available as part of + binary distributions like PyPI or Conda, except sometimes behind run-time + flags, and are at an early stage for feedback and testing. + The :mod:`torchaudio` package consists of I/O, popular datasets and common audio transformations. @@ -17,3 +39,16 @@ The :mod:`torchaudio` package consists of I/O, popular datasets and common audio compliance.kaldi kaldi_io utils + + +.. toctree:: + :maxdepth: 1 + :caption: PyTorch Libraries + + PyTorch + torchaudio + torchtext + torchvision + TorchElastic + TorchServe + PyTorch on XLA Devices From ac17b64f4daedd45d0495e2512e22eaa6e5b7eeb Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Tue, 20 Oct 2020 16:47:07 -0400 Subject: [PATCH 10/18] Fix doc rendering by using Sphinx 2.4.4 (#972) --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index c591f08491..99a7811de6 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ -sphinx +sphinx==2.4.4 -e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme sphinxcontrib.katex matplotlib From 130ac7e7f6ae1e2bc5dcb3a5a3d723d3e84b4a05 Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Thu, 3 Dec 2020 13:47:09 -0500 Subject: [PATCH 11/18] Temporarily Disable OpenMP support for libsox (#1026) (#1054) Currently `libsox` on Linux is compiled with GPU OpenMP and it interferes with the version PyTorch uses (Intel in case of binary distribution). This PR disables OpenMP support for `libsox`, while we investigate the way to use the same OpenMP as PyTorch's version. --- .../sox_effect/dataset_test.py | 34 +++++++++++++++++++ third_party/CMakeLists.txt | 4 ++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/test/torchaudio_unittest/sox_effect/dataset_test.py b/test/torchaudio_unittest/sox_effect/dataset_test.py index 647e4d2a81..7e89960186 100644 --- a/test/torchaudio_unittest/sox_effect/dataset_test.py +++ b/test/torchaudio_unittest/sox_effect/dataset_test.py @@ -2,6 +2,7 @@ import platform from unittest import skipIf from typing import List, Tuple +from concurrent.futures import ProcessPoolExecutor import numpy as np import torch @@ -122,3 +123,36 @@ def test_apply_effects_tensor(self): ) for batch in loader: assert batch.shape == (32, 2, 2 * sample_rate) + + +def speed(path): + wav, sample_rate = torchaudio.backend.sox_io_backend.load(path) + effects = [ + ['speed', '1.03756523535464655'], + ['rate', f'{sample_rate}'], + ] + return torchaudio.sox_effects.apply_effects_tensor(wav, sample_rate, effects)[0] + + +@skipIfNoExtension +class TestProcessPoolExecutor(TempDirMixin, PytorchTestCase): + backend = "sox_io" + + def setUp(self): + sample_rate = 16000 + self.flist = [] + for i in range(10): + path = self.get_temp_path(f'{i}.wav') + data = get_whitenoise(n_channels=1, sample_rate=sample_rate, duration=1, dtype='float') + save_wav(path, data, sample_rate) + self.flist.append(path) + + def test_executor(self): + """Test that apply_effects_tensor with speed + rate does not crush + + https://github.com/pytorch/audio/issues/1021 + """ + executor = ProcessPoolExecutor(1) + futures = [executor.submit(speed, path) for path in self.flist] + for future in futures: + future.result() diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index c4be4cb7b0..da068be8f3 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -76,5 +76,7 @@ ExternalProject_Add(libsox DOWNLOAD_DIR ${ARCHIVE_DIR} URL https://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.bz2 URL_HASH SHA256=81a6956d4330e75b5827316e44ae381e6f1e8928003c6aa45896da9041ea149c - CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_codec_helper.sh ${CMAKE_CURRENT_SOURCE_DIR}/src/libsox/configure ${COMMON_ARGS} --with-lame --with-flac --with-mad --with-oggvorbis --without-alsa --without-coreaudio --without-png --without-oss --without-sndfile --with-opus + # OpenMP is by default compiled against GNU OpenMP, which conflicts with the version of OpenMP that PyTorch uses. + # See https://github.com/pytorch/audio/pull/1026 + CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_codec_helper.sh ${CMAKE_CURRENT_SOURCE_DIR}/src/libsox/configure ${COMMON_ARGS} --with-lame --with-flac --with-mad --with-oggvorbis --without-alsa --without-coreaudio --without-png --without-oss --without-sndfile --with-opus --disable-openmp ) From 1b7ee833f5b43337dfc27763aa2bd1fb93f8a34c Mon Sep 17 00:00:00 2001 From: Eli Uriegas <1700823+seemethere@users.noreply.github.com> Date: Thu, 3 Dec 2020 11:37:44 -0800 Subject: [PATCH 12/18] [v0.7.x] Add Python 3.9 support (#1061) --- .circleci/config.yml | 265 +++++++++++++++++- .circleci/config.yml.in | 32 ++- .circleci/regenerate.py | 2 +- .circleci/unittest/linux/scripts/install.sh | 10 +- .../unittest/windows/scripts/environment.yml | 3 +- .circleci/unittest/windows/scripts/install.sh | 8 +- packaging/pkg_helpers.bash | 6 +- 7 files changed, 312 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fefff2523a..de7154fe38 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,6 +45,16 @@ commands: name: Install cmake and pkg-config command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config wget # Disable brew auto update which is very slow + load_conda_channel_flags: + description: "Determines whether we need extra conda channels" + steps: + - run: + name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV + command: | + CONDA_CHANNEL_FLAGS="" + if [[ "${PYTHON_VERSION}" = *3.9* ]]; then + echo "export CONDA_CHANNEL_FLAGS=-c=conda-forge" >> ${BASH_ENV} + fi binary_common: &binary_common parameters: @@ -52,11 +62,11 @@ binary_common: &binary_common build_version: description: "version number of release binary; by default, build a nightly" type: string - default: "0.7.0" + default: "0.7.1" pytorch_version: description: "PyTorch version to build against; by default, use a nightly" type: string - default: "1.7.0" + default: "1.7.1" # Don't edit these python_version: description: "Python version to build against (e.g., 3.8)" @@ -117,7 +127,7 @@ jobs: binary_linux_wheel: <<: *binary_common docker: - - image: "pytorch/manylinux-cuda100" + - image: "pytorch/manylinux-cuda102" resource_class: 2xlarge+ steps: - checkout @@ -138,6 +148,7 @@ jobs: resource_class: 2xlarge+ steps: - checkout + - load_conda_channel_flags - attach_workspace: at: third_party - run: packaging/build_conda.sh @@ -155,6 +166,7 @@ jobs: steps: - checkout - install_build_tools_macos + - load_conda_channel_flags - attach_workspace: at: third_party - run: @@ -180,6 +192,7 @@ jobs: steps: - checkout - install_build_tools_macos + - load_conda_channel_flags - attach_workspace: at: third_party - run: @@ -202,6 +215,7 @@ jobs: name: windows-cpu steps: - checkout + - load_conda_channel_flags - run: name: build command: | @@ -221,6 +235,7 @@ jobs: name: windows-cpu steps: - checkout + - load_conda_channel_flags - run: name: build command: | @@ -278,6 +293,7 @@ jobs: - attach_workspace: at: ~/workspace - designate_upload_channel + - load_conda_channel_flags - run: name: install binaries command: | @@ -297,6 +313,7 @@ jobs: - attach_workspace: at: ~/workspace - designate_upload_channel + - load_conda_channel_flags - run: name: install binaries command: | @@ -317,6 +334,7 @@ jobs: - attach_workspace: at: ~/workspace - designate_upload_channel + - load_conda_channel_flags - run: name: install binaries command: | @@ -342,6 +360,7 @@ jobs: - attach_workspace: at: ~/workspace - designate_upload_channel + - load_conda_channel_flags - run: name: install binaries command: | @@ -395,6 +414,7 @@ jobs: - attach_workspace: at: third_party - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: @@ -438,6 +458,7 @@ jobs: - attach_workspace: at: third_party - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: @@ -476,6 +497,7 @@ jobs: steps: - checkout - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: @@ -513,6 +535,7 @@ jobs: steps: - checkout - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: @@ -549,6 +572,7 @@ jobs: steps: - checkout - install_build_tools_macos + - load_conda_channel_flags - attach_workspace: at: third_party - designate_upload_channel @@ -575,6 +599,7 @@ jobs: steps: - checkout - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: @@ -605,6 +630,7 @@ jobs: steps: - checkout - generate_cache_key + - load_conda_channel_flags - restore_cache: keys: @@ -655,6 +681,11 @@ workflows: python_version: '3.8' requires: - download_third_parties_nix + - binary_linux_wheel: + name: binary_linux_wheel_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix - binary_macos_wheel: name: binary_macos_wheel_py3.6 python_version: '3.6' @@ -670,6 +701,11 @@ workflows: python_version: '3.8' requires: - download_third_parties_nix + - binary_macos_wheel: + name: binary_macos_wheel_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix - binary_windows_wheel: name: binary_windows_wheel_py3.6 python_version: '3.6' @@ -679,6 +715,9 @@ workflows: - binary_windows_wheel: name: binary_windows_wheel_py3.8 python_version: '3.8' + - binary_windows_wheel: + name: binary_windows_wheel_py3.9 + python_version: '3.9' - binary_linux_conda: name: binary_linux_conda_py3.6 python_version: '3.6' @@ -694,6 +733,11 @@ workflows: python_version: '3.8' requires: - download_third_parties_nix + - binary_linux_conda: + name: binary_linux_conda_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix - binary_macos_conda: name: binary_macos_conda_py3.6 python_version: '3.6' @@ -709,6 +753,11 @@ workflows: python_version: '3.8' requires: - download_third_parties_nix + - binary_macos_conda: + name: binary_macos_conda_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix - binary_windows_conda: name: binary_windows_conda_py3.6 python_version: '3.6' @@ -718,6 +767,9 @@ workflows: - binary_windows_conda: name: binary_windows_conda_py3.8 python_version: '3.8' + - binary_windows_conda: + name: binary_windows_conda_py3.9 + python_version: '3.9' unittest: jobs: - torchscript_bc_test: @@ -743,6 +795,11 @@ workflows: python_version: '3.8' requires: - download_third_parties_nix + - unittest_linux_cpu: + name: unittest_linux_cpu_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix - unittest_linux_gpu: filters: branches: @@ -779,6 +836,18 @@ workflows: python_version: '3.8' requires: - download_third_parties_nix + - unittest_linux_gpu: + filters: + branches: + only: + - master + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: unittest_linux_gpu_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix - unittest_windows_cpu: name: unittest_windows_cpu_py3.6 python_version: '3.6' @@ -788,6 +857,9 @@ workflows: - unittest_windows_cpu: name: unittest_windows_cpu_py3.8 python_version: '3.8' + - unittest_windows_cpu: + name: unittest_windows_cpu_py3.9 + python_version: '3.9' - unittest_windows_gpu: filters: branches: @@ -818,6 +890,16 @@ workflows: only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ name: unittest_windows_gpu_py3.8 python_version: '3.8' + - unittest_windows_gpu: + filters: + branches: + only: + - master + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: unittest_windows_gpu_py3.9 + python_version: '3.9' - unittest_macos_cpu: name: unittest_macos_cpu_py3.6 python_version: '3.6' @@ -833,6 +915,11 @@ workflows: python_version: '3.8' requires: - download_third_parties_nix + - unittest_macos_cpu: + name: unittest_macos_cpu_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix nightly: jobs: - circleci_consistency: @@ -946,6 +1033,39 @@ workflows: python_version: '3.8' requires: - nightly_binary_linux_wheel_py3.8_upload + - binary_linux_wheel: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_linux_wheel_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix + - binary_wheel_upload: + context: org-member + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_linux_wheel_py3.9_upload + requires: + - nightly_binary_linux_wheel_py3.9 + - smoke_test_linux_pip: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_linux_wheel_py3.9_smoke_test_pip + python_version: '3.9' + requires: + - nightly_binary_linux_wheel_py3.9_upload - binary_macos_wheel: filters: branches: @@ -1012,6 +1132,28 @@ workflows: name: nightly_binary_macos_wheel_py3.8_upload requires: - nightly_binary_macos_wheel_py3.8 + - binary_macos_wheel: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_macos_wheel_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix + - binary_wheel_upload: + context: org-member + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_macos_wheel_py3.9_upload + requires: + - nightly_binary_macos_wheel_py3.9 - binary_windows_wheel: filters: branches: @@ -1105,6 +1247,37 @@ workflows: python_version: '3.8' requires: - nightly_binary_windows_wheel_py3.8_upload + - binary_windows_wheel: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_windows_wheel_py3.9 + python_version: '3.9' + - binary_wheel_upload: + context: org-member + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_windows_wheel_py3.9_upload + requires: + - nightly_binary_windows_wheel_py3.9 + - smoke_test_windows_pip: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_windows_wheel_py3.9_smoke_test_pip + python_version: '3.9' + requires: + - nightly_binary_windows_wheel_py3.9_upload - binary_linux_conda: filters: branches: @@ -1204,6 +1377,39 @@ workflows: python_version: '3.8' requires: - nightly_binary_linux_conda_py3.8_upload + - binary_linux_conda: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_linux_conda_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix + - binary_conda_upload: + context: org-member + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_linux_conda_py3.9_upload + requires: + - nightly_binary_linux_conda_py3.9 + - smoke_test_linux_conda: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_linux_conda_py3.9_smoke_test_conda + python_version: '3.9' + requires: + - nightly_binary_linux_conda_py3.9_upload - binary_macos_conda: filters: branches: @@ -1270,6 +1476,28 @@ workflows: name: nightly_binary_macos_conda_py3.8_upload requires: - nightly_binary_macos_conda_py3.8 + - binary_macos_conda: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_macos_conda_py3.9 + python_version: '3.9' + requires: + - download_third_parties_nix + - binary_conda_upload: + context: org-member + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_macos_conda_py3.9_upload + requires: + - nightly_binary_macos_conda_py3.9 - binary_windows_conda: filters: branches: @@ -1363,6 +1591,37 @@ workflows: python_version: '3.8' requires: - nightly_binary_windows_conda_py3.8_upload + - binary_windows_conda: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_windows_conda_py3.9 + python_version: '3.9' + - binary_conda_upload: + context: org-member + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_windows_conda_py3.9_upload + requires: + - nightly_binary_windows_conda_py3.9 + - smoke_test_windows_conda: + filters: + branches: + only: + - nightly + tags: + only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/ + name: nightly_binary_windows_conda_py3.9_smoke_test_conda + python_version: '3.9' + requires: + - nightly_binary_windows_conda_py3.9_upload docker_build: triggers: - schedule: diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index 6aa6d9738f..d188fe4477 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -45,6 +45,16 @@ commands: name: Install cmake and pkg-config command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config wget # Disable brew auto update which is very slow + load_conda_channel_flags: + description: "Determines whether we need extra conda channels" + steps: + - run: + name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV + command: | + CONDA_CHANNEL_FLAGS="" + if [[ "${PYTHON_VERSION}" = *3.9* ]]; then + echo "export CONDA_CHANNEL_FLAGS=-c=conda-forge" >> ${BASH_ENV} + fi binary_common: &binary_common parameters: @@ -52,11 +62,11 @@ binary_common: &binary_common build_version: description: "version number of release binary; by default, build a nightly" type: string - default: "0.7.0" + default: "0.7.1" pytorch_version: description: "PyTorch version to build against; by default, use a nightly" type: string - default: "1.7.0" + default: "1.7.1" # Don't edit these python_version: description: "Python version to build against (e.g., 3.8)" @@ -117,7 +127,7 @@ jobs: binary_linux_wheel: <<: *binary_common docker: - - image: "pytorch/manylinux-cuda100" + - image: "pytorch/manylinux-cuda102" resource_class: 2xlarge+ steps: - checkout @@ -138,6 +148,7 @@ jobs: resource_class: 2xlarge+ steps: - checkout + - load_conda_channel_flags - attach_workspace: at: third_party - run: packaging/build_conda.sh @@ -155,6 +166,7 @@ jobs: steps: - checkout - install_build_tools_macos + - load_conda_channel_flags - attach_workspace: at: third_party - run: @@ -180,6 +192,7 @@ jobs: steps: - checkout - install_build_tools_macos + - load_conda_channel_flags - attach_workspace: at: third_party - run: @@ -202,6 +215,7 @@ jobs: name: windows-cpu steps: - checkout + - load_conda_channel_flags - run: name: build command: | @@ -221,6 +235,7 @@ jobs: name: windows-cpu steps: - checkout + - load_conda_channel_flags - run: name: build command: | @@ -278,6 +293,7 @@ jobs: - attach_workspace: at: ~/workspace - designate_upload_channel + - load_conda_channel_flags - run: name: install binaries command: | @@ -297,6 +313,7 @@ jobs: - attach_workspace: at: ~/workspace - designate_upload_channel + - load_conda_channel_flags - run: name: install binaries command: | @@ -317,6 +334,7 @@ jobs: - attach_workspace: at: ~/workspace - designate_upload_channel + - load_conda_channel_flags - run: name: install binaries command: | @@ -342,6 +360,7 @@ jobs: - attach_workspace: at: ~/workspace - designate_upload_channel + - load_conda_channel_flags - run: name: install binaries command: | @@ -395,6 +414,7 @@ jobs: - attach_workspace: at: third_party - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: {% raw %} @@ -438,6 +458,7 @@ jobs: - attach_workspace: at: third_party - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: {% raw %} @@ -476,6 +497,7 @@ jobs: steps: - checkout - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: {% raw %} @@ -513,6 +535,7 @@ jobs: steps: - checkout - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: {% raw %} @@ -549,6 +572,7 @@ jobs: steps: - checkout - install_build_tools_macos + - load_conda_channel_flags - attach_workspace: at: third_party - designate_upload_channel @@ -575,6 +599,7 @@ jobs: steps: - checkout - designate_upload_channel + - load_conda_channel_flags - generate_cache_key - restore_cache: {% raw %} @@ -605,6 +630,7 @@ jobs: steps: - checkout - generate_cache_key + - load_conda_channel_flags - restore_cache: {% raw %} keys: diff --git a/.circleci/regenerate.py b/.circleci/regenerate.py index 2c9fe7ee4f..85b01e6b72 100755 --- a/.circleci/regenerate.py +++ b/.circleci/regenerate.py @@ -19,7 +19,7 @@ import os.path -PYTHON_VERSIONS = ["3.6", "3.7", "3.8"] +PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] def build_workflows(prefix='', upload=False, filter_branch=None, indentation=6): diff --git a/.circleci/unittest/linux/scripts/install.sh b/.circleci/unittest/linux/scripts/install.sh index bde82ff9ee..75314fe4a7 100755 --- a/.circleci/unittest/linux/scripts/install.sh +++ b/.circleci/unittest/linux/scripts/install.sh @@ -20,10 +20,16 @@ else cudatoolkit="cudatoolkit=${version}" fi printf "Installing PyTorch with %s\n" "${cudatoolkit}" -conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch ${cudatoolkit} +conda install ${CONDA_CHANNEL_FLAGS:-} -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch ${cudatoolkit} printf "* Installing dependencies for test\n" -conda install -y -c conda-forge pytest pytest-cov codecov 'librosa>=0.8.0' scipy parameterized +CONDA_PKGS="librosa>=0.8.0" +# TODO: Remove this after packages become available +# Currently there's no librosa package available for Python 3.9, so lets just skip the dependency for now +if [[ $(python --version) = *3.9* ]]; then + CONDA_PKGS="pysoundfile" +fi +conda install -y -c conda-forge pytest pytest-cov codecov scipy parameterized ${CONDA_PKGS} pip install kaldi-io printf "* Building codecs\n" diff --git a/.circleci/unittest/windows/scripts/environment.yml b/.circleci/unittest/windows/scripts/environment.yml index 4a0b71d653..4fe8134d04 100644 --- a/.circleci/unittest/windows/scripts/environment.yml +++ b/.circleci/unittest/windows/scripts/environment.yml @@ -7,12 +7,11 @@ dependencies: - pytest - pytest-cov - codecov + - scipy >= 1.4.1 - pip - pip: - - scipy == 1.4.1 - kaldi-io - PySoundFile - - librosa >= 0.8.0 - future - parameterized - dataclasses diff --git a/.circleci/unittest/windows/scripts/install.sh b/.circleci/unittest/windows/scripts/install.sh index c294dc74a3..7b3b6b1ed9 100644 --- a/.circleci/unittest/windows/scripts/install.sh +++ b/.circleci/unittest/windows/scripts/install.sh @@ -17,7 +17,13 @@ else cudatoolkit="cudatoolkit=${version}" fi printf "Installing PyTorch with %s\n" "${cudatoolkit}" -conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}" +conda install ${CONDA_CHANNEL_FLAGS:-} -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch "${cudatoolkit}" + +# TODO: Remove this after packages become available +# Currently there's no librosa package available for Python 3.9, so lets just skip the dependency for now +if [[ $(python --version) != *3.9* ]]; then + pip install 'librosa>=0.8.0' +fi printf "* Installing torchaudio\n" python setup.py install diff --git a/packaging/pkg_helpers.bash b/packaging/pkg_helpers.bash index 57b23b93d3..24887f5806 100644 --- a/packaging/pkg_helpers.bash +++ b/packaging/pkg_helpers.bash @@ -140,6 +140,7 @@ setup_wheel_python() { 3.6) python_abi=cp36-cp36m ;; 3.7) python_abi=cp37-cp37m ;; 3.8) python_abi=cp38-cp38 ;; + 3.9) python_abi=cp39-cp39 ;; *) echo "Unrecognized PYTHON_VERSION=$PYTHON_VERSION" exit 1 @@ -181,11 +182,12 @@ setup_pip_pytorch_version() { # # You MUST have populated PYTORCH_VERSION_SUFFIX before hand. setup_conda_pytorch_constraint() { + CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS}" if [[ -z "$PYTORCH_VERSION" ]]; then - export CONDA_CHANNEL_FLAGS="-c pytorch-nightly" + export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch-nightly" export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | python -c "import sys, json, re; print(re.sub(r'\\+.*$', '', json.load(sys.stdin)['pytorch'][-1]['version']))")" else - export CONDA_CHANNEL_FLAGS="-c pytorch -c pytorch-test -c pytorch-nightly" + export CONDA_CHANNEL_FLAGS="${CONDA_CHANNEL_FLAGS} -c pytorch -c pytorch-test -c pytorch-nightly" fi if [[ "$CU_VERSION" == cpu ]]; then export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==$PYTORCH_VERSION${PYTORCH_VERSION_SUFFIX}" From 1ec49fe6ce565510736d6a613083e0565570315b Mon Sep 17 00:00:00 2001 From: Vincent QB Date: Thu, 3 Dec 2020 14:37:57 -0500 Subject: [PATCH 13/18] [Cherry-pick for 0.7.1] no longer download CommonVoice directly (#1065) no longer allow to download the dataset directly. deprecate: download and url. add language. --- .../datasets/utils_test.py | 4 +- torchaudio/datasets/commonvoice.py | 177 ++++++++++-------- 2 files changed, 97 insertions(+), 84 deletions(-) diff --git a/test/torchaudio_unittest/datasets/utils_test.py b/test/torchaudio_unittest/datasets/utils_test.py index f75ae2319c..a9e13a1e38 100644 --- a/test/torchaudio_unittest/datasets/utils_test.py +++ b/test/torchaudio_unittest/datasets/utils_test.py @@ -54,7 +54,7 @@ class TestIterator(TorchaudioTestCase): path = get_asset_path() def test_disckcache_iterator(self): - data = COMMONVOICE(self.path, url="tatar") + data = COMMONVOICE(self.path, version="cv-corpus-4-2019-12-10", language="tatar") data = dataset_utils.diskcache_iterator(data) # Save data[0] @@ -62,7 +62,7 @@ def test_disckcache_iterator(self): data[0] def test_bg_iterator(self): - data = COMMONVOICE(self.path, url="tatar") + data = COMMONVOICE(self.path, version="cv-corpus-4-2019-12-10", language="tatar") data = dataset_utils.bg_iterator(data, 5) for _ in data: pass diff --git a/torchaudio/datasets/commonvoice.py b/torchaudio/datasets/commonvoice.py index 825cf3e9ab..bf572d1638 100644 --- a/torchaudio/datasets/commonvoice.py +++ b/torchaudio/datasets/commonvoice.py @@ -1,8 +1,9 @@ import os -from typing import List, Dict, Tuple +import warnings +from typing import List, Dict, Tuple, Optional import torchaudio -from torchaudio.datasets.utils import download_url, extract_archive, unicode_csv_reader +from torchaudio.datasets.utils import extract_archive, unicode_csv_reader, validate_file from torch import Tensor from torch.utils.data import Dataset @@ -15,68 +16,39 @@ # validated.tsv FOLDER_IN_ARCHIVE = "CommonVoice" -URL = "english" -VERSION = "cv-corpus-4-2019-12-10" +LANGUAGE = "english" +VERSION = "cv-corpus-5.1-2020-06-22" TSV = "train.tsv" _CHECKSUMS = { - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/tt.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/en.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/de.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/fr.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/cy.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/br.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/cv.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/tr.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/ky.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/ga-IE.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/kab.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/ca.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/zh-TW.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/sl.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/it.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/nl.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/cnh.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/eo.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/et.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/fa.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/eu.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/es.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/zh-CN.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/mn.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/sah.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/dv.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/rw.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/sv-SE.tar.gz": - None, - "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/ru.tar.gz": - None + "cv-corpus-5.1-2020-06-22/tt.tar.gz": None, + "cv-corpus-5.1-2020-06-22/en.tar.gz": None, + "cv-corpus-5.1-2020-06-22/de.tar.gz": None, + "cv-corpus-5.1-2020-06-22/fr.tar.gz": None, + "cv-corpus-5.1-2020-06-22/cy.tar.gz": None, + "cv-corpus-5.1-2020-06-22/br.tar.gz": None, + "cv-corpus-5.1-2020-06-22/cv.tar.gz": None, + "cv-corpus-5.1-2020-06-22/tr.tar.gz": None, + "cv-corpus-5.1-2020-06-22/ky.tar.gz": None, + "cv-corpus-5.1-2020-06-22/ga-IE.tar.gz": None, + "cv-corpus-5.1-2020-06-22/kab.tar.gz": None, + "cv-corpus-5.1-2020-06-22/ca.tar.gz": None, + "cv-corpus-5.1-2020-06-22/zh-TW.tar.gz": None, + "cv-corpus-5.1-2020-06-22/sl.tar.gz": None, + "cv-corpus-5.1-2020-06-22/it.tar.gz": None, + "cv-corpus-5.1-2020-06-22/nl.tar.gz": None, + "cv-corpus-5.1-2020-06-22/cnh.tar.gz": None, + "cv-corpus-5.1-2020-06-22/eo.tar.gz": None, + "cv-corpus-5.1-2020-06-22/et.tar.gz": None, + "cv-corpus-5.1-2020-06-22/fa.tar.gz": None, + "cv-corpus-5.1-2020-06-22/eu.tar.gz": None, + "cv-corpus-5.1-2020-06-22/es.tar.gz": None, + "cv-corpus-5.1-2020-06-22/zh-CN.tar.gz": None, + "cv-corpus-5.1-2020-06-22/mn.tar.gz": None, + "cv-corpus-5.1-2020-06-22/sah.tar.gz": None, + "cv-corpus-5.1-2020-06-22/dv.tar.gz": None, + "cv-corpus-5.1-2020-06-22/rw.tar.gz": None, + "cv-corpus-5.1-2020-06-22/sv-SE.tar.gz": None, + "cv-corpus-5.1-2020-06-22/ru.tar.gz": None, } @@ -100,15 +72,18 @@ def load_commonvoice_item(line: List[str], class COMMONVOICE(Dataset): - """Create a Dataset for CommonVoice. + """Create a Dataset for `CommonVoice `_. Args: root (str): Path to the directory where the dataset is found or downloaded. tsv (str, optional): The name of the tsv file used to construct the metadata. (default: ``"train.tsv"``) - url (str, optional): The URL to download the dataset from, or the language of - the dataset to download. (default: ``"english"``). - Allowed language values are ``"tatar"``, ``"english"``, ``"german"``, + url (str, optional): Deprecated. + folder_in_archive (str, optional): The top-level directory of the dataset. + version (str): Version string. (default: ``"cv-corpus-5.1-2020-06-22"``) + language (str, optional): Language of the dataset. (default: None) + The following values are mapped to their corresponding shortened version: + ``"tatar"``, ``"english"``, ``"german"``, ``"french"``, ``"welsh"``, ``"breton"``, ``"chuvash"``, ``"turkish"``, ``"kyrgyz"``, ``"irish"``, ``"kabyle"``, ``"catalan"``, ``"taiwanese"``, ``"slovenian"``, ``"italian"``, ``"dutch"``, ``"hakha chin"``, ``"esperanto"``, ``"estonian"``, @@ -117,11 +92,8 @@ class COMMONVOICE(Dataset): ``"russian"``, ``"indonesian"``, ``"arabic"``, ``"tamil"``, ``"interlingua"``, ``"latvian"``, ``"japanese"``, ``"votic"``, ``"abkhaz"``, ``"cantonese"`` and ``"romansh sursilvan"``. - folder_in_archive (str, optional): The top-level directory of the dataset. - version (str): Version string. (default: ``"cv-corpus-4-2019-12-10"``) For the other allowed values, Please checkout https://commonvoice.mozilla.org/en/datasets. - download (bool, optional): - Whether to download the dataset if it is not found at root path. (default: ``False``). + download (bool, optional): Deprecated. """ _ext_txt = ".txt" @@ -131,10 +103,30 @@ class COMMONVOICE(Dataset): def __init__(self, root: str, tsv: str = TSV, - url: str = URL, + url: Optional[str] = None, folder_in_archive: str = FOLDER_IN_ARCHIVE, version: str = VERSION, - download: bool = False) -> None: + language: str = LANGUAGE, + download: Optional[bool] = False) -> None: + + if download is True: + raise RuntimeError( + "The dataset is no longer publicly accessible. You need to " + "download the archives externally and place them in the root " + "directory." + ) + elif download is False: + warnings.warn( + "The use of the download flag is deprecated, since the dataset " + "is no longer directly accessible.", RuntimeWarning + ) + + if url is not None: + warnings.warn( + "The use of the url flag is deprecated, since the dataset " + "is no longer publicly accessible. To specify the language of the dataset, " + "please use the language parameter instead.", RuntimeWarning + ) languages = { "tatar": "tt", @@ -179,12 +171,22 @@ def __init__(self, "romansh sursilvan": "rm-sursilv" } - if url in languages: + if language in languages: ext_archive = ".tar.gz" - language = languages[url] - - base_url = "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com" - url = os.path.join(base_url, version, language + ext_archive) + language = languages[language] + url = os.path.join(version, language + ext_archive) + else: + raise ValueError( + 'Allowed language values are ``"tatar"``, ``"english"``, ``"german"``,' + '``"french"``, ``"welsh"``, ``"breton"``, ``"chuvash"``, ``"turkish"``, ``"kyrgyz"``,' + '``"irish"``, ``"kabyle"``, ``"catalan"``, ``"taiwanese"``, ``"slovenian"``,' + '``"italian"``, ``"dutch"``, ``"hakha chin"``, ``"esperanto"``, ``"estonian"``,' + '``"persian"``, ``"portuguese"``, ``"basque"``, ``"spanish"``, ``"chinese"``,' + '``"mongolian"``, ``"sakha"``, ``"dhivehi"``, ``"kinyarwanda"``, ``"swedish"``,' + '``"russian"``, ``"indonesian"``, ``"arabic"``, ``"tamil"``, ``"interlingua"``,' + '``"latvian"``, ``"japanese"``, ``"votic"``, ``"abkhaz"``, ``"cantonese"`` and' + '``"romansh sursilvan"``.' + ) basename = os.path.basename(url) archive = os.path.join(root, basename) @@ -194,12 +196,23 @@ def __init__(self, self._path = os.path.join(root, folder_in_archive) - if download: - if not os.path.isdir(self._path): - if not os.path.isfile(archive): - checksum = _CHECKSUMS.get(url, None) - download_url(url, root, hash_value=checksum) + if not os.path.isdir(self._path): + if os.path.isfile(archive): + checksum = _CHECKSUMS.get(url, None) + if checksum: + filepath = os.path.basename(url) + with open(filepath, "rb") as file_obj: + if not validate_file(file_obj, checksum, "sha256"): + raise RuntimeError( + f"The hash of {filepath} does not match. Delete the file manually and retry." + ) extract_archive(archive) + else: + raise RuntimeError( + "The dataset is no longer publicly accessible. You need to " + "download the archives externally and place them in the root " + "directory." + ) self._tsv = os.path.join(root, folder_in_archive, tsv) From 7ff61fdcc8cc4b800e754e9b9b892d61690a0fcc Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Mon, 7 Dec 2020 10:46:16 -0500 Subject: [PATCH 14/18] Update documentation (#1067) * bump version to 0.7.1 * Checkout changes from the latest --- docs/source/conf.py | 4 +- docs/source/datasets.rst | 2 +- docs/source/functional.rst | 200 +++++++++++++++++++++---------------- 3 files changed, 116 insertions(+), 90 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 9a7b31b47a..b91994c3d0 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -82,10 +82,10 @@ # # The short X.Y version. # TODO: change to [:2] at v1.0 -version = '0.7.0' +version = '0.7.1' # The full version, including alpha/beta/rc tags. # TODO: verify this works as expected -release = '0.7.0' +release = '0.7.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/datasets.rst b/docs/source/datasets.rst index 2ceb93a440..2fbb2c7929 100644 --- a/docs/source/datasets.rst +++ b/docs/source/datasets.rst @@ -2,7 +2,7 @@ torchaudio.datasets ==================== All datasets are subclasses of :class:`torch.utils.data.Dataset` -i.e, they have ``__getitem__`` and ``__len__`` methods implemented. +and have ``__getitem__`` and ``__len__`` methods implemented. Hence, they can all be passed to a :class:`torch.utils.data.DataLoader` which can load multiple samples parallelly using ``torch.multiprocessing`` workers. For example: :: diff --git a/docs/source/functional.rst b/docs/source/functional.rst index 89e992bb89..ebed60de6b 100644 --- a/docs/source/functional.rst +++ b/docs/source/functional.rst @@ -8,145 +8,176 @@ torchaudio.functional Functions to perform common audio operations. -:hidden:`spectrogram` -~~~~~~~~~~~~~~~~~~~~~ +:hidden:`Filtering` +~~~~~~~~~~~~~~~~~~~ -.. autofunction:: spectrogram -:hidden:`amplitude_to_DB` -~~~~~~~~~~~~~~~~~~~~~~~~~ +allpass_biquad +-------------- -.. autofunction:: amplitude_to_DB +.. autofunction:: allpass_biquad -:hidden:`create_fb_matrix` -~~~~~~~~~~~~~~~~~~~~~~~~~~ +band_biquad +----------- -.. autofunction:: create_fb_matrix +.. autofunction:: band_biquad -:hidden:`create_dct` -~~~~~~~~~~~~~~~~~~~~ +bandpass_biquad +--------------- -.. autofunction:: create_dct +.. autofunction:: bandpass_biquad -:hidden:`mu_law_encoding` -~~~~~~~~~~~~~~~~~~~~~~~~~ +bandreject_biquad +----------------- -.. autofunction:: mu_law_encoding +.. autofunction:: bandreject_biquad -:hidden:`mu_law_decoding` -~~~~~~~~~~~~~~~~~~~~~~~~~ +bass_biquad +----------- -.. autofunction:: mu_law_decoding +.. autofunction:: bass_biquad -:hidden:`complex_norm` -~~~~~~~~~~~~~~~~~~~~~~ +biquad +------ -.. autofunction:: complex_norm +.. autofunction:: biquad -:hidden:`angle` -~~~~~~~~~~~~~~~ +contrast +-------- -.. autofunction:: angle +.. autofunction:: contrast -:hidden:`magphase` -~~~~~~~~~~~~~~~~~~ +dcshift +------- -.. autofunction:: magphase +.. autofunction:: dcshift -:hidden:`phase_vocoder` -~~~~~~~~~~~~~~~~~~~~~~~ +deemph_biquad +------------- -.. autofunction:: phase_vocoder +.. autofunction:: deemph_biquad -:hidden:`lfilter` -~~~~~~~~~~~~~~~~~ -.. autofunction:: lfilter +dither +------ -:hidden:`biquad` -~~~~~~~~~~~~~~~~ +.. autofunction:: dither -.. autofunction:: biquad +equalizer_biquad +---------------- -:hidden:`lowpass_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: equalizer_biquad -.. autofunction:: lowpass_biquad +flanger +------- -:hidden:`highpass_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: flanger + +gain +---- + +.. autofunction:: gain + +highpass_biquad +--------------- .. autofunction:: highpass_biquad -:hidden:`allpass_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~ +lfilter +------- -.. autofunction:: allpass_biquad +.. autofunction:: lfilter -:hidden:`equalizer_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~~ +lowpass_biquad +-------------- -.. autofunction:: equalizer_biquad +.. autofunction:: lowpass_biquad -:hidden:`bandpass_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +overdrive +--------- -.. autofunction:: bandpass_biquad +.. autofunction:: overdrive -:hidden:`bandreject_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +phaser +------ -.. autofunction:: bandreject_biquad +.. autofunction:: phaser -:hidden:`band_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +riaa_biquad +----------- -.. autofunction:: band_biquad +.. autofunction:: riaa_biquad -:hidden:`treble_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +treble_biquad +------------- .. autofunction:: treble_biquad -:hidden:`bass_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autofunction:: bass_biquad +vad +--- -:hidden:`deemph_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: vad -.. autofunction:: deemph_biquad +:hidden:`spectrogram` +~~~~~~~~~~~~~~~~~~~~~ -:hidden:`riaa_biquad` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: spectrogram -.. autofunction:: riaa_biquad +:hidden:`griffinlim` +~~~~~~~~~~~~~~~~~~~~~~~~~ -:hidden:`contrast` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: griffinlim -.. autofunction:: contrast +:hidden:`amplitude_to_DB` +~~~~~~~~~~~~~~~~~~~~~~~~~ -:hidden:`dcshift` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: amplitude_to_DB -.. autofunction:: dcshift +:hidden:`DB_to_amplitude` +~~~~~~~~~~~~~~~~~~~~~~~~~ -:hidden:`overdrive` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: DB_to_amplitude -.. autofunction:: overdrive +:hidden:`create_fb_matrix` +~~~~~~~~~~~~~~~~~~~~~~~~~~ -:hidden:`phaser` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: create_fb_matrix -.. autofunction:: phaser +:hidden:`create_dct` +~~~~~~~~~~~~~~~~~~~~ -:hidden:`flanger` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. autofunction:: create_dct -.. autofunction:: flanger +:hidden:`mu_law_encoding` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autofunction:: mu_law_encoding + +:hidden:`mu_law_decoding` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autofunction:: mu_law_decoding + +:hidden:`complex_norm` +~~~~~~~~~~~~~~~~~~~~~~ + +.. autofunction:: complex_norm + +:hidden:`angle` +~~~~~~~~~~~~~~~ + +.. autofunction:: angle + +:hidden:`magphase` +~~~~~~~~~~~~~~~~~~ + +.. autofunction:: magphase + +:hidden:`phase_vocoder` +~~~~~~~~~~~~~~~~~~~~~~~ + +.. autofunction:: phase_vocoder :hidden:`mask_along_axis` ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -172,8 +203,3 @@ Functions to perform common audio operations. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. autofunction:: sliding_window_cmn - -:hidden:`vad` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. autofunction:: vad From 27f2089c2c2ff9f7e6efcc4f5df6dea53da5a46e Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Tue, 8 Dec 2020 14:28:10 -0500 Subject: [PATCH 15/18] Hard code package channel for release branch (#1074) --- .circleci/config.yml | 8 ++------ .circleci/config.yml.in | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index de7154fe38..4d4b98365c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,12 +32,8 @@ commands: - run: name: adding UPLOAD_CHANNEL to BASH_ENV command: | - our_upload_channel=nightly - # On tags upload to test instead - if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then - our_upload_channel=test - fi - echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} + # Hardcoded for release branch + echo "export UPLOAD_CHANNEL=test" >> ${BASH_ENV} install_build_tools_macos: description: "installs tools required to build torchaudio" steps: diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index d188fe4477..a9275a8122 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -32,12 +32,8 @@ commands: - run: name: adding UPLOAD_CHANNEL to BASH_ENV command: | - our_upload_channel=nightly - # On tags upload to test instead - if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then - our_upload_channel=test - fi - echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV} + # Hardcoded for release branch + echo "export UPLOAD_CHANNEL=test" >> ${BASH_ENV} install_build_tools_macos: description: "installs tools required to build torchaudio" steps: From fa6e140d806b0b5c8dd857e17d3100b3677a31e7 Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Tue, 8 Dec 2020 14:28:45 -0500 Subject: [PATCH 16/18] Revert "[Cherry-pick for 0.7.1] no longer download CommonVoice directly (#1065)" (#1075) This reverts commit 1ec49fe6ce565510736d6a613083e0565570315b. --- .../datasets/utils_test.py | 4 +- torchaudio/datasets/commonvoice.py | 177 ++++++++---------- 2 files changed, 84 insertions(+), 97 deletions(-) diff --git a/test/torchaudio_unittest/datasets/utils_test.py b/test/torchaudio_unittest/datasets/utils_test.py index a9e13a1e38..f75ae2319c 100644 --- a/test/torchaudio_unittest/datasets/utils_test.py +++ b/test/torchaudio_unittest/datasets/utils_test.py @@ -54,7 +54,7 @@ class TestIterator(TorchaudioTestCase): path = get_asset_path() def test_disckcache_iterator(self): - data = COMMONVOICE(self.path, version="cv-corpus-4-2019-12-10", language="tatar") + data = COMMONVOICE(self.path, url="tatar") data = dataset_utils.diskcache_iterator(data) # Save data[0] @@ -62,7 +62,7 @@ def test_disckcache_iterator(self): data[0] def test_bg_iterator(self): - data = COMMONVOICE(self.path, version="cv-corpus-4-2019-12-10", language="tatar") + data = COMMONVOICE(self.path, url="tatar") data = dataset_utils.bg_iterator(data, 5) for _ in data: pass diff --git a/torchaudio/datasets/commonvoice.py b/torchaudio/datasets/commonvoice.py index bf572d1638..825cf3e9ab 100644 --- a/torchaudio/datasets/commonvoice.py +++ b/torchaudio/datasets/commonvoice.py @@ -1,9 +1,8 @@ import os -import warnings -from typing import List, Dict, Tuple, Optional +from typing import List, Dict, Tuple import torchaudio -from torchaudio.datasets.utils import extract_archive, unicode_csv_reader, validate_file +from torchaudio.datasets.utils import download_url, extract_archive, unicode_csv_reader from torch import Tensor from torch.utils.data import Dataset @@ -16,39 +15,68 @@ # validated.tsv FOLDER_IN_ARCHIVE = "CommonVoice" -LANGUAGE = "english" -VERSION = "cv-corpus-5.1-2020-06-22" +URL = "english" +VERSION = "cv-corpus-4-2019-12-10" TSV = "train.tsv" _CHECKSUMS = { - "cv-corpus-5.1-2020-06-22/tt.tar.gz": None, - "cv-corpus-5.1-2020-06-22/en.tar.gz": None, - "cv-corpus-5.1-2020-06-22/de.tar.gz": None, - "cv-corpus-5.1-2020-06-22/fr.tar.gz": None, - "cv-corpus-5.1-2020-06-22/cy.tar.gz": None, - "cv-corpus-5.1-2020-06-22/br.tar.gz": None, - "cv-corpus-5.1-2020-06-22/cv.tar.gz": None, - "cv-corpus-5.1-2020-06-22/tr.tar.gz": None, - "cv-corpus-5.1-2020-06-22/ky.tar.gz": None, - "cv-corpus-5.1-2020-06-22/ga-IE.tar.gz": None, - "cv-corpus-5.1-2020-06-22/kab.tar.gz": None, - "cv-corpus-5.1-2020-06-22/ca.tar.gz": None, - "cv-corpus-5.1-2020-06-22/zh-TW.tar.gz": None, - "cv-corpus-5.1-2020-06-22/sl.tar.gz": None, - "cv-corpus-5.1-2020-06-22/it.tar.gz": None, - "cv-corpus-5.1-2020-06-22/nl.tar.gz": None, - "cv-corpus-5.1-2020-06-22/cnh.tar.gz": None, - "cv-corpus-5.1-2020-06-22/eo.tar.gz": None, - "cv-corpus-5.1-2020-06-22/et.tar.gz": None, - "cv-corpus-5.1-2020-06-22/fa.tar.gz": None, - "cv-corpus-5.1-2020-06-22/eu.tar.gz": None, - "cv-corpus-5.1-2020-06-22/es.tar.gz": None, - "cv-corpus-5.1-2020-06-22/zh-CN.tar.gz": None, - "cv-corpus-5.1-2020-06-22/mn.tar.gz": None, - "cv-corpus-5.1-2020-06-22/sah.tar.gz": None, - "cv-corpus-5.1-2020-06-22/dv.tar.gz": None, - "cv-corpus-5.1-2020-06-22/rw.tar.gz": None, - "cv-corpus-5.1-2020-06-22/sv-SE.tar.gz": None, - "cv-corpus-5.1-2020-06-22/ru.tar.gz": None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/tt.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/en.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/de.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/fr.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/cy.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/br.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/cv.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/tr.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/ky.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/ga-IE.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/kab.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/ca.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/zh-TW.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/sl.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/it.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/nl.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/cnh.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/eo.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/et.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/fa.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/eu.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/es.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/zh-CN.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/mn.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/sah.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/dv.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/rw.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/sv-SE.tar.gz": + None, + "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com/cv-corpus-3/ru.tar.gz": + None } @@ -72,18 +100,15 @@ def load_commonvoice_item(line: List[str], class COMMONVOICE(Dataset): - """Create a Dataset for `CommonVoice `_. + """Create a Dataset for CommonVoice. Args: root (str): Path to the directory where the dataset is found or downloaded. tsv (str, optional): The name of the tsv file used to construct the metadata. (default: ``"train.tsv"``) - url (str, optional): Deprecated. - folder_in_archive (str, optional): The top-level directory of the dataset. - version (str): Version string. (default: ``"cv-corpus-5.1-2020-06-22"``) - language (str, optional): Language of the dataset. (default: None) - The following values are mapped to their corresponding shortened version: - ``"tatar"``, ``"english"``, ``"german"``, + url (str, optional): The URL to download the dataset from, or the language of + the dataset to download. (default: ``"english"``). + Allowed language values are ``"tatar"``, ``"english"``, ``"german"``, ``"french"``, ``"welsh"``, ``"breton"``, ``"chuvash"``, ``"turkish"``, ``"kyrgyz"``, ``"irish"``, ``"kabyle"``, ``"catalan"``, ``"taiwanese"``, ``"slovenian"``, ``"italian"``, ``"dutch"``, ``"hakha chin"``, ``"esperanto"``, ``"estonian"``, @@ -92,8 +117,11 @@ class COMMONVOICE(Dataset): ``"russian"``, ``"indonesian"``, ``"arabic"``, ``"tamil"``, ``"interlingua"``, ``"latvian"``, ``"japanese"``, ``"votic"``, ``"abkhaz"``, ``"cantonese"`` and ``"romansh sursilvan"``. + folder_in_archive (str, optional): The top-level directory of the dataset. + version (str): Version string. (default: ``"cv-corpus-4-2019-12-10"``) For the other allowed values, Please checkout https://commonvoice.mozilla.org/en/datasets. - download (bool, optional): Deprecated. + download (bool, optional): + Whether to download the dataset if it is not found at root path. (default: ``False``). """ _ext_txt = ".txt" @@ -103,30 +131,10 @@ class COMMONVOICE(Dataset): def __init__(self, root: str, tsv: str = TSV, - url: Optional[str] = None, + url: str = URL, folder_in_archive: str = FOLDER_IN_ARCHIVE, version: str = VERSION, - language: str = LANGUAGE, - download: Optional[bool] = False) -> None: - - if download is True: - raise RuntimeError( - "The dataset is no longer publicly accessible. You need to " - "download the archives externally and place them in the root " - "directory." - ) - elif download is False: - warnings.warn( - "The use of the download flag is deprecated, since the dataset " - "is no longer directly accessible.", RuntimeWarning - ) - - if url is not None: - warnings.warn( - "The use of the url flag is deprecated, since the dataset " - "is no longer publicly accessible. To specify the language of the dataset, " - "please use the language parameter instead.", RuntimeWarning - ) + download: bool = False) -> None: languages = { "tatar": "tt", @@ -171,22 +179,12 @@ def __init__(self, "romansh sursilvan": "rm-sursilv" } - if language in languages: + if url in languages: ext_archive = ".tar.gz" - language = languages[language] - url = os.path.join(version, language + ext_archive) - else: - raise ValueError( - 'Allowed language values are ``"tatar"``, ``"english"``, ``"german"``,' - '``"french"``, ``"welsh"``, ``"breton"``, ``"chuvash"``, ``"turkish"``, ``"kyrgyz"``,' - '``"irish"``, ``"kabyle"``, ``"catalan"``, ``"taiwanese"``, ``"slovenian"``,' - '``"italian"``, ``"dutch"``, ``"hakha chin"``, ``"esperanto"``, ``"estonian"``,' - '``"persian"``, ``"portuguese"``, ``"basque"``, ``"spanish"``, ``"chinese"``,' - '``"mongolian"``, ``"sakha"``, ``"dhivehi"``, ``"kinyarwanda"``, ``"swedish"``,' - '``"russian"``, ``"indonesian"``, ``"arabic"``, ``"tamil"``, ``"interlingua"``,' - '``"latvian"``, ``"japanese"``, ``"votic"``, ``"abkhaz"``, ``"cantonese"`` and' - '``"romansh sursilvan"``.' - ) + language = languages[url] + + base_url = "https://voice-prod-bundler-ee1969a6ce8178826482b88e843c335139bd3fb4.s3.amazonaws.com" + url = os.path.join(base_url, version, language + ext_archive) basename = os.path.basename(url) archive = os.path.join(root, basename) @@ -196,23 +194,12 @@ def __init__(self, self._path = os.path.join(root, folder_in_archive) - if not os.path.isdir(self._path): - if os.path.isfile(archive): - checksum = _CHECKSUMS.get(url, None) - if checksum: - filepath = os.path.basename(url) - with open(filepath, "rb") as file_obj: - if not validate_file(file_obj, checksum, "sha256"): - raise RuntimeError( - f"The hash of {filepath} does not match. Delete the file manually and retry." - ) + if download: + if not os.path.isdir(self._path): + if not os.path.isfile(archive): + checksum = _CHECKSUMS.get(url, None) + download_url(url, root, hash_value=checksum) extract_archive(archive) - else: - raise RuntimeError( - "The dataset is no longer publicly accessible. You need to " - "download the archives externally and place them in the root " - "directory." - ) self._tsv = os.path.join(root, folder_in_archive, tsv) From cb6de823fc4ad07447665c7991451ba3045ff9c5 Mon Sep 17 00:00:00 2001 From: moto <855818+mthrok@users.noreply.github.com> Date: Wed, 9 Dec 2020 10:32:00 -0500 Subject: [PATCH 17/18] [0.7.1] Disallow download=True in CommonVoice (#1076) --- torchaudio/datasets/commonvoice.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/torchaudio/datasets/commonvoice.py b/torchaudio/datasets/commonvoice.py index 825cf3e9ab..5b92d9bf21 100644 --- a/torchaudio/datasets/commonvoice.py +++ b/torchaudio/datasets/commonvoice.py @@ -179,6 +179,15 @@ def __init__(self, "romansh sursilvan": "rm-sursilv" } + if download: + raise RuntimeError( + "Common Voice dataset requires user agreement on the usage term, " + "and torchaudio no longer provides the download feature. " + "Please download the dataset manually and extract it in the root directory, " + "then provide the target language to `url` argument.") + if url not in languages: + raise ValueError(f"`url` must be one of available languages: {languages.keys()}") + if url in languages: ext_archive = ".tar.gz" language = languages[url] From a853dff25de36cc637b1f02029343790d2dd0199 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Thu, 10 Dec 2020 08:33:53 -0800 Subject: [PATCH 18/18] bump to 0.7.2 Signed-off-by: Eli Uriegas --- .circleci/config.yml | 2 +- .circleci/config.yml.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d4b98365c..a4adf356cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,7 +58,7 @@ binary_common: &binary_common build_version: description: "version number of release binary; by default, build a nightly" type: string - default: "0.7.1" + default: "0.7.2" pytorch_version: description: "PyTorch version to build against; by default, use a nightly" type: string diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index a9275a8122..7b00a7fbcd 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -58,7 +58,7 @@ binary_common: &binary_common build_version: description: "version number of release binary; by default, build a nightly" type: string - default: "0.7.1" + default: "0.7.2" pytorch_version: description: "PyTorch version to build against; by default, use a nightly" type: string