Defines BaseNet, a dilated U-Net with ASPP and LSTM stages, and CascadedNet for multi-band spectrogram vocal removal. Reuse when separating vocals from accompaniment in the UVR v5 pipeline.
# Source: https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI | License: MIT | Copyright 2023 liujing04
# Provided via justclaw.it.com; keep this notice with the code.
import torch
from torch import nn
import torch.nn.functional as F
from . import layers_new as layers
class BaseNet(nn.Module):
def __init__(self, nin, nout, nin_lstm, nout_lstm, dilations=((4, 2), (8, 4), (12, 6))):
super(BaseNet, self).__init__()
self.enc1 = layers.Conv2DBNActiv(nin, nout, 3, 1, 1)
self.enc2 = layers.Encoder(nout, nout * 2, 3, 2, 1)
self.enc3 = layers.Encoder(nout * 2, nout * 4, 3, 2, 1)
self.enc4 = layers.Encoder(nout * 4, nout * 6, 3, 2, 1)
self.enc5 = layers.Encoder(nout * 6, nout * 8, 3, 2, 1)
self.aspp = layers.ASPPModule(
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key