-
Notifications
You must be signed in to change notification settings - Fork 744
Description
🚀 The feature
To increase the speed of InverseMelScale module, the SGD optimization can be replace with torch.linalg.lstsq.
Motivation, pitch
The current InverseMelScale module applies SGD optimizer and estimate the spectrogram in a for loop. The speed is much slower than librosa (See #2594) which uses non-negative least squares (nnls) algorithm. Another issue is the module can not be run in torch's inference mode (See #1902), because the gradient is disabled in inference mode, which blocks the SGD optimization.
The speed of torch.linalg.lstsq is much faster than SGD. Another benefit is it can be run without gradients, hence it enables the module to run in torch inference mode.
Alternatives
Another solution is using the same L-BFGS-B optimizer as in librosa. However, there is no implementation in PyTorch yet.
Additional context
No response