Skip to content

Commit 719ebb8

Browse files
mthrokfacebook-github-bot
authored andcommitted
Import torchaudio #1004 5e54c77
Summary: Import torchaudio up to #1004 5e54c77 Reviewed By: vincentqb, cpuhrsch Differential Revision: D24841498 fbshipit-source-id: 3829130636f36779d84f01ff0d0120b80b2396d7
1 parent d0e2281 commit 719ebb8

File tree

13 files changed

+2602
-2473
lines changed

13 files changed

+2602
-2473
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ jobs:
459459
- third_party/src
460460
- run:
461461
name: Install torchaudio
462-
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
462+
command: docker run -t --gpus all -e UPLOAD_CHANNEL -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
463463
- run:
464464
name: Run tests
465465
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
@@ -1394,4 +1394,4 @@ workflows:
13941394
only:
13951395
- master
13961396
jobs:
1397-
- smoke_test_docker_image_build
1397+
- smoke_test_docker_image_build

.circleci/config.yml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ jobs:
459459
- third_party/src
460460
- run:
461461
name: Install torchaudio
462-
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
462+
command: docker run -t --gpus all -e UPLOAD_CHANNEL -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
463463
- run:
464464
name: Run tests
465465
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh

.circleci/regenerate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,4 @@ def unittest_workflows(indentation=6):
178178
build_workflows=build_workflows,
179179
unittest_workflows=unittest_workflows,
180180
))
181+
f.write("\n")

docs/source/functional.rst

Lines changed: 103 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -8,145 +8,166 @@ torchaudio.functional
88

99
Functions to perform common audio operations.
1010

11-
:hidden:`spectrogram`
12-
~~~~~~~~~~~~~~~~~~~~~
11+
:hidden:`Filtering`
12+
~~~~~~~~~~~~~~~~~~~
1313

14-
.. autofunction:: spectrogram
1514

16-
:hidden:`amplitude_to_DB`
17-
~~~~~~~~~~~~~~~~~~~~~~~~~
15+
allpass_biquad
16+
--------------
1817

19-
.. autofunction:: amplitude_to_DB
18+
.. autofunction:: allpass_biquad
2019

21-
:hidden:`create_fb_matrix`
22-
~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
band_biquad
21+
-----------
2322

24-
.. autofunction:: create_fb_matrix
23+
.. autofunction:: band_biquad
2524

26-
:hidden:`create_dct`
27-
~~~~~~~~~~~~~~~~~~~~
25+
bandpass_biquad
26+
---------------
2827

29-
.. autofunction:: create_dct
28+
.. autofunction:: bandpass_biquad
3029

31-
:hidden:`mu_law_encoding`
32-
~~~~~~~~~~~~~~~~~~~~~~~~~
30+
bandreject_biquad
31+
-----------------
3332

34-
.. autofunction:: mu_law_encoding
33+
.. autofunction:: bandreject_biquad
3534

36-
:hidden:`mu_law_decoding`
37-
~~~~~~~~~~~~~~~~~~~~~~~~~
35+
bass_biquad
36+
-----------
3837

39-
.. autofunction:: mu_law_decoding
38+
.. autofunction:: bass_biquad
4039

41-
:hidden:`complex_norm`
42-
~~~~~~~~~~~~~~~~~~~~~~
40+
biquad
41+
------
4342

44-
.. autofunction:: complex_norm
43+
.. autofunction:: biquad
4544

46-
:hidden:`angle`
47-
~~~~~~~~~~~~~~~
45+
contrast
46+
--------
4847

49-
.. autofunction:: angle
48+
.. autofunction:: contrast
5049

51-
:hidden:`magphase`
52-
~~~~~~~~~~~~~~~~~~
50+
dcshift
51+
-------
5352

54-
.. autofunction:: magphase
53+
.. autofunction:: dcshift
5554

56-
:hidden:`phase_vocoder`
57-
~~~~~~~~~~~~~~~~~~~~~~~
55+
deemph_biquad
56+
-------------
5857

59-
.. autofunction:: phase_vocoder
58+
.. autofunction:: deemph_biquad
6059

61-
:hidden:`lfilter`
62-
~~~~~~~~~~~~~~~~~
6360

