File size: 820 Bytes
7f167fb
 
acde4c3
 
7f167fb
acde4c3
 
7f167fb
acde4c3
37c429a
acde4c3
 
 
7f167fb
acde4c3
 
c6116e3
e645124
7f167fb
e645124
c6116e3
7f167fb
e645124
7f167fb
c6116e3
acde4c3
c6116e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()