1
0
mirror of synced 2024-11-23 23:21:03 +01:00

Add files via upload

This commit is contained in:
RVC-Boss 2024-03-01 17:23:43 +08:00 committed by GitHub
parent c22b912576
commit a3ee455191
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,7 +16,7 @@ from infer.lib.train.process_ckpt import (
from i18n.i18n import I18nAuto from i18n.i18n import I18nAuto
from configs.config import Config from configs.config import Config
from sklearn.cluster import MiniBatchKMeans from sklearn.cluster import MiniBatchKMeans
import torch import torch,platform
import numpy as np import numpy as np
import gradio as gr import gradio as gr
import faiss import faiss
@ -673,24 +673,6 @@ def train_index(exp_dir1, version19):
"%s/trained_IVF%s_Flat_nprobe_%s_%s_%s.index" "%s/trained_IVF%s_Flat_nprobe_%s_%s_%s.index"
% (exp_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19), % (exp_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
) )
try:
os.link(
"%s/trained_IVF%s_Flat_nprobe_%s_%s_%s.index"
% (exp_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
"%s/%s_IVF%s_Flat_nprobe_%s_%s_%s.index"
% (
outside_index_root,
exp_dir,
n_ivf,
index_ivf.nprobe,
exp_dir1,
version19,
),
)
infos.append("链接索引到%s" % (outside_index_root))
except:
infos.append("链接索引到%s失败" % (outside_index_root))
infos.append("adding") infos.append("adding")
yield "\n".join(infos) yield "\n".join(infos)
batch_size_add = 8192 batch_size_add = 8192
@ -705,6 +687,25 @@ def train_index(exp_dir1, version19):
"成功构建索引 added_IVF%s_Flat_nprobe_%s_%s_%s.index" "成功构建索引 added_IVF%s_Flat_nprobe_%s_%s_%s.index"
% (n_ivf, index_ivf.nprobe, exp_dir1, version19) % (n_ivf, index_ivf.nprobe, exp_dir1, version19)
) )
try:
link=os.link if platform.system()=="Windows" else os.symlink
link(
"%s/added_IVF%s_Flat_nprobe_%s_%s_%s.index"
% (exp_dir, n_ivf, index_ivf.nprobe, exp_dir1, version19),
"%s/%s_IVF%s_Flat_nprobe_%s_%s_%s.index"
% (
outside_index_root,
exp_dir1,
n_ivf,
index_ivf.nprobe,
exp_dir1,
version19,
),
)
infos.append("链接索引到外部-%s" % (outside_index_root))
except:
infos.append("链接索引到外部-%s失败" % (outside_index_root))
# faiss.write_index(index, '%s/added_IVF%s_Flat_FastScan_%s.index'%(exp_dir,n_ivf,version19)) # faiss.write_index(index, '%s/added_IVF%s_Flat_FastScan_%s.index'%(exp_dir,n_ivf,version19))
# infos.append("成功构建索引added_IVF%s_Flat_FastScan_%s.index"%(n_ivf,version19)) # infos.append("成功构建索引added_IVF%s_Flat_FastScan_%s.index"%(n_ivf,version19))
yield "\n".join(infos) yield "\n".join(infos)