1. 01 Mar, 2023 2 commits
  2. 28 Feb, 2023 3 commits
  3. 27 Feb, 2023 5 commits
  4. 25 Feb, 2023 1 commit
  5. 24 Feb, 2023 5 commits
  6. 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
  7. 22 Feb, 2023 3 commits
  8. 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
  9. 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
  10. 16 Feb, 2023 5 commits
  11. 15 Feb, 2023 5 commits
  12. 14 Feb, 2023 2 commits