1. 24 Feb, 2023 1 commit
  2. 23 Feb, 2023 5 commits
    • moto's avatar
      Replace c10::Dict with std::map in StreamReader/Writer (#3092) · c3310018
      moto authored
      Summary:
      This commit is kind of clean up and preparation for future development.
      
      We plan to pass around more complicated objects among StreamReader and StreamWriter, and TorchBind is not expressive enough for defining intermediate object, so we want to use PyBind11 for binding StreamReader/Writer.
      
      PyBind11 converts Python dict into std::map, while TorchBind converts it into c10::Dict. Because of this descrepancy, conversion from c10::Dict to std::map have to happen in multiple places, and this makes the binding code thicker as it requires to wrapper methods.
      
      Using std::map reduces the number of wrapper methods / conversions, because the same method can be bound for file-like object and the others.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3092
      
      Reviewed By: nateanl
      
      Differential Revision: D43524808
      
      Pulled By: mthrok
      
      fbshipit-source-id: f7467c66ccd37dbf4abc337bbb18ffaac21a0058
      c3310018
    • G. Sun's avatar
      Add TCPGen context-biasing Conformer RNN-T (#2890) · 1ed330b5
      G. Sun authored
      Summary:
      This commit adds the implementation of the tree-constrained pointer generator (TCPGen) for contextual biasing.
      
      An example for Librispeech can be found in audio/examples/asr/librispeech_biasing.
      
      Maintainer's note (mthrok):
      It seems that TrieNode should be better typed as tuple, but changing the implementation from list to tuple
      could cause some issue without running the code, so the code is not changed, though the annotation uses tuple.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/2890
      
      Reviewed By: nateanl
      
      Differential Revision: D43171447
      
      Pulled By: mthrok
      
      fbshipit-source-id: 372bb077d997d720401dbf2dbfa131e6a958e37e
      1ed330b5
    • mthrok's avatar
      Remove Tensor binding from StreamReader (#3093) · d3c9295c
      mthrok authored
      Summary:
      Remove the Tensor input support from StreamReader
      
      Follow up of https://github.com/pytorch/audio/pull/3086
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3093
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D43526066
      
      Pulled By: mthrok
      
      fbshipit-source-id: 57ba4866c413649173e1c2c3b23ba7de3231b7bc
      d3c9295c
    • moto's avatar
      Deprecate the use of Tensor as a mean of passing byte string (#3086) · a26c2f27
      moto authored
      Summary:
      The same functionality can be achieved with passing io.BytesIO to the constructor.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3086
      
      Reviewed By: nateanl
      
      Differential Revision: D43500360
      
      Pulled By: mthrok
      
      fbshipit-source-id: 2c6f37d100f50553b283c75c04fe57c8f9c07dc9
      a26c2f27
    • moto's avatar
      Update CTCDecoder static build deprecation message (#3089) · 3b75b74f
      moto authored
      Summary:
      1. Fix spacing.
      2. Move it to after successful import
      3. Add link to the announcement issue
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3089
      
      Reviewed By: nateanl, xiaohui-zhang
      
      Differential Revision: D43514075
      
      Pulled By: mthrok
      
      fbshipit-source-id: 3b2a24c65c63dab8c12c9c6aa1942a8354b2c0f1
      3b75b74f
  3. 22 Feb, 2023 3 commits
  4. 21 Feb, 2023 1 commit
    • Chin-Yun Yu's avatar
      Fix contiguous error when backpropagating through lfilter (#3080) · 6ab1325a
      Chin-Yun Yu authored
      Summary:
      I encountered the following errors when using the filter with gradients being enabled.
      
      ```sh
      Traceback (most recent call last):
        File "/home/ycy/working/audio/test_backward.py", line 20, in <module>
          loss.backward()
        File "/home/ycy/miniconda3/envs/nightly/lib/python3.10/site-packages/torch/_tensor.py", line 488, in backward
          torch.autograd.backward(
        File "/home/ycy/miniconda3/envs/nightly/lib/python3.10/site-packages/torch/autograd/__init__.py", line 197, in backward
          Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
      RuntimeError: Expected input_signal_windows.is_contiguous() && a_coeff_flipped.is_contiguous() && padded_output_waveform.is_contiguous() to be true, but got false.  (Could this error message be improved?  If so, please report an enhancement request to PyTorch.)
      ```
      This can happen if the outputs from lfilter was used by other operations.
      
      ### How to reproduce
      The following script can reproduce the error on the stable and nightly versions.
      
      ```python
      import torch
      import torch.nn.functional as F
      from torchaudio.functional import lfilter
      
      a = torch.rand(250, 26, requires_grad=True)
      b = torch.ones(250, 26, requires_grad=True)
      x = torch.rand(250, 1024, requires_grad=True)
      w = torch.eye(1024).unsqueeze(1)
      
      y = lfilter(x, a, b, False)
      y = F.conv_transpose1d(
          y.t().unsqueeze(0),
          w,
          stride=256,
      ).squeeze()
      print(y.shape)
      target = torch.ones_like(y)
      loss = torch.nn.functional.mse_loss(y, target)
      loss.backward()
      ```
      
      ### Cause
      
      The inner call of differentiable IIR in the backward pass needs to ensure the input is contiguous. Adding a `contiguous()` call solve the problem.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3080
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D43466612
      
      Pulled By: mthrok
      
      fbshipit-source-id: 375e0a147988656da47ac8397f7de6eae512a655
      6ab1325a
  5. 17 Feb, 2023 3 commits
    • hwangjeff's avatar
      Make lengths optional for speed functions and modules (#3072) · 5af309d3
      hwangjeff authored
      Summary:
      Makes lengths input optional for `torchaudio.functional.speed`, `torchaudio.transforms.Speed`, and `torchaudio.transforms.SpeedPerturbation`.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3072
      
      Reviewed By: nateanl, mthrok
      
      Differential Revision: D43371406
      
      Pulled By: hwangjeff
      
      fbshipit-source-id: ecb38bcc2bfff5c5a396a37eff238b22238e795a
      5af309d3
    • atalman's avatar
      Add py3.11 to windows nightly conda (#3071) · e663095c
      atalman authored
      Summary:
      Same as: https://github.com/pytorch/vision/pull/7263
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3071
      
      Reviewed By: weiwangmeta
      
      Differential Revision: D43377741
      
      Pulled By: atalman
      
      fbshipit-source-id: 0dbe0aaa10b9a4bad713563e98642b1a65e9ac07
      e663095c
    • Daniel Walker's avatar
      Add precodition check for contiguous emissions tensor (#3074) · 06b1cc9d
      Daniel Walker authored
      Summary:
      This PR adds a precondition check to the `CTCDecoder` that raises a helpful exception when called on a noncontiguous emissions tensor.
      
      Currently, noncontiguous tensors can be passed into the CTCDecoder, which in turn passes the tensors to the backing Flashlight C++ library and results in undefined behavior, since Flashlight requires the tensors to be laid out in contiguous memory. The following code demonstrates the problem:
      
      ```
      import torch
      from torchaudio.models.decoder import ctc_decoder
      
      tokens = ['a', '-', '|']
      decoder = ctc_decoder(lexicon=None, tokens=tokens)
      
      emissions = torch.rand(len(tokens), 2)  # N x T contiguous
      emissions = emissions.t()  # T x N noncontiguous
      
      batch = emissions.unsqueeze(0)
      result = decoder(batch)  # undefined behavior!!!
      ```
      
      I stumbled on the issue accidentally when I noticed the decoder wasn't giving the expected results on my input only to realize, finally, that the tensor I had passed in was noncontiguous. In my case, Flashlight was iterating over unrelated segments of memory where it had expected to find a contiguous tensor. A precondition check will hopefully save others from making the same mistake.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3074
      
      Reviewed By: nateanl, xiaohui-zhang
      
      Differential Revision: D43376011
      
      Pulled By: mthrok
      
      fbshipit-source-id: 7c95aa8016d8f9f2d65b5b816a859b28ea4629f5
      06b1cc9d
  6. 16 Feb, 2023 5 commits
  7. 15 Feb, 2023 5 commits
  8. 14 Feb, 2023 4 commits
  9. 11 Feb, 2023 1 commit
  10. 10 Feb, 2023 1 commit
  11. 09 Feb, 2023 3 commits
  12. 08 Feb, 2023 4 commits
    • moto's avatar
      Update the guard mechanism for FFmpeg-related features (#3028) · 98b3ac17
      moto authored
      Summary:
      Instead of raising an error when lazy import happens, this method allows to import features, and raises an error when the feature is being used.
      
      This makes it easy to adopt the same error mechanism across different modules. It is how it's done for sox-related features.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3028
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D42966976
      
      Pulled By: mthrok
      
      fbshipit-source-id: 423dfe0b8a3970cd07f20e841c794c7f2809f993
      98b3ac17
    • moto's avatar
      Build doc on GHA (#3043) · a0f8af4b
      moto authored
      Summary:
      The first step to migrate doc build to GHA.
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3043
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D43110816
      
      Pulled By: mthrok
      
      fbshipit-source-id: 91de5f3ac567188e7030f14c2827a202a1901f1a
      a0f8af4b
    • moto's avatar
      Suppres warning about archive timestamp (#3044) · b4c66d1f
      moto authored
      Summary:
      Currently, for each third party library checked out with ExternalProject_Add, the following warning is shown.
      
      This commit set the policy so that the warning is not shown.
      
      ```
      CMake Warning (dev) at ci_env/lib/python3.10/site-packages/cmake/data/share/cmake-3.25/Modules/ExternalProject.cmake:3075 (message):
        The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
        not set.  The policy's OLD behavior will be used.  When using a URL
        download, the timestamps of extracted files should preferably be that of
        the time of extraction, otherwise code that depends on the extracted
        contents might not be rebuilt if the URL changes.  The OLD behavior
        preserves the timestamps from the archive instead, but this is usually not
        what you want.  Update your project to the NEW behavior or specify the
        DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
        robustness issue.
      ```
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/3044
      
      Reviewed By: xiaohui-zhang
      
      Differential Revision: D43110818
      
      Pulled By: mthrok
      
      fbshipit-source-id: d2e20c9fdbbeeedb5ad546fe32dbda28c5bdd431
      b4c66d1f
    • DanilBaibak's avatar
      Switch to Nova MacOS Conda (#2908) · de54d864
      DanilBaibak authored
      Summary:
      Switch to Nova M1 Conda
      
      Pull Request resolved: https://github.com/pytorch/audio/pull/2908
      
      Reviewed By: seemethere, osalpekar
      
      Differential Revision: D43093605
      
      Pulled By: DanilBaibak
      
      fbshipit-source-id: 9e44f26cfb87e277c3808ee59f50218b4629e86e
      de54d864
  13. 07 Feb, 2023 2 commits
  14. 06 Feb, 2023 1 commit
  15. 04 Feb, 2023 1 commit