This commit is contained in:
KamioRinn 2024-02-05 01:29:16 +08:00
parent e3d792fb56
commit 147218c529
2 changed files with 5 additions and 6 deletions

View File

@ -239,7 +239,7 @@ class Predictor:
class MDXNetDereverb: class MDXNetDereverb:
def __init__(self, chunks, device): def __init__(self, chunks):
self.onnx = "%s/uvr5_weights/onnx_dereverb_By_FoxJoy"%os.path.dirname(os.path.abspath(__file__)) self.onnx = "%s/uvr5_weights/onnx_dereverb_By_FoxJoy"%os.path.dirname(os.path.abspath(__file__))
self.shifts = 10 # 'Predict with randomised equivariant stabilisation' self.shifts = 10 # 'Predict with randomised equivariant stabilisation'
self.mixing = "min_mag" # ['default','min_mag','max_mag'] self.mixing = "min_mag" # ['default','min_mag','max_mag']
@ -250,7 +250,7 @@ class MDXNetDereverb:
self.n_fft = 6144 self.n_fft = 6144
self.denoise = True self.denoise = True
self.pred = Predictor(self) self.pred = Predictor(self)
self.device = device self.device = cpu
def _path_audio_(self, input, vocal_root, others_root, format, is_hp3=False): def _path_audio_(self, input, vocal_root, others_root, format, is_hp3=False):
self.pred.prediction(input, vocal_root, others_root, format) self.pred.prediction(input, vocal_root, others_root, format)

View File

@ -33,9 +33,8 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format
save_root_ins = ( save_root_ins = (
save_root_ins.strip(" ").strip('"').strip("\n").strip('"').strip(" ") save_root_ins.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
) )
is_hp3 = "HP3" in model_name
if model_name == "onnx_dereverb_By_FoxJoy": if model_name == "onnx_dereverb_By_FoxJoy":
from MDXNet import MDXNetDereverb
pre_fun = MDXNetDereverb(15) pre_fun = MDXNetDereverb(15)
else: else:
func = AudioPre if "DeEcho" not in model_name else AudioPreDeEcho func = AudioPre if "DeEcho" not in model_name else AudioPreDeEcho
@ -62,7 +61,7 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format
): ):
need_reformat = 0 need_reformat = 0
pre_fun._path_audio_( pre_fun._path_audio_(
inp_path, save_root_ins, save_root_vocal, format0 inp_path, save_root_ins, save_root_vocal, format0,is_hp3
) )
done = 1 done = 1
except: except:
@ -81,7 +80,7 @@ def uvr(model_name, inp_root, save_root_vocal, paths, save_root_ins, agg, format
try: try:
if done == 0: if done == 0:
pre_fun._path_audio_( pre_fun._path_audio_(
inp_path, save_root_ins, save_root_vocal, format0 inp_path, save_root_ins, save_root_vocal, format0,is_hp3
) )
infos.append("%s->Success" % (os.path.basename(inp_path))) infos.append("%s->Success" % (os.path.basename(inp_path)))
yield "\n".join(infos) yield "\n".join(infos)