mirror of
https://github.com/babysor/MockingBird.git
synced 2024-03-22 13:11:31 +08:00
Refactor folder structure
This commit is contained in:
parent
78fcfc4651
commit
32b9755cbe
|
@ -1,8 +1,8 @@
|
||||||
from toolbox.ui import UI
|
from toolbox.ui import UI
|
||||||
from encoder import inference as encoder
|
from encoder import inference as encoder
|
||||||
from synthesizer.inference import Synthesizer
|
from synthesizer.inference import Synthesizer
|
||||||
from vocoder import inference as rnn_vocoder
|
from vocoder.wavernn import inference as rnn_vocoder
|
||||||
from hifigan import inference as gan_vocoder
|
from vocoder.hifigan import inference as gan_vocoder
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from time import perf_counter as timer
|
from time import perf_counter as timer
|
||||||
from toolbox.utterance import Utterance
|
from toolbox.utterance import Utterance
|
||||||
|
@ -50,13 +50,6 @@ MAX_WAVES = 15
|
||||||
|
|
||||||
class Toolbox:
|
class Toolbox:
|
||||||
def __init__(self, datasets_root, enc_models_dir, syn_models_dir, voc_models_dir, seed, no_mp3_support):
|
def __init__(self, datasets_root, enc_models_dir, syn_models_dir, voc_models_dir, seed, no_mp3_support):
|
||||||
if not no_mp3_support:
|
|
||||||
try:
|
|
||||||
librosa.load("samples/6829_00000.mp3")
|
|
||||||
except NoBackendError:
|
|
||||||
print("Librosa will be unable to open mp3 files if additional software is not installed.\n"
|
|
||||||
"Please install ffmpeg or add the '--no_mp3_support' option to proceed without support for mp3 files.")
|
|
||||||
exit(-1)
|
|
||||||
self.no_mp3_support = no_mp3_support
|
self.no_mp3_support = no_mp3_support
|
||||||
sys.excepthook = self.excepthook
|
sys.excepthook = self.excepthook
|
||||||
self.datasets_root = datasets_root
|
self.datasets_root = datasets_root
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import glob
|
|
||||||
import os
|
import os
|
||||||
import argparse
|
|
||||||
import json
|
import json
|
||||||
import torch
|
import torch
|
||||||
import numpy as np
|
|
||||||
from scipy.io.wavfile import write
|
from scipy.io.wavfile import write
|
||||||
from hifigan.env import AttrDict
|
from vocoder.hifigan.env import AttrDict
|
||||||
from hifigan.meldataset import mel_spectrogram, MAX_WAV_VALUE, load_wav
|
from vocoder.hifigan.meldataset import mel_spectrogram, MAX_WAV_VALUE, load_wav
|
||||||
from hifigan.models import Generator
|
from vocoder.hifigan.models import Generator
|
||||||
import soundfile as sf
|
import soundfile as sf
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +28,7 @@ def load_model(weights_fpath, verbose=True):
|
||||||
if verbose:
|
if verbose:
|
||||||
print("Building hifigan")
|
print("Building hifigan")
|
||||||
|
|
||||||
with open("./hifigan/config_16k_.json") as f:
|
with open("./vocoder/hifigan/config_16k_.json") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
json_config = json.loads(data)
|
json_config = json.loads(data)
|
||||||
h = AttrDict(json_config)
|
h = AttrDict(json_config)
|
|
@ -3,7 +3,7 @@ import torch.nn.functional as F
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
|
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
|
||||||
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
|
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
|
||||||
from hifigan.utils import init_weights, get_padding
|
from vocoder.hifigan.utils import init_weights, get_padding
|
||||||
|
|
||||||
LRELU_SLOPE = 0.1
|
LRELU_SLOPE = 0.1
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import math
|
import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import librosa
|
import librosa
|
||||||
import vocoder.hparams as hp
|
import vocoder.wavernn.hparams as hp
|
||||||
from scipy.signal import lfilter
|
from scipy.signal import lfilter
|
||||||
import soundfile as sf
|
import soundfile as sf
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from vocoder.models.fatchord_version import WaveRNN
|
from vocoder.wavernn.models.fatchord_version import WaveRNN
|
||||||
from vocoder.audio import *
|
from vocoder.wavernn.audio import *
|
||||||
|
|
||||||
|
|
||||||
def gen_testset(model: WaveRNN, test_set, samples, batched, target, overlap, save_path):
|
def gen_testset(model: WaveRNN, test_set, samples, batched, target, overlap, save_path):
|
|
@ -1,5 +1,5 @@
|
||||||
from vocoder.models.fatchord_version import WaveRNN
|
from vocoder.wavernn.models.fatchord_version import WaveRNN
|
||||||
from vocoder import hparams as hp
|
from vocoder.wavernn import hparams as hp
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import torch.nn as nn
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
from vocoder.distribution import sample_from_discretized_mix_logistic
|
from vocoder.distribution import sample_from_discretized_mix_logistic
|
||||||
from vocoder.display import *
|
from vocoder.display import *
|
||||||
from vocoder.audio import *
|
from vocoder.wavernn.audio import *
|
||||||
|
|
||||||
|
|
||||||
class ResBlock(nn.Module):
|
class ResBlock(nn.Module):
|
|
@ -1,13 +1,13 @@
|
||||||
from vocoder.models.fatchord_version import WaveRNN
|
from vocoder.wavernn.models.fatchord_version import WaveRNN
|
||||||
from vocoder.vocoder_dataset import VocoderDataset, collate_vocoder
|
from vocoder.vocoder_dataset import VocoderDataset, collate_vocoder
|
||||||
from vocoder.distribution import discretized_mix_logistic_loss
|
from vocoder.distribution import discretized_mix_logistic_loss
|
||||||
from vocoder.display import stream, simple_table
|
from vocoder.display import stream, simple_table
|
||||||
from vocoder.gen_wavernn import gen_testset
|
from vocoder.wavernn.gen_wavernn import gen_testset
|
||||||
from torch.utils.data import DataLoader
|
from torch.utils.data import DataLoader
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from torch import optim
|
from torch import optim
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
import vocoder.hparams as hp
|
import vocoder.wavernn.hparams as hp
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import time
|
import time
|
||||||
import torch
|
import torch
|
|
@ -1,5 +1,5 @@
|
||||||
from utils.argutils import print_args
|
from utils.argutils import print_args
|
||||||
from vocoder.train import train
|
from vocoder.wavernn.train import train
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user