Skip to content

Commit f17ae39

Browse files
vincentqbbongjin.leeJi Chenmthrokseemethere
authored
Merge recent changes in master into release branch (#799)
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>
1 parent 56aa954 commit f17ae39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2809
-1037
lines changed

.circleci/config.yml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ commands:
4343
steps:
4444
- run:
4545
name: Install cmake and pkg-config
46-
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config
46+
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config wget
4747
# Disable brew auto update which is very slow
4848

4949
binary_common: &binary_common
@@ -533,6 +533,47 @@ jobs:
533533
- store_test_results:
534534
path: test-results
535535

536+
unittest_macos_cpu:
537+
<<: *binary_common
538+
macos:
539+
xcode: "9.0"
540+
resource_class: large
541+
steps:
542+
- checkout
543+
- install_build_tools_macos
544+
- attach_workspace:
545+
at: third_party
546+
- generate_cache_key
547+
- restore_cache:
548+
549+
keys:
550+
- env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}
551+
552+
- run:
553+
name: Setup
554+
command: .circleci/unittest/linux/scripts/setup_env.sh
555+
- save_cache:
556+
557+
key: env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}
558+
559+
paths:
560+
- conda
561+
- env
562+
- third_party/build
563+
- third_party/install
564+
- third_party/src
565+
- run:
566+
name: Install torchaudio
567+
command: .circleci/unittest/linux/scripts/install.sh
568+
- run:
569+
name: Run tests
570+
command: .circleci/unittest/linux/scripts/run_test.sh
571+
- run:
572+
name: Post process
573+
command: .circleci/unittest/linux/scripts/post_process.sh
574+
- store_test_results:
575+
path: test-results
576+
536577
stylecheck:
537578
<<: *binary_common
538579
docker:
@@ -744,6 +785,21 @@ workflows:
744785
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
745786
name: unittest_windows_gpu_py3.8
746787
python_version: '3.8'
788+
- unittest_macos_cpu:
789+
name: unittest_macos_cpu_py3.6
790+
python_version: '3.6'
791+
requires:
792+
- download_third_parties_nix
793+
- unittest_macos_cpu:
794+
name: unittest_macos_cpu_py3.7
795+
python_version: '3.7'
796+
requires:
797+
- download_third_parties_nix
798+
- unittest_macos_cpu:
799+
name: unittest_macos_cpu_py3.8
800+
python_version: '3.8'
801+
requires:
802+
- download_third_parties_nix
747803
nightly:
748804
jobs:
749805
- circleci_consistency:

.circleci/config.yml.in

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ commands:
4343
steps:
4444
- run:
4545
name: Install cmake and pkg-config
46-
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config
46+
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake pkg-config wget
4747
# Disable brew auto update which is very slow
4848

4949
binary_common: &binary_common
@@ -533,6 +533,47 @@ jobs:
533533
- store_test_results:
534534
path: test-results
535535

536+
unittest_macos_cpu:
537+
<<: *binary_common
538+
macos:
539+
xcode: "9.0"
540+
resource_class: large
541+
steps:
542+
- checkout
543+
- install_build_tools_macos
544+
- attach_workspace:
545+
at: third_party
546+
- generate_cache_key
547+
- restore_cache:
548+
{% raw %}
549+
keys:
550+
- env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}
551+
{% endraw %}
552+
- run:
553+
name: Setup
554+
command: .circleci/unittest/linux/scripts/setup_env.sh
555+
- save_cache:
556+
{% raw %}
557+
key: env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum "third_party/CMakeLists.txt" }}-{{ checksum ".cachekey" }}
558+
{% endraw %}
559+
paths:
560+
- conda
561+
- env
562+
- third_party/build
563+
- third_party/install
564+
- third_party/src
565+
- run:
566+
name: Install torchaudio
567+
command: .circleci/unittest/linux/scripts/install.sh
568+
- run:
569+
name: Run tests
570+
command: .circleci/unittest/linux/scripts/run_test.sh
571+
- run:
572+
name: Post process
573+
command: .circleci/unittest/linux/scripts/post_process.sh
574+
- store_test_results:
575+
path: test-results
576+
536577
stylecheck:
537578
<<: *binary_common
538579
docker:

