Skip to content

Commit

Permalink
Import torchaudio #1004 5e54c77
Browse files Browse the repository at this point in the history
Summary: Import torchaudio up to #1004 5e54c77

Reviewed By: vincentqb, cpuhrsch

Differential Revision: D24841498

fbshipit-source-id: 3829130636f36779d84f01ff0d0120b80b2396d7
  • Loading branch information
mthrok authored and facebook-github-bot committed Nov 11, 2020
1 parent d0e2281 commit 719ebb8
Show file tree
Hide file tree
Showing 13 changed files with 2,602 additions and 2,473 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ jobs:
- third_party/src
- run:
name: Install torchaudio
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
command: docker run -t --gpus all -e UPLOAD_CHANNEL -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
- run:
name: Run tests
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
Expand Down Expand Up @@ -1394,4 +1394,4 @@ workflows:
only:
- master
jobs:
- smoke_test_docker_image_build
- smoke_test_docker_image_build
2 changes: 1 addition & 1 deletion .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ jobs:
- third_party/src
- run:
name: Install torchaudio
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
command: docker run -t --gpus all -e UPLOAD_CHANNEL -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/install.sh
- run:
name: Run tests
command: docker run -t --gpus all -v $PWD:$PWD -w $PWD "${image_name}" .circleci/unittest/linux/scripts/run_test.sh
Expand Down
1 change: 1 addition & 0 deletions .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,4 @@ def unittest_workflows(indentation=6):
build_workflows=build_workflows,
unittest_workflows=unittest_workflows,
))
f.write("\n")
190 changes: 103 additions & 87 deletions docs/source/functional.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,145 +8,166 @@ 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:`amplitude_to_DB`
~~~~~~~~~~~~~~~~~~~~~~~~~

:hidden:`contrast`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: amplitude_to_DB

.. autofunction:: contrast
:hidden:`create_fb_matrix`
~~~~~~~~~~~~~~~~~~~~~~~~~~

:hidden:`dcshift`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: create_fb_matrix

.. autofunction:: dcshift
:hidden:`create_dct`
~~~~~~~~~~~~~~~~~~~~

:hidden:`overdrive`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: create_dct

.. autofunction:: overdrive
:hidden:`mu_law_encoding`
~~~~~~~~~~~~~~~~~~~~~~~~~

:hidden:`phaser`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: mu_law_encoding

.. autofunction:: phaser
:hidden:`mu_law_decoding`
~~~~~~~~~~~~~~~~~~~~~~~~~

:hidden:`flanger`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: mu_law_decoding

.. autofunction:: flanger
:hidden:`complex_norm`
~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: complex_norm

:hidden:`angle`
~~~~~~~~~~~~~~~

.. autofunction:: angle

:hidden:`magphase`
~~~~~~~~~~~~~~~~~~

.. autofunction:: magphase

:hidden:`phase_vocoder`
~~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: phase_vocoder

:hidden:`mask_along_axis`
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -172,8 +193,3 @@ Functions to perform common audio operations.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: sliding_window_cmn

:hidden:`vad`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: vad
7 changes: 0 additions & 7 deletions docs/source/torchaudio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,3 @@ Backend Utilities
.. autofunction:: get_audio_backend

.. autofunction:: set_audio_backend

Sox Effects Utilities
~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: initialize_sox

.. autofunction:: shutdown_sox
59 changes: 25 additions & 34 deletions examples/pipeline_wav2letter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ def parse_args():
parser.add_argument(
"--start-epoch", default=0, type=int, metavar="N", help="manual epoch number"
)
parser.add_argument(
"--print-freq",
default=10,
type=int,
metavar="N",
help="print frequency in epochs",
)
parser.add_argument(
"--reduce-lr-valid",
action="store_true",
Expand Down Expand Up @@ -615,37 +608,35 @@ def main(rank, args):
not args.reduce_lr_valid,
)

if not (epoch + 1) % args.print_freq or epoch == args.epochs - 1:

loss = evaluate(
model,
criterion,
loader_validation,
decoder,
language_model,
devices[0],
epoch,
not_main_rank,
)

is_best = loss < best_loss
best_loss = min(loss, best_loss)
save_checkpoint(
{
"epoch": epoch + 1,
"state_dict": model.state_dict(),
"best_loss": best_loss,
"optimizer": optimizer.state_dict(),
"scheduler": scheduler.state_dict(),
},
is_best,
args.checkpoint,
not_main_rank,
)
loss = evaluate(
model,
criterion,
loader_validation,
decoder,
language_model,
devices[0],
epoch,
not_main_rank,
)

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

is_best = loss < best_loss
best_loss = min(loss, best_loss)
save_checkpoint(
{
"epoch": epoch + 1,
"state_dict": model.state_dict(),
"best_loss": best_loss,
"optimizer": optimizer.state_dict(),
"scheduler": scheduler.state_dict(),
},
is_best,
args.checkpoint,
not_main_rank,
)

logging.info("End time: %s", datetime.now())

if args.distributed:
Expand Down
10 changes: 10 additions & 0 deletions test/torchaudio_unittest/sox_effect/dataset_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import sys
import platform
from unittest import skipIf
from typing import List, Tuple

import numpy as np
Expand Down Expand Up @@ -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"""

Expand Down
Loading

0 comments on commit 719ebb8

Please sign in to comment.