import os | |
import torch | |
from df.enhance import init_df | |
from modelscope import snapshot_download | |
from config import Config | |
from .modules.CosyVoice.cosyvoice.cli.cosyvoice import CosyVoice | |
def init_sys(): | |
device = "cuda" if torch.cuda.is_available() else "cpu" | |
# Load DeepFilterNet2 | |
df_model, df_state, _ = init_df() | |
# Load CosyVoice | |
cosyvoice= CosyVoice('FunAudioLLM/CosyVoice-300M') | |
cosyvoice_sft= CosyVoice('FunAudioLLM/CosyVoice-300M-SFT') | |
sft_speakers= cosyvoice_sft.list_avaliable_spks() | |
cosyvoice_instruct= CosyVoice('FunAudioLLM/CosyVoice-300M-Instruct') | |
return device, df_model, df_state, cosyvoice, cosyvoice_sft, sft_speakers, cosyvoice_instruct | |
device, df_model, df_state, cosyvoice, cosyvoice_sft, sft_speakers, cosyvoice_instruct = init_sys() | |