64-
.. autofunction:: lfilter
61+
dither
62+
------
6563

66-
:hidden:`biquad`
67-
~~~~~~~~~~~~~~~~
64+
.. autofunction:: dither
6865

69-
.. autofunction:: biquad
66+
equalizer_biquad
67+
----------------
7068

71-
:hidden:`lowpass_biquad`
72-
~~~~~~~~~~~~~~~~~~~~~~~~
69+
.. autofunction:: equalizer_biquad
7370

74-
.. autofunction:: lowpass_biquad
71+
flanger
72+
-------
7573

76-
:hidden:`highpass_biquad`
77-
~~~~~~~~~~~~~~~~~~~~~~~~~
74+
.. autofunction:: flanger
75+
76+
gain
77+
----
78+
79+
.. autofunction:: gain
80+
81+
highpass_biquad
82+
---------------
7883

7984
.. autofunction:: highpass_biquad
8085

81-
:hidden:`allpass_biquad`
82-
~~~~~~~~~~~~~~~~~~~~~~~~
86+
lfilter
87+
-------
8388

84-
.. autofunction:: allpass_biquad
89+
.. autofunction:: lfilter
8590

86-
:hidden:`equalizer_biquad`
87-
~~~~~~~~~~~~~~~~~~~~~~~~~~
91+
lowpass_biquad
92+
--------------
8893

89-
.. autofunction:: equalizer_biquad
94+
.. autofunction:: lowpass_biquad
9095

91-
:hidden:`bandpass_biquad`
92-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96+
overdrive
97+
---------
9398

94-
.. autofunction:: bandpass_biquad
99+
.. autofunction:: overdrive
95100

96-
:hidden:`bandreject_biquad`
97-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101+
phaser
102+
------
98103

99-
.. autofunction:: bandreject_biquad
104+
.. autofunction:: phaser
100105

101-
:hidden:`band_biquad`
102-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106+
riaa_biquad
107+
-----------
103108

104-
.. autofunction:: band_biquad
109+
.. autofunction:: riaa_biquad
105110

106-
:hidden:`treble_biquad`
107-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111+
treble_biquad
112+
-------------
108113

109114
.. autofunction:: treble_biquad
110115

111-
:hidden:`bass_biquad`
112-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113116

114-
.. autofunction:: bass_biquad
117+
vad
118+
---
115119

116-
:hidden:`deemph_biquad`
117-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
120+
.. autofunction:: vad
118121

119-
.. autofunction:: deemph_biquad
122+
:hidden:`spectrogram`
123+
~~~~~~~~~~~~~~~~~~~~~
120124

121-
:hidden:`riaa_biquad`
122-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125+
.. autofunction:: spectrogram
123126

124-
.. autofunction:: riaa_biquad
127+
:hidden:`amplitude_to_DB`
128+
~~~~~~~~~~~~~~~~~~~~~~~~~
125129

126-
:hidden:`contrast`
127-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130+
.. autofunction:: amplitude_to_DB
128131

129-
.. autofunction:: contrast
132+
:hidden:`create_fb_matrix`
133+
~~~~~~~~~~~~~~~~~~~~~~~~~~
130134

131-
:hidden:`dcshift`
132-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135+
.. autofunction:: create_fb_matrix
133136

134-
.. autofunction:: dcshift
137+
:hidden:`create_dct`
138+
~~~~~~~~~~~~~~~~~~~~
135139

136-
:hidden:`overdrive`
137-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140+
.. autofunction:: create_dct
138141

139-
.. autofunction:: overdrive
142+
:hidden:`mu_law_encoding`
143+
~~~~~~~~~~~~~~~~~~~~~~~~~
140144

141-
:hidden:`phaser`
142-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145+
.. autofunction:: mu_law_encoding
143146

144-
.. autofunction:: phaser
147+
:hidden:`mu_law_decoding`
148+
~~~~~~~~~~~~~~~~~~~~~~~~~
145149

146-
:hidden:`flanger`
147-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150+
.. autofunction:: mu_law_decoding
148151

149-
.. autofunction:: flanger
152+
:hidden:`complex_norm`
153+
~~~~~~~~~~~~~~~~~~~~~~
154+
155+
.. autofunction:: complex_norm
156+
157+
:hidden:`angle`
158+
~~~~~~~~~~~~~~~
159+
160+
.. autofunction:: angle
161+
162+
:hidden:`magphase`
163+
~~~~~~~~~~~~~~~~~~
164+
165+
.. autofunction:: magphase
166+
167+
:hidden:`phase_vocoder`
168+
~~~~~~~~~~~~~~~~~~~~~~~
169+
170+
.. autofunction:: phase_vocoder
150171

151172
:hidden:`mask_along_axis`
152173
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -172,8 +193,3 @@ Functions to perform common audio operations.
172193
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173194

174195
.. autofunction:: sliding_window_cmn
175-
176-
:hidden:`vad`
177-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178-
179-
.. autofunction:: vad

docs/source/torchaudio.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,3 @@ Backend Utilities
3434
.. autofunction:: get_audio_backend
3535

3636
.. autofunction:: set_audio_backend
37-
38-
Sox Effects Utilities
39-
~~~~~~~~~~~~~~~~~~~~~
40-
41-
.. autofunction:: initialize_sox
42-
43-
.. autofunction:: shutdown_sox

examples/pipeline_wav2letter/main.py

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,6 @@ def parse_args():
8383
parser.add_argument(
8484
"--start-epoch", default=0, type=int, metavar="N", help="manual epoch number"
8585
)
86-
parser.add_argument(
87-
"--print-freq",
88-
default=10,
89-
type=int,
90-
metavar="N",
91-
help="print frequency in epochs",
92-
)
9386
parser.add_argument(
9487
"--reduce-lr-valid",
9588
action="store_true",
@@ -615,37 +608,35 @@ def main(rank, args):
615608
not args.reduce_lr_valid,
616609
)
617610

618-
if not (epoch + 1) % args.print_freq or epoch == args.epochs - 1:
619-
620-
loss = evaluate(
621-
model,
622-
criterion,
623-
loader_validation,
624-
decoder,
625-
language_model,
626-
devices[0],
627-
epoch,
628-
not_main_rank,
629-
)
630-
631-
is_best = loss < best_loss
632-
best_loss = min(loss, best_loss)
633-
save_checkpoint(
634-
{
635-
"epoch": epoch + 1,
636-
"state_dict": model.state_dict(),
637-
"best_loss": best_loss,
638-
"optimizer": optimizer.state_dict(),
639-
"scheduler": scheduler.state_dict(),
640-
},
641-
is_best,
642-
args.checkpoint,
643-
not_main_rank,
644-
)
611+
loss = evaluate(
612+
model,
613+
criterion,
614+
loader_validation,
615+
decoder,
616+
language_model,
617+
devices[0],
618+
epoch,
619+
not_main_rank,
620+
)
645621

646622
if args.reduce_lr_valid and isinstance(scheduler, ReduceLROnPlateau):
647623
scheduler.step(loss)
648624

625+
is_best = loss < best_loss
626+
best_loss = min(loss, best_loss)
627+
save_checkpoint(
628+
{
629+
"epoch": epoch + 1,
630+
"state_dict": model.state_dict(),
631+
"best_loss": best_loss,
632+
"optimizer": optimizer.state_dict(),
633+
"scheduler": scheduler.state_dict(),
634+
},
635+
is_best,
636+
args.checkpoint,
637+
not_main_rank,
638+
)
639+
649640
logging.info("End time: %s", datetime.now())
650641

651642
if args.distributed:

test/torchaudio_unittest/sox_effect/dataset_test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import sys
2+
import platform
3+
from unittest import skipIf
14
from typing import List, Tuple
25

36
import numpy as np
@@ -68,6 +71,13 @@ def init_random_seed(worker_id):
6871

6972

7073
@skipIfNoExtension
74+
@skipIf(
75+
platform.system() == 'Darwin' and
76+
sys.version_info.major == 3 and
77+
sys.version_info.minor in [6, 7],
78+
'This test is known to get stuck for macOS with Python < 3.8. '
79+
'See https://github.com/pytorch/pytorch/issues/46409'
80+
)
7181
class TestSoxEffectsDataset(TempDirMixin, PytorchTestCase):
7282
"""Test `apply_effects_file` in multi-process dataloader setting"""
7383

0 commit comments

Comments
 (0)