Format code (#221)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
ccf6e6bbd2
commit
6726af00cf
8
gui.py
8
gui.py
@ -133,7 +133,9 @@ class RVC:
|
||||
score, ix = index.search(npy, k=8)
|
||||
weight = np.square(1 / score)
|
||||
weight /= weight.sum(axis=1, keepdims=True)
|
||||
npy = np.sum(big_npy[ix] * np.expand_dims(weight, axis=2), axis=1).astype("float16")
|
||||
npy = np.sum(big_npy[ix] * np.expand_dims(weight, axis=2), axis=1).astype(
|
||||
"float16"
|
||||
)
|
||||
|
||||
feats = (
|
||||
torch.from_numpy(npy).unsqueeze(0).to(device) * self.index_rate
|
||||
@ -211,9 +213,7 @@ class GUI:
|
||||
title=i18n("加载模型"),
|
||||
layout=[
|
||||
[
|
||||
sg.Input(
|
||||
default_text="hubert_base.pt", key="hubert_path"
|
||||
),
|
||||
sg.Input(default_text="hubert_base.pt", key="hubert_path"),
|
||||
sg.FileBrowse(i18n("Hubert模型")),
|
||||
],
|
||||
[
|
||||
|
14
infer-web.py
14
infer-web.py
@ -694,9 +694,9 @@ def train_index(exp_dir1):
|
||||
# faiss.write_index(index, '%s/trained_IVF%s_Flat_FastScan.index'%(exp_dir,n_ivf))
|
||||
infos.append("adding")
|
||||
yield "\n".join(infos)
|
||||
batch_size_add=8192
|
||||
for i in range(0,big_npy.shape[0],batch_size_add):
|
||||
index.add(big_npy[i:i+batch_size_add])
|
||||
batch_size_add = 8192
|
||||
for i in range(0, big_npy.shape[0], batch_size_add):
|
||||
index.add(big_npy[i : i + batch_size_add])
|
||||
faiss.write_index(
|
||||
index,
|
||||
"%s/added_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe),
|
||||
@ -915,9 +915,9 @@ def train1key(
|
||||
"%s/trained_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe),
|
||||
)
|
||||
yield get_info_str("adding index")
|
||||
batch_size_add=8192
|
||||
for i in range(0,big_npy.shape[0],batch_size_add):
|
||||
index.add(big_npy[i:i+batch_size_add])
|
||||
batch_size_add = 8192
|
||||
for i in range(0, big_npy.shape[0], batch_size_add):
|
||||
index.add(big_npy[i : i + batch_size_add])
|
||||
faiss.write_index(
|
||||
index,
|
||||
"%s/added_IVF%s_Flat_nprobe_%s.index" % (exp_dir, n_ivf, index_ivf.nprobe),
|
||||
@ -1544,4 +1544,4 @@ with gr.Blocks() as app:
|
||||
inbrowser=not config.noautoopen,
|
||||
server_port=config.listen_port,
|
||||
quiet=True,
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user