.circleci/regenerate.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,11 @@ def indent(indentation, data_list):
136136
def unittest_workflows(indentation=6):
137137
jobs = []
138138
jobs += build_download_job(None)
139-
for os_type in ["linux", "windows"]:
139+
for os_type in ["linux", "windows", "macos"]:
140140
for device_type in ["cpu", "gpu"]:
141+
if os_type == "macos" and device_type == "gpu":
142+
continue
143+
141144
for i, python_version in enumerate(PYTHON_VERSIONS):
142145
job = {
143146
"name": f"unittest_{os_type}_{device_type}_py{python_version}",

.circleci/unittest/linux/scripts/environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ dependencies:
88
- pytest-cov
99
- codecov
1010
- librosa
11+
- llvmlite==0.31 # See https://github.com/pytorch/audio/pull/766
1112
- pip
1213
- pip:
13-
- clang-format
1414
- kaldi-io
1515
- scipy
1616
- parameterized
17-
- numba==0.48
17+
- numba==0.48 # See https://github.com/librosa/librosa/issues/1160

.circleci/unittest/linux/scripts/setup_env.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ env_dir="${root_dir}/env"
1414

1515
cd "${root_dir}"
1616

17+
case "$(uname -s)" in
18+
Darwin*) os=MacOSX;;
19+
*) os=Linux
20+
esac
21+
1722
# 1. Install conda at ./conda
1823
if [ ! -d "${conda_dir}" ]; then
1924
printf "* Installing conda\n"
20-
wget -O miniconda.sh http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
25+
wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh"
2126
bash ./miniconda.sh -b -f -p "${conda_dir}"
2227
fi
2328
eval "$(${conda_dir}/bin/conda shell.bash hook)"
@@ -32,6 +37,9 @@ conda activate "${env_dir}"
3237
# 3. Install Conda dependencies
3338
printf "* Installing dependencies (except PyTorch)\n"
3439
conda env update --file "${this_dir}/environment.yml" --prune
40+
if [ "${os}" == Linux ] ; then
41+
pip install clang-format
42+
fi
3543

3644
# 4. Buld codecs
3745
mkdir -p third_party/build

.github/pytorch-probot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tracking_issue: 736

test/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,58 @@ The following test modules are defined for corresponding `torchaudio` module/fun
4141
- [assets/kaldi](./assets/kaldi): Contains Kaldi format matrix files used in [./test_compliance_kaldi.py](./test_compliance_kaldi.py).
4242
- [compliance](./compliance): Scripts used to generate above Kaldi matrix files.
4343

44+
### Waveforms for Testing Purposes
45+
46+
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.
47+
48+
#### Load a Waveform from a File
49+
50+
```python
51+
filepath = common_utils.get_asset_path('filename.wav')
52+
waveform, sample_rate = common_utils.load_wav(filepath)
53+
```
54+
55+
*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).*
56+
57+
#### Pure Tone
58+
59+
Code:
60+
61+
```python
62+
waveform = common_utils.get_sinusoid(
63+
frequency=300,
64+
sample_rate=16000,
65+
duration=1, # seconds
66+
n_channels=1,
67+
dtype="float32",
68+
device="cpu",
69+
)
70+
```
71+
72+
#### Noise
73+
74+
Code:
75+
76+
```python
77+
tensor = common_utils.get_whitenoise()
78+
```
79+
80+
Files:
81+
82+
* `steam-train-whistle-daniel_simon.wav`
83+
84+
#### Voice
85+
86+
Files:
87+
88+
* `CommonVoice/cv-corpus-4-2019-12-10/tt/clips/common_voice_tt_00000000.wav`
89+
* `LibriSpeech/dev-clean/1272/128104/1272-128104-0000.flac`
90+
* `LJSpeech-1.1/wavs/LJ001-0001.wav`
91+
* `SpeechCommands/speech_commands_v0.02/go/0a9f9af7_nohash_0.wav`
92+
* `VCTK-Corpus/wav48/p224/p224_002.wav`
93+
* `waves_yesno/0_1_0_1_0_1_1_0.wav`
94+
* `vad-go-stereo-44100.wav`
95+
* `vad-go-mono-32000.wav`
4496

4597
## Adding test
4698

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
client_id path sentence up_votes down_votes age gender accent
2-
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 common_voice_tt_00000000.mp3 test. 1 0 thirties female
3-
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 common_voice_tt_00000000.mp3 test. 1 0 thirties female
2+
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 common_voice_tt_00000000.wav test. 1 0 thirties female
3+
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 common_voice_tt_00000000.wav test. 1 0 thirties female

0 commit comments

Comments
 (0)