PlayVoice / whisper-vits-svc

Core Engine of Singing Voice Conversion & Singing Voice Clone
https://huggingface.co/spaces/maxmax20160403/sovits5.0
MIT License
2.65k stars 921 forks source link

如何导出spk? #24

Closed KakaruHayate closed 1 year ago

KakaruHayate commented 1 year ago

如题,训练好的模型如何导出音色文件

MaxMax2016 commented 1 year ago

python get_singer_idx.py data_svc/speaker/sub_folder_name/

# get_singer_idx.py
import os
import argparse
import numpy as np

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.description = 'please enter embed parameter ...'
    parser.add_argument("dataset_path", type=str,
                        help="Path to dataset waves.")
    data_svc = parser.parse_args().dataset_path

    if os.path.isdir(data_svc):
        subfile_num = 0
        speaker_ave = 0
        for file in os.listdir(data_svc):
            if file.endswith(".npy"):
                source_embed = np.load(os.path.join(data_svc, file))
                source_embed = source_embed.astype(np.float32)
                speaker_ave = speaker_ave + source_embed
                subfile_num = subfile_num + 1
        speaker_ave = speaker_ave / subfile_num
        print(speaker_ave)
        np.save("sovits_singer.npy", speaker_ave, allow_pickle=False)