mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-01-01 12:35:04 +08:00
Add files via upload
This commit is contained in:
parent
b18f921a50
commit
da34d75ec9
@ -55,10 +55,11 @@ class Config:
|
|||||||
if (
|
if (
|
||||||
("16" in self.gpu_name and "V100" not in self.gpu_name.upper())
|
("16" in self.gpu_name and "V100" not in self.gpu_name.upper())
|
||||||
or "P40" in self.gpu_name.upper()
|
or "P40" in self.gpu_name.upper()
|
||||||
|
or "1060" in self.gpu_name
|
||||||
or "1070" in self.gpu_name
|
or "1070" in self.gpu_name
|
||||||
or "1080" in self.gpu_name
|
or "1080" in self.gpu_name
|
||||||
):
|
):
|
||||||
print("16系显卡强制单精度")
|
print("16系/10系显卡和P40强制单精度")
|
||||||
self.is_half = False
|
self.is_half = False
|
||||||
for config_file in ["32k.json", "40k.json", "48k.json"]:
|
for config_file in ["32k.json", "40k.json", "48k.json"]:
|
||||||
with open(f"configs/{config_file}", "r") as f:
|
with open(f"configs/{config_file}", "r") as f:
|
||||||
|
18
gui.py
18
gui.py
@ -38,7 +38,8 @@ class RVC:
|
|||||||
self.window = 160
|
self.window = 160
|
||||||
if index_rate != 0:
|
if index_rate != 0:
|
||||||
self.index = faiss.read_index(index_path)
|
self.index = faiss.read_index(index_path)
|
||||||
self.big_npy = np.load(npy_path)
|
# self.big_npy = np.load(npy_path)
|
||||||
|
self.big_npy = index.reconstruct_n(0, self.index.ntotal)
|
||||||
print("index search enabled")
|
print("index search enabled")
|
||||||
self.index_rate = index_rate
|
self.index_rate = index_rate
|
||||||
model_path = hubert_path
|
model_path = hubert_path
|
||||||
@ -125,8 +126,15 @@ class RVC:
|
|||||||
####索引优化
|
####索引优化
|
||||||
if hasattr(self, "index") and hasattr(self, "big_npy") and self.index_rate != 0:
|
if hasattr(self, "index") and hasattr(self, "big_npy") and self.index_rate != 0:
|
||||||
npy = feats[0].cpu().numpy().astype("float32")
|
npy = feats[0].cpu().numpy().astype("float32")
|
||||||
_, I = self.index.search(npy, 1)
|
|
||||||
npy = self.big_npy[I.squeeze()].astype("float16")
|
# _, I = self.index.search(npy, 1)
|
||||||
|
# npy = self.big_npy[I.squeeze()].astype("float16")
|
||||||
|
|
||||||
|
score, ix = index.search(npy, k=8)
|
||||||
|
weight = np.square(1 / score)
|
||||||
|
weight /= weight.sum(axis=1, keepdims=True)
|
||||||
|
npy = np.sum(big_npy[ix] * np.expand_dims(weight, axis=2), axis=1).astype("float16")
|
||||||
|
|
||||||
feats = (
|
feats = (
|
||||||
torch.from_numpy(npy).unsqueeze(0).to(device) * self.index_rate
|
torch.from_numpy(npy).unsqueeze(0).to(device) * self.index_rate
|
||||||
+ (1 - self.index_rate) * feats
|
+ (1 - self.index_rate) * feats
|
||||||
@ -204,7 +212,7 @@ class GUI:
|
|||||||
layout=[
|
layout=[
|
||||||
[
|
[
|
||||||
sg.Input(
|
sg.Input(
|
||||||
default_text="TEMP\\hubert_base.pt", key="hubert_path"
|
default_text="hubert_base.pt", key="hubert_path"
|
||||||
),
|
),
|
||||||
sg.FileBrowse(i18n("Hubert模型")),
|
sg.FileBrowse(i18n("Hubert模型")),
|
||||||
],
|
],
|
||||||
@ -221,7 +229,7 @@ class GUI:
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Input(
|
sg.Input(
|
||||||
default_text="TEMP\\big_src_feature_atri.npy",
|
default_text="你不需要填写这个You don't need write this.",
|
||||||
key="npy_path",
|
key="npy_path",
|
||||||
),
|
),
|
||||||
sg.FileBrowse(i18n("选择.npy文件")),
|
sg.FileBrowse(i18n("选择.npy文件")),
|
||||||
|
@ -1312,7 +1312,7 @@ with gr.Blocks() as app:
|
|||||||
interactive=True,
|
interactive=True,
|
||||||
)
|
)
|
||||||
batch_size12 = gr.Slider(
|
batch_size12 = gr.Slider(
|
||||||
minimum=0,
|
minimum=1,
|
||||||
maximum=40,
|
maximum=40,
|
||||||
step=1,
|
step=1,
|
||||||
label=i18n("每张显卡的batch_size"),
|
label=i18n("每张显卡的batch_size"),
|
||||||
@ -1540,4 +1540,4 @@ with gr.Blocks() as app:
|
|||||||
inbrowser=not config.noautoopen,
|
inbrowser=not config.noautoopen,
|
||||||
server_port=config.listen_port,
|
server_port=config.listen_port,
|
||||||
quiet=True,
|
quiet=True,
|
||||||
)
|
)
|
Loading…
Reference in New Issue
Block a user