1
0
mirror of synced 2024-11-30 18:24:32 +01:00
This commit is contained in:
Ftps 2023-08-28 16:08:31 +09:00
parent 3c7f1f1407
commit 58e32b6def
55 changed files with 237 additions and 169 deletions

View File

@ -1,9 +1,10 @@
import os
import argparse
import os
import sys
import torch
from multiprocessing import cpu_count
import torch
def use_fp32_config():
for config_file in [
@ -198,6 +199,3 @@ class Config:
except:
pass
return x_pad, x_query, x_center, x_max
defaultconfig = Config()

View File

@ -1,4 +1,6 @@
import os, sys, pdb
import os
import pdb
import sys
os.environ["OMP_NUM_THREADS"] = "2"
if sys.platform == "darwin":
@ -16,7 +18,8 @@ class Harvest(multiprocessing.Process):
self.opt_q = opt_q
def run(self):
import numpy as np, pyworld
import numpy as np
import pyworld
while 1:
idx, x, res_f0, n_cpu, ts = self.inp_q.get()
@ -33,21 +36,26 @@ class Harvest(multiprocessing.Process):
if __name__ == "__main__":
from multiprocessing import Queue
from queue import Empty
import numpy as np
import multiprocessing
import traceback, re
import json
import PySimpleGUI as sg
import sounddevice as sd
import multiprocessing
import re
import threading
import time
import traceback
from multiprocessing import Queue, cpu_count
from queue import Empty
import librosa
import noisereduce as nr
from multiprocessing import cpu_count
import librosa, torch, time, threading
import numpy as np
import PySimpleGUI as sg
import rvc_for_realtime
import sounddevice as sd
import torch
import torch.nn.functional as F
import torchaudio.transforms as tat
from i18n import I18nAuto
import rvc_for_realtime
i18n = I18nAuto()
device = rvc_for_realtime.config.device

View File

@ -1,5 +1,5 @@
import locale
import json
import locale
import os

View File

@ -1,7 +1,6 @@
import ast
import glob
import json
from collections import OrderedDict

View File

@ -1,5 +1,5 @@
import librosa
import ffmpeg
import librosa
import numpy as np

View File

@ -1,12 +1,12 @@
import copy
import math
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from infer.lib.infer_pack import commons
from infer.lib.infer_pack import modules
from infer.lib.infer_pack import commons, modules
from infer.lib.infer_pack.modules import LayerNorm

View File

@ -1,4 +1,5 @@
import math
import numpy as np
import torch
from torch import nn

View File

@ -1,17 +1,17 @@
import math, pdb, os
import math
import os
import pdb
from time import time as ttime
import numpy as np
import torch
from torch import nn
from torch.nn import AvgPool1d, Conv1d, Conv2d, ConvTranspose1d
from torch.nn import functional as F
from infer.lib.infer_pack import modules
from infer.lib.infer_pack import attentions
from infer.lib.infer_pack import commons
from infer.lib.infer_pack.commons import init_weights, get_padding
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
from infer.lib.infer_pack.commons import init_weights
import numpy as np
from infer.lib.infer_pack import commons
from torch.nn.utils import remove_weight_norm, spectral_norm, weight_norm
from infer.lib.infer_pack import attentions, commons, modules
from infer.lib.infer_pack.commons import get_padding, init_weights
class TextEncoder256(nn.Module):

View File

@ -1,17 +1,17 @@
import math, pdb, os
import math
import os
import pdb
from time import time as ttime
import numpy as np
import torch
from torch import nn
from torch.nn import AvgPool1d, Conv1d, Conv2d, ConvTranspose1d
from torch.nn import functional as F
from infer.lib.infer_pack import modules
from infer.lib.infer_pack import attentions
from infer.lib.infer_pack import commons
from infer.lib.infer_pack.commons import init_weights, get_padding
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
from infer.lib.infer_pack.commons import init_weights
import numpy as np
from infer.lib.infer_pack import commons
from torch.nn.utils import remove_weight_norm, spectral_norm, weight_norm
from infer.lib.infer_pack import attentions, commons, modules
from infer.lib.infer_pack.commons import get_padding, init_weights
class TextEncoder256(nn.Module):

View File

@ -1,19 +1,18 @@
import copy
import math
import numpy as np
import scipy
import torch
from torch import nn
from torch.nn import AvgPool1d, Conv1d, Conv2d, ConvTranspose1d
from torch.nn import functional as F
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
from torch.nn.utils import weight_norm, remove_weight_norm
from torch.nn.utils import remove_weight_norm, weight_norm
from infer.lib.infer_pack import commons
from infer.lib.infer_pack.commons import init_weights, get_padding
from infer.lib.infer_pack.commons import get_padding, init_weights
from infer.lib.infer_pack.transforms import piecewise_rational_quadratic_transform
LRELU_SLOPE = 0.1

View File

@ -1,6 +1,7 @@
from infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor
import pyworld
import numpy as np
import pyworld
from infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor
class DioF0Predictor(F0Predictor):

View File

@ -1,6 +1,7 @@
from infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor
import pyworld
import numpy as np
import pyworld
from infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor
class HarvestF0Predictor(F0Predictor):

View File

@ -1,6 +1,7 @@
from infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor
import parselmouth
import numpy as np
import parselmouth
from infer.lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor
class PMF0Predictor(F0Predictor):

View File

@ -1,6 +1,6 @@
import onnxruntime
import librosa
import numpy as np
import onnxruntime
import soundfile

View File

@ -1,9 +1,7 @@
import numpy as np
import torch
from torch.nn import functional as F
import numpy as np
DEFAULT_MIN_BIN_WIDTH = 1e-3
DEFAULT_MIN_BIN_HEIGHT = 1e-3
DEFAULT_MIN_DERIVATIVE = 1e-3

View File

@ -1,11 +1,11 @@
import torch, numpy as np, pdb
import pdb
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch, pdb
import numpy as np
import torch.nn.functional as F
from librosa.util import normalize, pad_center, tiny
from scipy.signal import get_window
from librosa.util import pad_center, tiny, normalize
###stft codes from https://github.com/pseeth/torch-stft/blob/master/torch_stft/util.py
@ -670,7 +670,8 @@ class RMVPE:
if __name__ == "__main__":
import soundfile as sf, librosa
import librosa
import soundfile as sf
audio, sampling_rate = sf.read(r"C:\Users\liujing04\Desktop\Z\冬之花clip1.wav")
if len(audio.shape) > 1:

View File

@ -1,10 +1,12 @@
import os, traceback
import os
import traceback
import numpy as np
import torch
import torch.utils.data
from infer.lib.train.mel_processing import spectrogram_torch
from infer.lib.train.utils import load_wav_to_torch, load_filepaths_and_text
from infer.lib.train.utils import load_filepaths_and_text, load_wav_to_torch
class TextAudioLoaderMultiNSFsid(torch.utils.data.Dataset):

View File

@ -2,7 +2,6 @@ import torch
import torch.utils.data
from librosa.filters import mel as librosa_mel_fn
MAX_WAV_VALUE = 32768.0

View File

@ -1,7 +1,10 @@
import torch, traceback, os, sys
import os
import sys
import traceback
from collections import OrderedDict
import torch
from i18n.i18n import I18nAuto
i18n = I18nAuto()

View File

@ -1,13 +1,15 @@
import os, traceback
import glob
import sys
import argparse
import logging
import glob
import json
import logging
import os
import subprocess
import sys
import traceback
import numpy as np
from scipy.io.wavfile import read
import torch
from scipy.io.wavfile import read
MATPLOTLIB_FLAG = False

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import spec_utils

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import spec_utils

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import spec_utils

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import spec_utils

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import spec_utils

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import spec_utils

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import spec_utils

View File

@ -1,8 +1,8 @@
import torch
from torch import nn
import torch.nn.functional as F
import layers
import torch
import torch.nn.functional as F
from torch import nn
from . import spec_utils

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import layers_123821KB as layers

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import layers_123821KB as layers

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import layers_33966KB as layers

View File

@ -1,7 +1,7 @@
import torch
import numpy as np
from torch import nn
import torch
import torch.nn.functional as F
from torch import nn
from . import layers_537238KB as layers

View File

@ -1,7 +1,7 @@
import torch
import numpy as np
from torch import nn
import torch
import torch.nn.functional as F
from torch import nn
from . import layers_537238KB as layers

View File

@ -1,6 +1,6 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import layers_123821KB as layers

View File

@ -1,6 +1,7 @@
import torch
from torch import nn
import torch.nn.functional as F
from torch import nn
from . import layers_new

View File

@ -1,8 +1,12 @@
import os, librosa
import hashlib
import json
import math
import os
import librosa
import numpy as np
import soundfile as sf
from tqdm import tqdm
import json, math, hashlib
def crop_center(h1, h2):
@ -519,10 +523,11 @@ def istft(spec, hl):
if __name__ == "__main__":
import cv2
import argparse
import sys
import time
import argparse
import cv2
from model_param_init import ModelParameters
p = argparse.ArgumentParser()

View File

@ -1,8 +1,9 @@
import torch
import numpy as np
from tqdm import tqdm
import json
import numpy as np
import torch
from tqdm import tqdm
def load_data(file_name: str = "./infer/lib/uvr5_pack/name_params.json") -> dict:
with open(file_name, "r") as f:

View File

@ -1,10 +1,16 @@
import os, traceback, sys, parselmouth
import os
import sys
import traceback
import parselmouth
now_dir = os.getcwd()
sys.path.append(now_dir)
from lib.audio import load_audio
import logging
import numpy as np
import pyworld
import numpy as np, logging
from lib.audio import load_audio
logging.getLogger("numba").setLevel(logging.WARNING)
from multiprocessing import Process

View File

@ -1,10 +1,16 @@
import os, traceback, sys, parselmouth
import os
import sys
import traceback
import parselmouth
now_dir = os.getcwd()
sys.path.append(now_dir)
from lib.audio import load_audio
import logging
import numpy as np
import pyworld
import numpy as np, logging
from lib.audio import load_audio
logging.getLogger("numba").setLevel(logging.WARNING)

View File

@ -1,10 +1,16 @@
import os, traceback, sys, parselmouth
import os
import sys
import traceback
import parselmouth
now_dir = os.getcwd()
sys.path.append(now_dir)
from lib.audio import load_audio
import logging
import numpy as np
import pyworld
import numpy as np, logging
from lib.audio import load_audio
logging.getLogger("numba").setLevel(logging.WARNING)

View File

@ -1,4 +1,6 @@
import os, sys, traceback
import os
import sys
import traceback
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
os.environ["PYTORCH_MPS_HIGH_WATERMARK_RATIO"] = "0.0"
@ -14,11 +16,11 @@ else:
exp_dir = sys.argv[5]
os.environ["CUDA_VISIBLE_DEVICES"] = str(i_gpu)
version = sys.argv[6]
import fairseq
import numpy as np
import soundfile as sf
import torch
import torch.nn.functional as F
import soundfile as sf
import numpy as np
import fairseq
if "privateuseone" not in device:
device = "cpu"

View File

@ -1,4 +1,7 @@
import sys, os, multiprocessing
import multiprocessing
import os
import sys
from scipy import signal
now_dir = os.getcwd()
@ -9,12 +12,15 @@ sr = int(sys.argv[2])
n_p = int(sys.argv[3])
exp_dir = sys.argv[4]
noparallel = sys.argv[5] == "True"
import numpy as np, os, traceback
from lib.slicer2 import Slicer
import librosa, traceback
from scipy.io import wavfile
import multiprocessing
import os
import traceback
import librosa
import numpy as np
from lib.audio import load_audio
from lib.slicer2 import Slicer
from scipy.io import wavfile
mutex = multiprocessing.Lock()
f = open("%s/preprocess.log" % exp_dir, "a+")

View File

@ -1,43 +1,47 @@
import os, sys
import os
import sys
now_dir = os.getcwd()
sys.path.append(os.path.join(now_dir))
from infer.lib.train import utils
import datetime
from infer.lib.train import utils
hps = utils.get_hparams()
os.environ["CUDA_VISIBLE_DEVICES"] = hps.gpus.replace("-", ",")
n_gpus = len(hps.gpus.split("-"))
from random import shuffle, randint
from random import randint, shuffle
import torch
torch.backends.cudnn.deterministic = False
torch.backends.cudnn.benchmark = False
from torch.nn import functional as F
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
import torch.multiprocessing as mp
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.cuda.amp import autocast, GradScaler
from infer.lib.infer_pack import commons
from time import sleep
from time import time as ttime
import torch.distributed as dist
import torch.multiprocessing as mp
from torch.cuda.amp import GradScaler, autocast
from torch.nn import functional as F
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from infer.lib.infer_pack import commons
from infer.lib.train.data_utils import (
TextAudioLoaderMultiNSFsid,
TextAudioLoader,
TextAudioCollateMultiNSFsid,
TextAudioCollate,
DistributedBucketSampler,
TextAudioCollate,
TextAudioCollateMultiNSFsid,
TextAudioLoader,
TextAudioLoaderMultiNSFsid,
)
if hps.version == "v1":
from infer.lib.infer_pack.models import MultiPeriodDiscriminator
from infer.lib.infer_pack.models import SynthesizerTrnMs256NSFsid as RVC_Model_f0
from infer.lib.infer_pack.models import (
SynthesizerTrnMs256NSFsid as RVC_Model_f0,
SynthesizerTrnMs256NSFsid_nono as RVC_Model_nof0,
MultiPeriodDiscriminator,
)
else:
from infer.lib.infer_pack.models import (
@ -45,10 +49,11 @@ else:
SynthesizerTrnMs768NSFsid_nono as RVC_Model_nof0,
MultiPeriodDiscriminatorV2 as MultiPeriodDiscriminator,
)
from infer.lib.train.losses import (
generator_loss,
discriminator_loss,
feature_loss,
generator_loss,
kl_loss,
)
from infer.lib.train.mel_processing import mel_spectrogram_torch, spec_to_mel_torch

View File

@ -1,12 +1,12 @@
import os
import warnings
import soundfile as sf
import librosa
import numpy as np
import onnxruntime as ort
from tqdm import tqdm
import soundfile as sf
import torch
from tqdm import tqdm
cpu = torch.device("cpu")

View File

@ -1,12 +1,12 @@
import os
import traceback
import torch
import ffmpeg
import torch
from configs.config import Config
from infer.modules.uvr5.preprocess import AudioPre, AudioPreDeEcho
from infer.modules.uvr5.mdxnet import MDXNetDereverb
from infer.modules.uvr5.preprocess import AudioPre, AudioPreDeEcho
config = Config()

View File

@ -1,16 +1,15 @@
import os
import torch
import librosa
import numpy as np
import soundfile as sf
import torch
from infer.lib.uvr5_pack.lib_v5 import spec_utils
from infer.lib.uvr5_pack.utils import inference
from infer.lib.uvr5_pack.lib_v5.model_param_init import ModelParameters
from infer.lib.uvr5_pack.lib_v5.nets_new import CascadedNet
from infer.lib.uvr5_pack.lib_v5 import nets_61968KB as Nets
from infer.lib.uvr5_pack.lib_v5 import spec_utils
from infer.lib.uvr5_pack.lib_v5.model_param_init import ModelParameters
from infer.lib.uvr5_pack.lib_v5.nets_new import CascadedNet
from infer.lib.uvr5_pack.utils import inference
class AudioPre:

View File

@ -1,9 +1,10 @@
import traceback
import numpy as np
import torch
import soundfile as sf
import torch
from infer.lib.audio import load_audio
from infer.lib.infer_pack.models import (
SynthesizerTrnMs256NSFsid,
SynthesizerTrnMs256NSFsid_nono,
@ -12,7 +13,6 @@ from infer.lib.infer_pack.models import (
)
from infer.modules.vc.pipeline import Pipeline
from infer.modules.vc.utils import *
from infer.lib.audio import load_audio
class VC:

View File

@ -1,13 +1,18 @@
import os
import sys
import traceback
from functools import lru_cache
from time import time as ttime
import faiss
import librosa
import numpy as np
import parselmouth
import pyworld
import torch
import torch.nn.functional as F
import pyworld, os, traceback, faiss, librosa, torchcrepe
import torchcrepe
from scipy import signal
from functools import lru_cache
now_dir = os.getcwd()
sys.path.append(now_dir)

View File

@ -1,6 +1,8 @@
# This code references https://huggingface.co/JosephusCheung/ASimilarityCalculatior/blob/main/qwerty.py
# Fill in the path of the model to be queried and the root directory of the reference models, and this script will return the similarity between the model to be queried and all reference models.
import sys, os
import os
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F

View File

@ -1,5 +1,5 @@
from lib.infer_pack.models_onnx import SynthesizerTrnMsNSFsidM
import torch
from lib.infer_pack.models_onnx import SynthesizerTrnMsNSFsidM
if __name__ == "__main__":
MoeVS = True # 模型是否为MoeVoiceStudio原MoeSS使用

View File

@ -2,34 +2,36 @@
对源特征进行检索
"""
import torch, pdb, os, parselmouth
import os
import pdb
import parselmouth
import torch
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
# import torchcrepe
from time import time as ttime
# import pyworld
import librosa
import numpy as np
import scipy.signal as signal
import soundfile as sf
import torch.nn.functional as F
from fairseq import checkpoint_utils
# from models import SynthesizerTrn256#hifigan_nonsf
# from lib.infer_pack.models import SynthesizerTrn256NSF as SynthesizerTrn256#hifigan_nsf
from lib.infer_pack.models import (
SynthesizerTrnMs256NSFsid as SynthesizerTrn256,
) # hifigan_nsf
from scipy.io import wavfile
# from lib.infer_pack.models import SynthesizerTrnMs256NSFsid_sim as SynthesizerTrn256#hifigan_nsf
# from models import SynthesizerTrn256NSFsim as SynthesizerTrn256#hifigan_nsf
# from models import SynthesizerTrn256NSFsimFlow as SynthesizerTrn256#hifigan_nsf
from scipy.io import wavfile
from fairseq import checkpoint_utils
# import pyworld
import librosa
import torch.nn.functional as F
import scipy.signal as signal
# import torchcrepe
from time import time as ttime
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_path = r"E:\codes\py39\vits_vc_gpu_train\hubert_base.pt" #
print("load model(s) from {}".format(model_path))

View File

@ -1,11 +1,14 @@
"""
格式直接cid为自带的index位aid放不下了通过字典来查反正就5w个
"""
import faiss, numpy as np, os
from sklearn.cluster import MiniBatchKMeans
import os
import traceback
from multiprocessing import cpu_count
import faiss
import numpy as np
from sklearn.cluster import MiniBatchKMeans
# ###########如果是原始特征要先写save
n_cpu = 0
if n_cpu == 0:

View File

@ -1,7 +1,10 @@
"""
格式直接cid为自带的index位aid放不下了通过字典来查反正就5w个
"""
import faiss, numpy as np, os
import os
import faiss
import numpy as np
# ###########如果是原始特征要先写save
inp_root = r"E:\codes\py39\dataset\mi\2-co256"

View File

@ -1,4 +1,6 @@
import torch, pdb
import pdb
import torch
# a=torch.load(r"E:\codes\py39\vits_vc_gpu_train\logs\ft-mi-suc\G_1000.pth")["model"]#sim_nsf#
# a=torch.load(r"E:\codes\py39\vits_vc_gpu_train\logs\ft-mi-freeze-vocoder-flow-enc_q\G_1000.pth")["model"]#sim_nsf#

View File

@ -1,4 +1,5 @@
import soundfile
from ..lib.infer_pack.onnx_inference import OnnxRVC
hop_size = 512