dvector icon indicating copy to clipboard operation
dvector copied to clipboard

Issue in visualise.py -> Unknown builtin op: torchaudio_sox::apply_effects_tensor.

Open 1rsh opened this issue 1 year ago • 1 comments

Running visualize("preprocessed", "preprocessed/wav2mel.pt", "dvector-step5000.pt", ".")

Getting the following error while torch.jit.load

RuntimeError: 
Unknown builtin op: torchaudio_sox::apply_effects_tensor.
Could not find any similar ops to torchaudio_sox::apply_effects_tensor. This op may not exist or may not be currently supported in TorchScript.
:
  File "code/__torch__/torchaudio/sox_effects/sox_effects.py", line 5
    effects: List[List[str]],
    channels_first: bool=True) -> Tuple[Tensor, int]:
  _0, _1 = ops.torchaudio_sox.apply_effects_tensor(tensor, sample_rate, effects, channels_first)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
  return (_0, _1)
'apply_effects_tensor' is being compiled since it was called from 'SoxEffects.forward'
Serialized   File "code/__torch__/data/wav2mel.py", line 33
    wav_tensor: Tensor,
    sample_rate: int) -> Tensor:
    _0 = __torch__.torchaudio.sox_effects.sox_effects.apply_effects_tensor
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
    effects = self.effects
    _1 = _0(wav_tensor, sample_rate, effects, True, )

1rsh avatar May 27 '24 13:05 1rsh

The issue was solved for me on Ubuntu by

  1. installing libsox-dev: sudo apt-get install libsox-dev and then
  2. not loading the wav2mel module from a torchscript checkpoint but just importing the python code (you'll need the dependencies used in that script like torch and torchaudio installed then). E.g. for visualize.py, I replaced
wav2mel = torch.jit.load(wav2mel_path)

by

from data.wav2mel import Wav2Mel
wav2mel = Wav2Mel()

tobiasatnoah avatar Nov 05 '24 11:11 tobiasatnoah