Infer_batch_rvc improvements (#1003)
* add model path for hubert * use os.path.join * do inference only if the script is called directly
This commit is contained in:
parent
9bd0987815
commit
71116f07e9
@ -123,10 +123,10 @@ from scipy.io import wavfile
|
|||||||
hubert_model = None
|
hubert_model = None
|
||||||
|
|
||||||
|
|
||||||
def load_hubert():
|
def load_hubert(hubert_model_path="hubert_base.pt"):
|
||||||
global hubert_model
|
global hubert_model
|
||||||
models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task(
|
models, saved_cfg, task = checkpoint_utils.load_model_ensemble_and_task(
|
||||||
["hubert_base.pt"],
|
[hubert_model_path],
|
||||||
suffix="",
|
suffix="",
|
||||||
)
|
)
|
||||||
hubert_model = models[0]
|
hubert_model = models[0]
|
||||||
@ -203,13 +203,14 @@ def get_vc(model_path):
|
|||||||
# return {"visible": True,"maximum": n_spk, "__type__": "update"}
|
# return {"visible": True,"maximum": n_spk, "__type__": "update"}
|
||||||
|
|
||||||
|
|
||||||
get_vc(model_path)
|
if __name__ == "__main__":
|
||||||
audios = os.listdir(input_path)
|
get_vc(model_path)
|
||||||
for file in tq.tqdm(audios):
|
audios = os.listdir(input_path)
|
||||||
if file.endswith(".wav"):
|
for file in tq.tqdm(audios):
|
||||||
file_path = input_path + "/" + file
|
if file.endswith(".wav"):
|
||||||
wav_opt = vc_single(
|
file_path = os.path.join(input_path, file)
|
||||||
0, file_path, f0up_key, None, f0method, index_path, index_rate
|
wav_opt = vc_single(
|
||||||
)
|
0, file_path, f0up_key, None, f0method, index_path, index_rate
|
||||||
out_path = opt_path + "/" + file
|
)
|
||||||
wavfile.write(out_path, tgt_sr, wav_opt)
|
out_path = os.path.join(opt_path, file)
|
||||||
|
wavfile.write(out_path, tgt_sr, wav_opt)
|
||||||
|
Loading…
Reference in New Issue
Block a user