mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-05-07 04:09:06 +08:00
optimize(vc): use np.multiply instead of general *
This commit is contained in:
parent
976869e5fb
commit
7e48279c6c
@ -32,7 +32,7 @@ version_config_list = [
|
|||||||
|
|
||||||
def singleton_variable(func):
|
def singleton_variable(func):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
if not wrapper.instance:
|
if wrapper.instance is None:
|
||||||
wrapper.instance = func(*args, **kwargs)
|
wrapper.instance = func(*args, **kwargs)
|
||||||
return wrapper.instance
|
return wrapper.instance
|
||||||
|
|
||||||
|
@ -6,6 +6,10 @@ now_dir = os.getcwd()
|
|||||||
sys.path.append(now_dir)
|
sys.path.append(now_dir)
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
load_dotenv("sha256.env")
|
load_dotenv("sha256.env")
|
||||||
|
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
|
||||||
|
|
||||||
from infer.modules.vc import VC
|
from infer.modules.vc import VC
|
||||||
from infer.modules.uvr5.modules import uvr
|
from infer.modules.uvr5.modules import uvr
|
||||||
from infer.lib.train.process_ckpt import (
|
from infer.lib.train.process_ckpt import (
|
||||||
|
@ -201,7 +201,7 @@ class VC:
|
|||||||
self.version,
|
self.version,
|
||||||
protect,
|
protect,
|
||||||
f0_file,
|
f0_file,
|
||||||
)
|
).astype(np.int16)
|
||||||
if self.tgt_sr != resample_sr >= 16000:
|
if self.tgt_sr != resample_sr >= 16000:
|
||||||
tgt_sr = resample_sr
|
tgt_sr = resample_sr
|
||||||
else:
|
else:
|
||||||
|
@ -288,7 +288,7 @@ class Pipeline(object):
|
|||||||
hasp = pitch is not None and pitchf is not None
|
hasp = pitch is not None and pitchf is not None
|
||||||
arg = (feats, p_len, pitch, pitchf, sid) if hasp else (feats, p_len, sid)
|
arg = (feats, p_len, pitch, pitchf, sid) if hasp else (feats, p_len, sid)
|
||||||
audio1 = (net_g.infer(*arg)[0][0, 0]).data.cpu().float().numpy()
|
audio1 = (net_g.infer(*arg)[0][0, 0]).data.cpu().float().numpy()
|
||||||
del hasp, arg
|
del arg
|
||||||
del feats, p_len, padding_mask
|
del feats, p_len, padding_mask
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
@ -469,7 +469,7 @@ class Pipeline(object):
|
|||||||
max_int16 = 32768
|
max_int16 = 32768
|
||||||
if audio_max > 1:
|
if audio_max > 1:
|
||||||
max_int16 /= audio_max
|
max_int16 /= audio_max
|
||||||
audio_opt = (audio_opt * max_int16).astype(np.int16)
|
np.multiply(audio_opt, max_int16, audio_opt)
|
||||||
del pitch, pitchf, sid
|
del pitch, pitchf, sid
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user