1
0
mirror of synced 2024-12-18 02:16:08 +01:00

Add files via upload

This commit is contained in:
liujing04 2023-04-16 18:56:20 +08:00 committed by GitHub
parent 5bcaa171ea
commit 0719b4aa5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 5 deletions

2
go-realtime-gui.bat Normal file
View File

@ -0,0 +1,2 @@
runtime\python.exe gui.py
pause

5
gui.py
View File

@ -1,3 +1,6 @@
import os,sys
now_dir = os.getcwd()
sys.path.append(now_dir)
import PySimpleGUI as sg import PySimpleGUI as sg
import sounddevice as sd import sounddevice as sd
import noisereduce as nr import noisereduce as nr
@ -12,7 +15,7 @@ from infer_pack.models import SynthesizerTrnMs256NSFsid, SynthesizerTrnMs256NSFs
from i18n import I18nAuto from i18n import I18nAuto
i18n = I18nAuto() i18n = I18nAuto()
print(i18n.language_map)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

View File

@ -139,6 +139,8 @@ def vc_single(
if hubert_model == None: if hubert_model == None:
load_hubert() load_hubert()
if_f0 = cpt.get("f0", 1) if_f0 = cpt.get("f0", 1)
file_index = file_index.strip(" ").strip('"').strip("\n").strip('"').strip(" ").replace("trained","added")#防止小白写错,自动帮他替换掉
file_big_npy = file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
audio_opt = vc.pipeline( audio_opt = vc.pipeline(
hubert_model, hubert_model,
net_g, net_g,
@ -936,7 +938,7 @@ with gr.Blocks() as app:
minimum=0, minimum=0,
maximum=1, maximum=1,
label="检索特征占比", label="检索特征占比",
value=1, value=0.6,
interactive=True, interactive=True,
) )
f0_file = gr.File(label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调")) f0_file = gr.File(label=i18n("F0曲线文件, 可选, 一行一个音高, 代替默认F0及升降调"))

View File

@ -21,7 +21,7 @@ import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP from torch.nn.parallel import DistributedDataParallel as DDP
from torch.cuda.amp import autocast, GradScaler from torch.cuda.amp import autocast, GradScaler
from infer_pack import commons from infer_pack import commons
from time import sleep
from time import time as ttime from time import time as ttime
from data_utils import ( from data_utils import (
TextAudioLoaderMultiNSFsid, TextAudioLoaderMultiNSFsid,
@ -45,7 +45,7 @@ global_step = 0
def main(): def main():
# n_gpus = torch.cuda.device_count() # n_gpus = torch.cuda.device_count()
os.environ["MASTER_ADDR"] = "localhost" os.environ["MASTER_ADDR"] = "localhost"
os.environ["MASTER_PORT"] = "5555" os.environ["MASTER_PORT"] = "51515"
mp.spawn( mp.spawn(
run, run,
@ -676,6 +676,7 @@ def train_and_evaluate(
"saving final ckpt:%s" "saving final ckpt:%s"
% (savee(ckpt, hps.sample_rate, hps.if_f0, hps.name, epoch)) % (savee(ckpt, hps.sample_rate, hps.if_f0, hps.name, epoch))
) )
sleep(1)
os._exit(2333333) os._exit(2333333)

View File

@ -1,4 +1,5 @@
import sys, os, multiprocessing import sys, os, multiprocessing
from scipy import signal
now_dir = os.getcwd() now_dir = os.getcwd()
sys.path.append(now_dir) sys.path.append(now_dir)
@ -38,6 +39,7 @@ class PreProcess:
max_sil_kept=150, max_sil_kept=150,
) )
self.sr = sr self.sr = sr
self.bh, self.ah = signal.butter(N=5, Wn=48, btype='high', fs=self.sr)
self.per = 3.7 self.per = 3.7
self.overlap = 0.3 self.overlap = 0.3
self.tail = self.per + self.overlap self.tail = self.per + self.overlap
@ -69,6 +71,7 @@ class PreProcess:
def pipeline(self, path, idx0): def pipeline(self, path, idx0):
try: try:
audio = load_audio(path, self.sr) audio = load_audio(path, self.sr)
audio = signal.filtfilt(self.bh, self.ah, audio)
idx1 = 0 idx1 = 0
for audio in self.slicer.slice(audio): for audio in self.slicer.slice(audio):
i = 0 i = 0

View File

@ -4,7 +4,8 @@ import torch.nn.functional as F
from config import x_pad, x_query, x_center, x_max from config import x_pad, x_query, x_center, x_max
import scipy.signal as signal import scipy.signal as signal
import pyworld, os, traceback, faiss import pyworld, os, traceback, faiss
from scipy import signal
bh, ah = signal.butter(N=5, Wn=48, btype='high', fs=16000)
class VC(object): class VC(object):
def __init__(self, tgt_sr, device, is_half): def __init__(self, tgt_sr, device, is_half):
@ -189,6 +190,7 @@ class VC(object):
index = big_npy = None index = big_npy = None
else: else:
index = big_npy = None index = big_npy = None
audio = signal.filtfilt(bh, ah, audio)
audio_pad = np.pad(audio, (self.window // 2, self.window // 2), mode="reflect") audio_pad = np.pad(audio, (self.window // 2, self.window // 2), mode="reflect")
opt_ts = [] opt_ts = []
if audio_pad.shape[0] > self.t_max: if audio_pad.shape[0] > self.t_max: