santi-pdp / pase

Problem Agnostic Speech Encoder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Training pase+:RuntimeError: Legacy autograd function with non-static forward method is deprecated.

Imenbaa opened this issue · comments

Hello, I got this error while training pase+ from scratch:
RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)

Any help?
Thank you.

I have this issue too. It has to do with the version of PyTorch. If you don't need the most recent version of pytorch, you can downgrade see (see issue 29 from pytorch-qrnn repo).
A workaround I'm trying without downgrading pytorch is to use fastai's implementation of QRNN. I've created a fork of the PASE repo. pip install ninja and then upgrade or install fastai pip install -U fastai. The in pase.models.modules.py import QRNN from fastai and update line 55 when the QRNN module is called.
This works for the inference example presented in the README of the repo

from pase.models.frontend import wf_builder
pase = wf_builder('cfg/frontend/PASE+.cfg').eval()
pase.load_pretrained('FE_e199.ckpt', load_last=True, verbose=True)
pase.cuda()
# Now we can forward waveforms as Torch tensors
import torch
x = torch.randn(1, 1, 100000) # example with random noise to check shape
# y size will be (1, 256, 625), which are 625 frames of 256 dims each
y = pase(x.cuda(), device='cuda') 

Disclaimer: The output dimensions match. I haven't checked whether the values match because that would require downgrading pytorch. I think for inference, this should work.

It worked!
Thank you.

Hi,

I have checked the values for inference with the released checkpoint on README.md, it doesn't match (with torch.allclose) :(
Just to report this situation, if you are going to train from scratch then this is not a problem.