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_mel_min = 1127 * np.log(1 + self.f0_min / 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.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()
|
||||
|
Loading…
Reference in New Issue
Block a user