feat(gui): trained_xxxx.index hint (fix #1070)
This commit is contained in:
parent
918ab7b62f
commit
3b2a1d081c
@ -530,7 +530,7 @@ if __name__ == "__main__":
|
|||||||
self.gui_config.sg_hostapi = self.hostapis[0]
|
self.gui_config.sg_hostapi = self.hostapis[0]
|
||||||
self.window["sg_hostapi"].Update(values=self.hostapis)
|
self.window["sg_hostapi"].Update(values=self.hostapis)
|
||||||
self.window["sg_hostapi"].Update(value=self.gui_config.sg_hostapi)
|
self.window["sg_hostapi"].Update(value=self.gui_config.sg_hostapi)
|
||||||
if self.gui_config.sg_input_device not in self.input_devices:
|
if self.gui_config.sg_input_device not in self.input_devices and len(self.input_devices) > 0:
|
||||||
self.gui_config.sg_input_device = self.input_devices[0]
|
self.gui_config.sg_input_device = self.input_devices[0]
|
||||||
self.window["sg_input_device"].Update(values=self.input_devices)
|
self.window["sg_input_device"].Update(values=self.input_devices)
|
||||||
self.window["sg_input_device"].Update(
|
self.window["sg_input_device"].Update(
|
||||||
|
@ -372,15 +372,17 @@ class RVC:
|
|||||||
if hasattr(self, "index") and self.index_rate != 0:
|
if hasattr(self, "index") and self.index_rate != 0:
|
||||||
npy = feats[0][skip_head // 2 :].cpu().numpy().astype("float32")
|
npy = feats[0][skip_head // 2 :].cpu().numpy().astype("float32")
|
||||||
score, ix = self.index.search(npy, k=8)
|
score, ix = self.index.search(npy, k=8)
|
||||||
weight = np.square(1 / score)
|
if (ix >= 0).all():
|
||||||
weight /= weight.sum(axis=1, keepdims=True)
|
weight = np.square(1 / score)
|
||||||
npy = np.sum(self.big_npy[ix] * np.expand_dims(weight, axis=2), axis=1)
|
weight /= weight.sum(axis=1, keepdims=True)
|
||||||
if self.config.is_half:
|
npy = np.sum(self.big_npy[ix] * np.expand_dims(weight, axis=2), axis=1)
|
||||||
npy = npy.astype("float16")
|
if self.config.is_half:
|
||||||
feats[0][skip_head // 2 :] = (
|
npy = npy.astype("float16")
|
||||||
torch.from_numpy(npy).unsqueeze(0).to(self.device) * self.index_rate
|
feats[0][skip_head // 2 :] = (
|
||||||
+ (1 - self.index_rate) * feats[0][skip_head // 2 :]
|
torch.from_numpy(npy).unsqueeze(0).to(self.device) * self.index_rate
|
||||||
)
|
+ (1 - self.index_rate) * feats[0][skip_head // 2 :]
|
||||||
|
)
|
||||||
|
else: printt("Invalid index. You MUST use added_xxxx.index but not trained_xxxx.index!")
|
||||||
else:
|
else:
|
||||||
printt("Index search FAILED or disabled")
|
printt("Index search FAILED or disabled")
|
||||||
except:
|
except:
|
||||||
|
Loading…
Reference in New Issue
Block a user