mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-05-06 20:01:37 +08:00
optimize(vc): use np.divide instead of general /
This commit is contained in:
parent
2991e75fc0
commit
7e8c3530d4
@ -146,7 +146,7 @@ class Config:
|
|||||||
self.preprocess_per = 3.0
|
self.preprocess_per = 3.0
|
||||||
logger.info("overwrite preprocess_per to %d" % (self.preprocess_per))
|
logger.info("overwrite preprocess_per to %d" % (self.preprocess_per))
|
||||||
|
|
||||||
def device_config(self) -> tuple:
|
def device_config(self):
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
if self.has_xpu():
|
if self.has_xpu():
|
||||||
self.device = self.instead = "xpu:0"
|
self.device = self.instead = "xpu:0"
|
||||||
|
@ -163,7 +163,7 @@ class VC:
|
|||||||
audio = load_audio(input_audio_path, 16000)
|
audio = load_audio(input_audio_path, 16000)
|
||||||
audio_max = np.abs(audio).max() / 0.95
|
audio_max = np.abs(audio).max() / 0.95
|
||||||
if audio_max > 1:
|
if audio_max > 1:
|
||||||
audio /= audio_max
|
np.divide(audio, audio_max, audio)
|
||||||
times = [0, 0, 0]
|
times = [0, 0, 0]
|
||||||
|
|
||||||
if self.hubert_model is None:
|
if self.hubert_model is None:
|
||||||
|
@ -2,6 +2,8 @@ import os
|
|||||||
|
|
||||||
from fairseq import checkpoint_utils
|
from fairseq import checkpoint_utils
|
||||||
|
|
||||||
|
from configs.config import singleton_variable
|
||||||
|
|
||||||
|
|
||||||
def get_index_path_from_model(sid):
|
def get_index_path_from_model(sid):
|
||||||
return next(
|
return next(
|
||||||
@ -20,6 +22,7 @@ def get_index_path_from_model(sid):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@singleton_variable
|
||||||
def load_hubert(device, is_half):
|
def load_hubert(device, is_half):
|
||||||
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
|
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
|
||||||
["assets/hubert/hubert_base.pt"],
|
["assets/hubert/hubert_base.pt"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user