1.语言模型

1.文字语音转换 

使用工具 gpt-sovits https://github.com/RVC-Boss/GPT-SoVITS.git

指北:https://www.yuque.com/baicaigongchang1145haoyuangong/ib3g1e

2.github 拉取代码

3.安装第三方库

解释器选择3.9

4.安装cuda 对应组件

pip install torch==2.1.0+cu121 torchvision==0.16.0+cu121 torchaudio==2.1.0+cu121 --index-url https://download.pytorch.org/whl/cu121

4.1 记得查看自己的显卡支持的torch版本,需要与显卡版本相对应.

TIP:ERROR

1.需要Microsoft Visual C++ 14.0

Looking in indexes: https://mirrors.aliyun.com/pypi/simple
Collecting funasr==1.0.0
  Using cached https://mirrors.aliyun.com/pypi/packages/ae/12/fd0d0216c0e25b30c10e1030565373619d0af69d89085e6223093fa209ef/funasr-1.0.0-py3-none-any.whl (544 kB)
Requirement already satisfied: scipy>=1.4.1 in e:\python\gpt-sovits\.venv\lib\site-packages (from funasr==1.0.0) (1.13.0)
Requirement already satisfied: librosa in e:\python\gpt-sovits\.venv\lib\site-packages (from funasr==1.0.0) (0.9.2)
Collecting jamo (from funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/ac/cc/49812faae67f9a24be6ddaf58a2cf7e8c3cbfcf5b762d9414f7103d2ea2c/jamo-0.4.1-py3-none-any.whl (9.5 kB)
Requirement already satisfied: PyYAML>=5.1.2 in e:\python\gpt-sovits\.venv\lib\site-packages (from funasr==1.0.0) (6.0.1)
Collecting kaldiio>=2.17.0 (from funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/6c/32/4fa7c71123f49866b09d462ccdb6bcdfac42e4062a5e83f28fca16593357/kaldiio-2.18.0-py3-none-any.whl (28 kB)
Collecting torch-complex (from funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/9e/35/1ded2af76633aa9b2e875033265e6bc74e444fc8a78af48108ffe77b14cf/torch_complex-0.4.3-py3-none-any.whl (9.1 kB)
Collecting sentencepiece (from funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/85/f4/4ef1a6e0e9dbd8a60780a91df8b7452ada14cfaa0e17b3b8dfa42cecae18/sentencepiece-0.2.0-cp310-cp310-win_amd64.whl (991 kB)
     -------------------------------------- 991.5/991.5 kB 5.2 MB/s eta 0:00:00
Collecting jieba (from funasr==1.0.0)
  Using cached jieba-0.42.1-py3-none-any.whl
Collecting pytorch-wpe (from funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/23/de/c47967a11bfe68cb28d2f19e55c7027993c3721eba79813db65d245e4ced/pytorch_wpe-0.0.1-py3-none-any.whl (8.1 kB)
Collecting editdistance>=0.5.2 (from funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/c8/d1/7ec5f5cbb95838d0eff7f980a660c81acd1363d658f2f5d4ceba38877c5a/editdistance-0.8.1-cp310-cp310-win_amd64.whl (79 kB)
     ---------------------------------------- 79.6/79.6 kB 4.6 MB/s eta 0:00:00
Collecting oss2 (from funasr==1.0.0)
  Using cached oss2-2.18.5-py3-none-any.whl
Requirement already satisfied: tqdm in e:\python\gpt-sovits\.venv\lib\site-packages (from funasr==1.0.0) (4.66.4)
Collecting hdbscan (from funasr==1.0.0)
  Using cached https://mirrors.aliyun.com/pypi/packages/44/2c/b6bb84999f1c82cf0abd28595ff8aff2e495e18f8718b6b18bb11a012de4/hdbscan-0.8.33.tar.gz (5.2 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting umap (from funasr==1.0.0)
  Using cached umap-0.1.1-py3-none-any.whl
Collecting jaconv (from funasr==1.0.0)
  Using cached jaconv-0.3.4-py3-none-any.whl
Collecting hydra-core>=1.3.2 (from funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/c6/50/e0edd38dcd63fb26a8547f13d28f7a008bc4a3fd4eb4ff030673f22ad41a/hydra_core-1.3.2-py3-none-any.whl (154 kB)
     -------------------------------------- 154.5/154.5 kB 4.7 MB/s eta 0:00:00
Collecting omegaconf<2.4,>=2.2 (from hydra-core>=1.3.2->funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/e3/94/1843518e420fa3ed6919835845df698c7e27e183cb997394e4a670973a65/omegaconf-2.3.0-py3-none-any.whl (79 kB)
     ---------------------------------------- 79.5/79.5 kB 4.6 MB/s eta 0:00:00
Collecting antlr4-python3-runtime==4.9.* (from hydra-core>=1.3.2->funasr==1.0.0)
  Using cached https://mirrors.aliyun.com/pypi/packages/3e/38/7859ff46355f76f8d19459005ca000b6e7012f2f1ca597746cbcd1fbfe5e/antlr4-python3-runtime-4.9.3.tar.gz (117 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: packaging in e:\python\gpt-sovits\.venv\lib\site-packages (from hydra-core>=1.3.2->funasr==1.0.0) (24.0)
Requirement already satisfied: numpy in e:\python\gpt-sovits\.venv\lib\site-packages (from kaldiio>=2.17.0->funasr==1.0.0) (1.23.5)
Collecting cython<3,>=0.27 (from hdbscan->funasr==1.0.0)
  Using cached https://mirrors.aliyun.com/pypi/packages/7e/26/9d8de10005fedb1eceabe713348d43bae1dbab1786042ca0751a2e2b0f8c/Cython-0.29.37-py2.py3-none-any.whl (989 kB)
Requirement already satisfied: scikit-learn>=0.20 in e:\python\gpt-sovits\.venv\lib\site-packages (from hdbscan->funasr==1.0.0) (1.4.2)
Requirement already satisfied: joblib>=1.0 in e:\python\gpt-sovits\.venv\lib\site-packages (from hdbscan->funasr==1.0.0) (1.4.2)
Requirement already satisfied: audioread>=2.1.9 in e:\python\gpt-sovits\.venv\lib\site-packages (from librosa->funasr==1.0.0) (3.0.1)
Requirement already satisfied: decorator>=4.0.10 in e:\python\gpt-sovits\.venv\lib\site-packages (from librosa->funasr==1.0.0) (5.1.1)
Requirement already satisfied: resampy>=0.2.2 in e:\python\gpt-sovits\.venv\lib\site-packages (from librosa->funasr==1.0.0) (0.4.3)
Requirement already satisfied: numba>=0.45.1 in e:\python\gpt-sovits\.venv\lib\site-packages (from librosa->funasr==1.0.0) (0.56.4)
Requirement already satisfied: soundfile>=0.10.2 in e:\python\gpt-sovits\.venv\lib\site-packages (from librosa->funasr==1.0.0) (0.12.1)
Requirement already satisfied: pooch>=1.0 in e:\python\gpt-sovits\.venv\lib\site-packages (from librosa->funasr==1.0.0) (1.8.1)
Requirement already satisfied: requests!=2.9.0 in e:\python\gpt-sovits\.venv\lib\site-packages (from oss2->funasr==1.0.0) (2.31.0)
Collecting crcmod>=1.7 (from oss2->funasr==1.0.0)
  Using cached crcmod-1.7-py3-none-any.whl
Collecting pycryptodome>=3.4.7 (from oss2->funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/1f/90/d131c0eb643290230dfa4108b7c2d135122d88b714ad241d77beb4782a76/pycryptodome-3.20.0-cp35-abi3-win_amd64.whl (1.8 MB)
     ---------------------------------------- 1.8/1.8 MB 5.9 MB/s eta 0:00:00
Collecting aliyun-python-sdk-kms>=2.4.1 (from oss2->funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/3d/ea/d88e08bfc4a0aee0111f1f24c98b19107bc6783441e7e944907c77b2243d/aliyun_python_sdk_kms-2.16.2-py2.py3-none-any.whl (94 kB)
     ---------------------------------------- 94.0/94.0 kB 5.6 MB/s eta 0:00:00
Collecting aliyun-python-sdk-core>=2.13.12 (from oss2->funasr==1.0.0)
  Using cached aliyun_python_sdk_core-2.15.1-py3-none-any.whl
Requirement already satisfied: six in e:\python\gpt-sovits\.venv\lib\site-packages (from oss2->funasr==1.0.0) (1.16.0)
Requirement already satisfied: colorama in e:\python\gpt-sovits\.venv\lib\site-packages (from tqdm->funasr==1.0.0) (0.4.6)
Collecting jmespath<1.0.0,>=0.9.3 (from aliyun-python-sdk-core>=2.13.12->oss2->funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/07/cb/5f001272b6faeb23c1c9e0acc04d48eaaf5c862c17709d20e3469c6e0139/jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting cryptography>=2.6.0 (from aliyun-python-sdk-core>=2.13.12->oss2->funasr==1.0.0)
  Downloading https://mirrors.aliyun.com/pypi/packages/e3/14/13acd84f2a8303d9410ba2e24534a9d90c2817583636a91c4f314224768d/cryptography-42.0.5-cp39-abi3-win_amd64.whl (2.9 MB)
     ---------------------------------------- 2.9/2.9 MB 5.6 MB/s eta 0:00:00
Requirement already satisfied: llvmlite<0.40,>=0.39.0dev0 in e:\python\gpt-sovits\.venv\lib\site-packages (from numba>=0.45.1->librosa->funasr==1.0.0) (0.39.1)
Requirement already satisfied: setuptools in e:\python\gpt-sovits\.venv\lib\site-packages (from numba>=0.45.1->librosa->funasr==1.0.0) (68.2.0)
Requirement already satisfied: platformdirs>=2.5.0 in e:\python\gpt-sovits\.venv\lib\site-packages (from pooch>=1.0->librosa->funasr==1.0.0) (4.2.1)
Requirement already satisfied: charset-normalizer<4,>=2 in e:\python\gpt-sovits\.venv\lib\site-packages (from requests!=2.9.0->oss2->funasr==1.0.0) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in e:\python\gpt-sovits\.venv\lib\site-packages (from requests!=2.9.0->oss2->funasr==1.0.0) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in e:\python\gpt-sovits\.venv\lib\site-packages (from requests!=2.9.0->oss2->funasr==1.0.0) (2.2.1)
Requirement already satisfied: certifi>=2017.4.17 in e:\python\gpt-sovits\.venv\lib\site-packages (from requests!=2.9.0->oss2->funasr==1.0.0) (2024.2.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in e:\python\gpt-sovits\.venv\lib\site-packages (from scikit-learn>=0.20->hdbscan->funasr==1.0.0) (3.5.0)
Requirement already satisfied: cffi>=1.0 in e:\python\gpt-sovits\.venv\lib\site-packages (from soundfile>=0.10.2->librosa->funasr==1.0.0) (1.16.0)
Requirement already satisfied: pycparser in e:\python\gpt-sovits\.venv\lib\site-packages (from cffi>=1.0->soundfile>=0.10.2->librosa->funasr==1.0.0) (2.22)
Building wheels for collected packages: antlr4-python3-runtime, hdbscan
  Building wheel for antlr4-python3-runtime (setup.py): started
  Building wheel for antlr4-python3-runtime (setup.py): finished with status 'done'
  Created wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.9.3-py3-none-any.whl size=144578 sha256=7db31e96a46ae356c31960a1071a086710bc237ab4c852c199df5d2a3514d291
  Stored in directory: c:\users\eucliwoodhellsycthe\appdata\local\pip\cache\wheels\79\82\b1\b79d6e90f34257cd436860ed4f4a09f9e1ea8cd32da7046ea4
  Building wheel for hdbscan (pyproject.toml): started
  Building wheel for hdbscan (pyproject.toml): finished with status 'error'
Successfully built antlr4-python3-runtime
Failed to build hdbscan

  error: subprocess-exited-with-error
  
  Building wheel for hdbscan (pyproject.toml) did not run successfully.
  exit code: 1
  
  [40 lines of output]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\hdbscan
  copying hdbscan\flat.py -> build\lib.win-amd64-cpython-310\hdbscan
  copying hdbscan\hdbscan_.py -> build\lib.win-amd64-cpython-310\hdbscan
  copying hdbscan\plots.py -> build\lib.win-amd64-cpython-310\hdbscan
  copying hdbscan\prediction.py -> build\lib.win-amd64-cpython-310\hdbscan
  copying hdbscan\robust_single_linkage_.py -> build\lib.win-amd64-cpython-310\hdbscan
  copying hdbscan\validity.py -> build\lib.win-amd64-cpython-310\hdbscan
  copying hdbscan\__init__.py -> build\lib.win-amd64-cpython-310\hdbscan
  creating build\lib.win-amd64-cpython-310\hdbscan\tests
  copying hdbscan\tests\test_flat.py -> build\lib.win-amd64-cpython-310\hdbscan\tests
  copying hdbscan\tests\test_hdbscan.py -> build\lib.win-amd64-cpython-310\hdbscan\tests
  copying hdbscan\tests\test_prediction_utils.py -> build\lib.win-amd64-cpython-310\hdbscan\tests
  copying hdbscan\tests\test_rsl.py -> build\lib.win-amd64-cpython-310\hdbscan\tests
  copying hdbscan\tests\__init__.py -> build\lib.win-amd64-cpython-310\hdbscan\tests
  running build_ext
  cythoning hdbscan/_hdbscan_tree.pyx to hdbscan\_hdbscan_tree.c
  C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-_y5f1ycj\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-4n7u9a29\hdbscan_6194c2ca0f104dd997ce77f9f02ebb23\hdbscan\_hdbscan_tree.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  cythoning hdbscan/_hdbscan_linkage.pyx to hdbscan\_hdbscan_linkage.c
  C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-_y5f1ycj\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-4n7u9a29\hdbscan_6194c2ca0f104dd997ce77f9f02ebb23\hdbscan\_hdbscan_linkage.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  cythoning hdbscan/_hdbscan_boruvka.pyx to hdbscan\_hdbscan_boruvka.c
  C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-_y5f1ycj\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-4n7u9a29\hdbscan_6194c2ca0f104dd997ce77f9f02ebb23\hdbscan\_hdbscan_boruvka.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  cythoning hdbscan/_hdbscan_reachability.pyx to hdbscan\_hdbscan_reachability.c
  C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-_y5f1ycj\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-4n7u9a29\hdbscan_6194c2ca0f104dd997ce77f9f02ebb23\hdbscan\_hdbscan_reachability.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  cythoning hdbscan/_prediction_utils.pyx to hdbscan\_prediction_utils.c
  C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-_y5f1ycj\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-4n7u9a29\hdbscan_6194c2ca0f104dd997ce77f9f02ebb23\hdbscan\_prediction_utils.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  cythoning hdbscan/dist_metrics.pyx to hdbscan\dist_metrics.c
  C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-build-env-_y5f1ycj\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\EucliwoodHellsycthe\AppData\Local\Temp\pip-install-4n7u9a29\hdbscan_6194c2ca0f104dd997ce77f9f02ebb23\hdbscan\dist_metrics.pxd
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'hdbscan._hdbscan_tree' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hdbscan
ERROR: Could not build wheels for hdbscan, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip

conda install libpython m2w64-toolchain -c msys2

实测不行,老老实实下载 Microsoft C++ Build Tools 吧

https://115.com/s/swzdywh3flt?password=ka93&#solved_packageMissIn…x64_dvd_dfd9a39c.iso
访问码:ka93

2.显存无法清除干净 加日志

修改方法: TTS_infer_pack.TTS.TTS.empty_cache

    def log_memory_usage(self, device):
        if "cuda" in str(device) and torch.cuda.is_available():
            print(f"oom: 分配的显存: {torch.cuda.memory_allocated()} 字节")
            print(f"oom: 缓存的显存: {torch.cuda.memory_reserved()} 字节")
        elif str(device) == "mps":
            print("oom: MPS 后端不支持提供显存使用细节。")

    def empty_cache(self):
        try:
            if "cuda" in str(self.configs.device):
                print("oom: 清理前显存状态:")
                self.log_memory_usage(self.configs.device)
                torch.cuda.empty_cache()
                print("oom: 清理后显存状态:")
                self.log_memory_usage(self.configs.device)
            elif str(self.configs.device) == "mps":
                torch.mps.empty_cache()
                print("oom: 已清理 MPS 缓存。")
            gc.collect()
            print("oom: 内存垃圾回收完成。")
        except Exception as e:
            print(f"oom: 清理缓存时发生错误: {e}")

Tip:开放接口在:GPT-SoVITS\api_v2.py 文件中。


2.思维模型

1.ollama->尝试中

  • pass,可以进行对话,不能进行微调 他讲权重 元数据 配置 都进行了加密,读不了;只能使用ollama进行读取,而ollama没有开放微调的功能。