1
0
mirror of synced 2024-11-15 03:07:40 +01:00

Format code (#89)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2023-04-17 14:09:03 +00:00 committed by GitHub
parent 35379217e8
commit 1e71efb265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

10
gui.py
View File

@ -35,7 +35,7 @@ class RVC:
if index_rate != 0:
self.index = faiss.read_index(index_path)
self.big_npy = np.load(npy_path)
print('index search enabled')
print("index search enabled")
self.index_rate = index_rate
model_path = hubert_path
print("load model(s) from {}".format(model_path))
@ -111,11 +111,7 @@ class RVC:
feats = self.model.final_proj(logits[0])
####索引优化
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")
_, I = self.index.search(npy, 1)
npy = self.big_npy[I.squeeze()].astype("float16")
@ -124,7 +120,7 @@ class RVC:
+ (1 - self.index_rate) * feats
)
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)
torch.cuda.synchronize()