qiuqiangkong / torchlibrosa

MIT License
450 stars 45 forks source link

Some doubts about args #11

Open Blakey-Gavin opened 1 year ago

Blakey-Gavin commented 1 year ago

class ISTFT(DFTBase): def init(self, n_fft=2048, hop_length=None, win_length=None, window='hann', center=True, pad_mode='reflect', freeze_parameters=True, onnx=False, frames_num=None, device=None): """PyTorch implementation of ISTFT with Conv1d. The function has the same output as librosa.istft.

    Args:
        n_fft: int, fft window size, e.g., 2048
        hop_length: int, hop length samples, e.g., 441
        win_length: int, window length e.g., 2048
        window: str, window function name, e.g., 'hann'
        center: bool
        pad_mode: str, e.g., 'reflect'
        freeze_parameters: bool, set to True to freeze all parameters. Set
            to False to finetune all parameters.
        onnx: bool, set to True when exporting trained model to ONNX. This
            will replace several operations to operators supported by ONNX.
        frames_num: None | int, number of frames of audio clips to be 
            inferneced. Only useable when onnx=True.
        device: None | str, device of ONNX. Only useable when onnx=True.
    """

Hi, I want to ask some problems as follows:

  1. onnx arg. Can I set it to True when I'm training?
  2. frames_num arg. What does it mean? eg: samplerate=44100, segment=3s, n_fft=1024, so frames_num=int(44100*3/1024)=129?

I encountered some problems with stft when I was using nni prune and speedup, such as ola_ window. At the end of fine tuning, I want to save it as an onnx model, but an error was reported, and this error is related to the onnx parameter.