KentoNishi / torch-time-stretch

Time-stretch audio clips quickly with PyTorch (CUDA supported)! Additional utilities for searching efficient transformations are included.
https://kentonishi.github.io/torch-time-stretch/
MIT License
36 stars 3 forks source link

RuntimeError: The size of tensor a (40264) must match the size of tensor b (173) at non-singleton dimension 1 #2

Closed Jackiexiao closed 2 years ago

Jackiexiao commented 2 years ago

I use same code in https://github.com/KentoNishi/torch-time-stretch/blob/master/example.py but get below error

(librosa) ➜  torch-time-stretch git:(master) ✗ python example.py 
Traceback (most recent call last):
  File "/home/jackie/code/github/torch-time-stretch/example.py", line 48, in <module>
    test_time_stretch_2_up()
  File "/home/jackie/code/github/torch-time-stretch/example.py", line 20, in test_time_stretch_2_up
    up = time_stretch(sample, Fraction(1, 2), SAMPLE_RATE)
  File "/home/jackie/code/github/torch-time-stretch/torch_time_stretch/main.py", line 116, in time_stretch
    output = stretcher(output)
  File "/home/jackie/anaconda3/envs/librosa/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/jackie/anaconda3/envs/librosa/lib/python3.9/site-packages/torchaudio/transforms/_transforms.py", line 1059, in forward
    return F.phase_vocoder(complex_specgrams, rate, self.phase_advance)
  File "/home/jackie/anaconda3/envs/librosa/lib/python3.9/site-packages/torchaudio/functional/functional.py", line 743, in phase_vocoder
    phase = angle_1 - angle_0 - phase_advance
RuntimeError: The size of tensor a (40264) must match the size of tensor b (173) at non-singleton dimension 1
KentoNishi commented 2 years ago

I'm a little busy at the moment, but I'll try to debug this as soon as I can. In the meantime, could you let me know your pytorch and torchaudio versions?

Jackiexiao commented 2 years ago

thx for your reply!

>>> torch.__version__
'1.12.1+cu102'
>>> torchaudio.__version__
'0.12.1+cu102'
KentoNishi commented 2 years ago

@Jackiexiao it's been fixed in v1.0.3! :)

Jackiexiao commented 2 years ago

wow, thx!