File size: 1,889 Bytes
511ff0c
5c0e715
7b64dcd
 
 
 
851495c
7b64dcd
5c0e715
7b64dcd
 
 
 
 
5c0e715
7b64dcd
511ff0c
5c0e715
7b64dcd
 
5c0e715
7b64dcd
5c0e715
7b64dcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c0e715
 
 
851495c
7b64dcd
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from voice_dialogue.config.paths import PROJECT_ROOT
from .cache import LRUCacheDict
from .download_utils import (
    download_model_from_huggingface, download_file_from_huggingface, check_file_exists_on_huggingface,
    download_lora_from_huggingface, download_civitai_file
)
from .logger import logger
from .strings import remove_emojis
from .system import get_system_language, get_system_info

# 导入HParams类,解决moyoyo_tts的序列化问题
try:
    import sys
    from pathlib import Path

    # 添加third_party路径
    third_party_path = PROJECT_ROOT / "third_party"

    if str(third_party_path) not in sys.path:
        sys.path.insert(0, str(third_party_path))

    from moyoyo_tts.utils import HParams

except ImportError:
    # 如果导入失败,创建一个简单的HParams类
    class HParams:
        def __init__(self, **kwargs):
            for k, v in kwargs.items():
                if type(v) == dict:
                    v = HParams(**v)
                self[k] = v

        def keys(self):
            return self.__dict__.keys()

        def items(self):
            return self.__dict__.items()

        def values(self):
            return self.__dict__.values()

        def __len__(self):
            return len(self.__dict__)

        def __getitem__(self, key):
            return getattr(self, key)

        def __setitem__(self, key, value):
            return setattr(self, key, value)

        def __contains__(self, key):
            return key in self.__dict__

        def __repr__(self):
            return self.__dict__.__repr__()

__all__ = (
    'remove_emojis',
    'download_model_from_huggingface',
    'download_file_from_huggingface',
    'check_file_exists_on_huggingface',
    'download_lora_from_huggingface',
    'download_civitai_file',
    'LRUCacheDict',
    'get_system_language',
    'get_system_info',
    'logger',
)