Skip to content

Commit 1e71efb

Browse files
Format code (#89)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 3537921 commit 1e71efb

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

gui.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ def __init__(
3232
self.f0_max = 1100
3333
self.f0_mel_min = 1127 * np.log(1 + self.f0_min / 700)
3434
self.f0_mel_max = 1127 * np.log(1 + self.f0_max / 700)
35-
if index_rate !=0:
35+
if index_rate != 0:
3636
self.index = faiss.read_index(index_path)
3737
self.big_npy = np.load(npy_path)
38-
print('index search enabled')
38+
print("index search enabled")
3939
self.index_rate = index_rate
4040
model_path = hubert_path
4141
print("load model(s) from {}".format(model_path))
@@ -111,11 +111,7 @@ def infer(self, feats: torch.Tensor) -> np.ndarray:
111111
feats = self.model.final_proj(logits[0])
112112

113113
####索引优化
114-
if (
115-
hasattr(self,'index')
116-
and hasattr(self,'big_npy')
117-
and self.index_rate != 0
118-
):
114+
if hasattr(self, "index") and hasattr(self, "big_npy") and self.index_rate != 0:
119115
npy = feats[0].cpu().numpy().astype("float32")
120116
_, I = self.index.search(npy, 1)
121117
npy = self.big_npy[I.squeeze()].astype("float16")
@@ -124,7 +120,7 @@ def infer(self, feats: torch.Tensor) -> np.ndarray:
124120
+ (1 - self.index_rate) * feats
125121
)
126122
else:
127-
print('index search FAIL or disabled')
123+
print("index search FAIL or disabled")
128124

129125
feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1)
130126
torch.cuda.synchronize()

0 commit comments

Comments
 (0)