mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-01-31 02:32:51 +08:00
Format code (#89)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
35379217e8
commit
1e71efb265
12
gui.py
12
gui.py
@ -32,10 +32,10 @@ class RVC:
|
|||||||
self.f0_max = 1100
|
self.f0_max = 1100
|
||||||
self.f0_mel_min = 1127 * np.log(1 + self.f0_min / 700)
|
self.f0_mel_min = 1127 * np.log(1 + self.f0_min / 700)
|
||||||
self.f0_mel_max = 1127 * np.log(1 + self.f0_max / 700)
|
self.f0_mel_max = 1127 * np.log(1 + self.f0_max / 700)
|
||||||
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)
|
||||||
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
|
||||||
print("load model(s) from {}".format(model_path))
|
print("load model(s) from {}".format(model_path))
|
||||||
@ -111,11 +111,7 @@ class RVC:
|
|||||||
feats = self.model.final_proj(logits[0])
|
feats = self.model.final_proj(logits[0])
|
||||||
|
|
||||||
####索引优化
|
####索引优化
|
||||||
if (
|
if hasattr(self, "index") and hasattr(self, "big_npy") and self.index_rate != 0:
|
||||||
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)
|
_, I = self.index.search(npy, 1)
|
||||||
npy = self.big_npy[I.squeeze()].astype("float16")
|
npy = self.big_npy[I.squeeze()].astype("float16")
|
||||||
@ -124,7 +120,7 @@ class RVC:
|
|||||||
+ (1 - self.index_rate) * feats
|
+ (1 - self.index_rate) * feats
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print('index search FAIL or disabled')
|
print("index search FAIL or disabled")
|
||||||
|
|
||||||
feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1)
|
feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1)
|
||||||
torch.cuda.synchronize()
|
torch.cuda.synchronize()
|
||||||
|
Loading…
Reference in New Issue
Block a user