batch_add_faiss_index

batch_add_faiss_index
This commit is contained in:
RVC-Boss 2023-05-05 00:26:52 +08:00 committed by GitHub
parent da34d75ec9
commit ccf6e6bbd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -694,7 +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)
index.add(big_npy)
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),
@ -913,7 +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")
index.add(big_npy)
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),
@ -1192,7 +1196,7 @@ with gr.Blocks() as app:
minimum=0,
maximum=20,
step=1,
label=i18n("人声提取激进程度"),
label="人声提取激进程度",
value=10,
interactive=True,
visible=False, # 先不开放调整