Skip to content

Commit

Permalink
Merge recent changes in master into release branch (#799)
Browse files Browse the repository at this point in the history
Co-authored-by: bongjin.lee <bongjin.lee@navercorp.com>
Co-authored-by: Vincent QB <vincentqb@users.noreply.github.com>
Co-authored-by: Ji Chen <jimchen90@devfair0160.h2.fair>
Co-authored-by: moto <855818+mthrok@users.noreply.github.com>
Co-authored-by: Eli Uriegas <1700823+seemethere@users.noreply.github.com>
Co-authored-by: lbjcom <lbjcom@gmail.com>
Co-authored-by: jimchen90 <65626796+jimchen90@users.noreply.github.com>
Co-authored-by: Artyom Astafurov <asta@fb.com>
Co-authored-by: engineerchuan <engineerchuan@gmail.com>
  • Loading branch information
9 people committed Jul 20, 2020
1 parent 56aa954 commit f17ae39
Show file tree
Hide file tree
Showing 55 changed files with 2,809 additions and 1,037 deletions.
58 changes: 57 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ commands:
steps:
- run:
name: Install cmake and pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config wget
# Disable brew auto update which is very slow

binary_common: &binary_common
Expand Down Expand Up @@ -533,6 +533,47 @@ jobs:
- store_test_results:
path: test-results

unittest_macos_cpu:
<<: *binary_common
macos:
xcode: "9.0"
resource_class: large
steps:
- checkout
- install_build_tools_macos
- attach_workspace:
at: third_party
- 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
- run:
name: Run tests
command: .circleci/unittest/linux/scripts/run_test.sh
- run:
name: Post process
command: .circleci/unittest/linux/scripts/post_process.sh
- store_test_results:
path: test-results

stylecheck:
<<: *binary_common
docker:
Expand Down Expand Up @@ -744,6 +785,21 @@ workflows:
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
name: unittest_windows_gpu_py3.8
python_version: '3.8'
- unittest_macos_cpu:
name: unittest_macos_cpu_py3.6
python_version: '3.6'
requires:
- download_third_parties_nix
- unittest_macos_cpu:
name: unittest_macos_cpu_py3.7
python_version: '3.7'
requires:
- download_third_parties_nix
- unittest_macos_cpu:
name: unittest_macos_cpu_py3.8
python_version: '3.8'
requires:
- download_third_parties_nix
nightly:
jobs:
- circleci_consistency:
Expand Down
43 changes: 42 additions & 1 deletion .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ commands:
steps:
- run:
name: Install cmake and pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config wget
# Disable brew auto update which is very slow

binary_common: &binary_common
Expand Down Expand Up @@ -533,6 +533,47 @@ jobs:
- store_test_results:
path: test-results

unittest_macos_cpu:
<<: *binary_common
macos:
xcode: "9.0"
resource_class: large
steps:
- checkout
- install_build_tools_macos
- attach_workspace:
at: third_party
- 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
- run:
name: Run tests
command: .circleci/unittest/linux/scripts/run_test.sh
- run:
name: Post process
command: .circleci/unittest/linux/scripts/post_process.sh
- store_test_results:
path: test-results

stylecheck:
<<: *binary_common
docker:
Expand Down
5 changes: 4 additions & 1 deletion .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ def indent(indentation, data_list):
def unittest_workflows(indentation=6):
jobs = []
jobs += build_download_job(None)
for os_type in ["linux", "windows"]:
for os_type in ["linux", "windows", "macos"]:
for device_type in ["cpu", "gpu"]:
if os_type == "macos" and device_type == "gpu":
continue

for i, python_version in enumerate(PYTHON_VERSIONS):
job = {
"name": f"unittest_{os_type}_{device_type}_py{python_version}",
Expand Down
4 changes: 2 additions & 2 deletions .circleci/unittest/linux/scripts/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ dependencies:
- pytest-cov
- codecov
- librosa
- llvmlite==0.31 # See https://github.com/pytorch/audio/pull/766
- pip
- pip:
- clang-format
- kaldi-io
- scipy
- parameterized
- numba==0.48
- numba==0.48 # See https://github.com/librosa/librosa/issues/1160
10 changes: 9 additions & 1 deletion .circleci/unittest/linux/scripts/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ env_dir="${root_dir}/env"

cd "${root_dir}"

case "$(uname -s)" in
Darwin*) os=MacOSX;;
*) os=Linux
esac

# 1. Install conda at ./conda
if [ ! -d "${conda_dir}" ]; then
printf "* Installing conda\n"
wget -O miniconda.sh http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh"
bash ./miniconda.sh -b -f -p "${conda_dir}"
fi
eval "$(${conda_dir}/bin/conda shell.bash hook)"
Expand All @@ -32,6 +37,9 @@ 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
Expand Down
1 change: 1 addition & 0 deletions .github/pytorch-probot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tracking_issue: 736
52 changes: 52 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,58 @@ The following test modules are defined for corresponding `torchaudio` module/fun
- [assets/kaldi](./assets/kaldi): Contains Kaldi format matrix files used in [./test_compliance_kaldi.py](./test_compliance_kaldi.py).
- [compliance](./compliance): Scripts used to generate above Kaldi matrix files.

### Waveforms for Testing Purposes

When testing transforms we often need waveforms of specific type (ex: pure tone, noise, or voice), with specific bitrate (ex. 8 or 16 kHz) and number of channels (ex. mono, stereo). Below are some tips on how to construct waveforms and guidance around existing audio files.

#### Load a Waveform from a File

```python
filepath = common_utils.get_asset_path('filename.wav')
waveform, sample_rate = common_utils.load_wav(filepath)
```

*Note: Should you choose to contribute an audio file, please leave a comment in the issue or pull request, mentioning content source and licensing information. WAV files are preferred. Other formats should be used only when there is no alternative. (i.e. dataset implementation comes with hardcoded non-wav extension).*

#### Pure Tone

Code:

```python
waveform = common_utils.get_sinusoid(
frequency=300,
sample_rate=16000,
duration=1, # seconds
n_channels=1,
dtype="float32",
device="cpu",
)
```

#### Noise

Code:

```python
tensor = common_utils.get_whitenoise()
```

Files:

* `steam-train-whistle-daniel_simon.wav`

#### Voice

Files:

* `CommonVoice/cv-corpus-4-2019-12-10/tt/clips/common_voice_tt_00000000.wav`
* `LibriSpeech/dev-clean/1272/128104/1272-128104-0000.flac`
* `LJSpeech-1.1/wavs/LJ001-0001.wav`
* `SpeechCommands/speech_commands_v0.02/go/0a9f9af7_nohash_0.wav`
* `VCTK-Corpus/wav48/p224/p224_002.wav`
* `waves_yesno/0_1_0_1_0_1_1_0.wav`
* `vad-go-stereo-44100.wav`
* `vad-go-mono-32000.wav`

## Adding test

Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions test/assets/CommonVoice/cv-corpus-4-2019-12-10/tt/train.tsv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
client_id path sentence up_votes down_votes age gender accent
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 common_voice_tt_00000000.mp3 test. 1 0 thirties female
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 common_voice_tt_00000000.mp3 test. 1 0 thirties female
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 common_voice_tt_00000000.wav test. 1 0 thirties female
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 common_voice_tt_00000000.wav test. 1 0 thirties female
Binary file removed test/assets/dtmf_30s_stereo.mp3
Binary file not shown.

0 comments on commit f17ae39

Please sign in to comment.