mirror of
https://github.com/babysor/Realtime-Voice-Clone-Chinese.git
synced 2026-03-20 03:55:09 +08:00
init
This commit is contained in:
@@ -3,7 +3,7 @@ import torch.nn.functional as F
|
||||
import torch.nn as nn
|
||||
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
|
||||
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
|
||||
from models.vocoder.fregan.utils import init_weights, get_padding
|
||||
from utils.util import init_weights, get_padding
|
||||
|
||||
LRELU_SLOPE = 0.1
|
||||
|
||||
|
||||
@@ -27,21 +27,12 @@ def plot_spectrogram(spectrogram):
|
||||
return fig
|
||||
|
||||
|
||||
def init_weights(m, mean=0.0, std=0.01):
|
||||
classname = m.__class__.__name__
|
||||
if classname.find("Conv") != -1:
|
||||
m.weight.data.normal_(mean, std)
|
||||
|
||||
|
||||
def apply_weight_norm(m):
|
||||
classname = m.__class__.__name__
|
||||
if classname.find("Conv") != -1:
|
||||
weight_norm(m)
|
||||
|
||||
|
||||
def get_padding(kernel_size, dilation=1):
|
||||
return int((kernel_size*dilation - dilation)/2)
|
||||
|
||||
|
||||
def load_checkpoint(filepath, device):
|
||||
assert os.path.isfile(filepath)
|
||||
|
||||
@@ -3,7 +3,7 @@ import torch.nn.functional as F
|
||||
import torch.nn as nn
|
||||
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
|
||||
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
|
||||
from models.vocoder.hifigan.utils import init_weights, get_padding
|
||||
from utils.util import init_weights, get_padding
|
||||
|
||||
LRELU_SLOPE = 0.1
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ from torch.nn.utils import weight_norm
|
||||
matplotlib.use("Agg")
|
||||
import matplotlib.pylab as plt
|
||||
|
||||
|
||||
def plot_spectrogram(spectrogram):
|
||||
fig, ax = plt.subplots(figsize=(10, 2))
|
||||
im = ax.imshow(spectrogram, aspect="auto", origin="lower",
|
||||
@@ -19,12 +18,6 @@ def plot_spectrogram(spectrogram):
|
||||
return fig
|
||||
|
||||
|
||||
def init_weights(m, mean=0.0, std=0.01):
|
||||
classname = m.__class__.__name__
|
||||
if classname.find("Conv") != -1:
|
||||
m.weight.data.normal_(mean, std)
|
||||
|
||||
|
||||
def apply_weight_norm(m):
|
||||
classname = m.__class__.__name__
|
||||
if classname.find("Conv") != -1:
|
||||
@@ -55,4 +48,3 @@ def scan_checkpoint(cp_dir, prefix):
|
||||
if len(cp_list) == 0:
|
||||
return None
|
||||
return sorted(cp_list)[-1]
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from torch.utils.data import Dataset
|
||||
from pathlib import Path
|
||||
from models.vocoder.wavernn import audio
|
||||
import vocoder.wavernn.hparams as hp
|
||||
import models.vocoder.wavernn.hparams as hp
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import math
|
||||
import numpy as np
|
||||
import librosa
|
||||
import vocoder.wavernn.hparams as hp
|
||||
import models.vocoder.wavernn.hparams as hp
|
||||
from scipy.signal import lfilter
|
||||
import soundfile as sf
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from torch.utils.data import DataLoader
|
||||
from pathlib import Path
|
||||
from torch import optim
|
||||
import torch.nn.functional as F
|
||||
import vocoder.wavernn.hparams as hp
|
||||
import models.vocoder.wavernn.hparams as hp
|
||||
import numpy as np
|
||||
import time
|
||||
import torch
|
||||
|
||||
0
models/wav2emo/__init__.py
Normal file
0
models/wav2emo/__init__.py
Normal file
Reference in New Issue
Block a user