RVC-Boss / GPT-SoVITS

1 min voice data can also be used to train a good TTS model! (few shot voice cloning)
MIT License
33.83k stars 3.88k forks source link

api_v2.py中workers大于1的时候,子进程会一直重启 #1183

Open ctrlcplusv opened 3 months ago

ctrlcplusv commented 3 months ago

api_v2.py中workers等于1的时候,一切正常,workers大于1的时候,子进程会一直重启,显存是24G的,肯定够用,有人碰到这种情况吗?

v3ucn commented 3 months ago
if __name__ == '__main__':

    # 阻止子进程重启
    import multiprocessing
    multiprocessing.freeze_support()
    # ------------------------------------

    # 封装前运行
    uvicorn.run(app="api_v2:app", host="0.0.0.0", port=12233, workers=5)
lckj2009 commented 3 months ago

请问,api_v2.py在哪里?没找到这个文件

v3ucn commented 3 months ago

请问,api_v2.py在哪里?没找到这个文件

在 fast_inference_分支

ctrlcplusv commented 3 months ago
if __name__ == '__main__':

    # 阻止子进程重启
    import multiprocessing
    multiprocessing.freeze_support()
    # ------------------------------------

    # 封装前运行
    uvicorn.run(app="api_v2:app", host="0.0.0.0", port=12233, workers=5)

还是有问题,报错这个 Snipaste_2024-06-13_18-31-00

lckj2009 commented 3 months ago

请问,api_v2.py在哪里?没找到这个文件

在 fast_inference_分支

你好,fast_inference_分支在哪里呀,GPT-SoVITS目录里面没找到

Separatee commented 3 months ago

请问,api_v2.py在哪里?没找到这个文件

在 fast_inference_分支

你好,fast_inference_分支在哪里呀,GPT-SoVITS目录里面没找到

@lckj2009 第一次用github吗?在仓库界面,从main切换到fastinference Here

如果你想从当前的main版本切换到fast_inference_分支,只需要使用git,额外加上-b参数,即 -b fastinference。命令如下

git clone --depth=1 https://github.com/RVC-Boss/GPT-SoVITS.git -b fast_inference_

或者直接在切换后的分支界面点下载zip压缩包也可以。 把新下载的分支全部覆盖你的原文件 之后只需要额外的安装wordsegments包就能从main切换到fast_inference_了

/path/to/your/python -m pip install wordsegments
wx971025 commented 2 months ago
if __name__ == '__main__':

    # 阻止子进程重启
    import multiprocessing
    multiprocessing.freeze_support()
    # ------------------------------------

    # 封装前运行
    uvicorn.run(app="api_v2:app", host="0.0.0.0", port=12233, workers=5)

还是有问题,报错这个 Snipaste_2024-06-13_18-31-00

我遇到了相同的问题,当uvicorn==0.21.0时可以正常启动

lckj2009 commented 2 months ago

uvicorn

多谢,但是我尝试在 conda环境下运行 python api_v2.py。结果报错了,如下:

(GPT-SoVITS) E:\GPT-SoVITS>python api_v2.py Loading Text2Semantic weights from GPT_weights/lvbu-e30.ckpt Loading VITS weights from GPT_SoVITS/pretrained_models/s2G488k.pth C:\Users\ww\anaconda3\envs\GPT-SoVITS\lib\site-packages\torch\nn\utils\weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm. warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.") Loading BERT weights from GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large C:\Users\ww\anaconda3\envs\GPT-SoVITS\lib\site-packages\torch_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() return self.fget.get(instance, owner)() Loading CNHuBERT weights from GPT_SoVITS/pretrained_models/chinese-hubert-base Traceback (most recent call last): File "E:\GPT-SoVITS\api_v2.py", line 143, in tts_pipeline = TTS(tts_config) File "E:\GPT-SoVITS\GPT_SoVITS\TTS_infer_pack\TTS.py", line 205, in init self._init_models() File "E:\GPT-SoVITS\GPT_SoVITS\TTS_infer_pack\TTS.py", line 232, in _init_models self.init_cnhuhbert_weights(self.configs.cnhuhbert_base_path) File "E:\GPT-SoVITS\GPT_SoVITS\TTS_infer_pack\TTS.py", line 239, in init_cnhuhbert_weights self.cnhuhbert_model = CNHubert(base_path) TypeError: CNHubert.init() takes 1 positional argument but 2 were given

XXXXRT666 commented 2 months ago

检查代码,看看import的是哪里的CNHubert,你import的可能是Main分支

lckj2009 commented 2 months ago

检查代码,看看import的是哪里的CNHubert,你import的可能是Main分支

我clone的应该是Main分支。 api_v2.py和V3主要特点是什么,我还不明白。是不是现在流行用 fastinference 分支的api_v2.py、v3?

XXXXRT666 commented 2 months ago

我clone的应该是Main分支。 api_v2.py和V3主要特点是什么,我还不明白。是不是现在流行用 fastinference 分支的api_v2.py、v3?

去看看cnhubert.__file__

lckj2009 commented 2 months ago

我clone的应该是Main分支。 api_v2.py和V3主要特点是什么,我还不明白。是不是现在流行用 fastinference 分支的api_v2.py、v3?

去看看cnhubert.__path__

TTS.py 的一部分引用

from AR.models.t2s_lightning_module import Text2SemanticLightningModule from feature_extractor.cnhubert import CNHubert from module.models import SynthesizerTrn import librosa from time import time as ttime from tools.i18n.i18n import I18nAuto from my_utils import load_audio from module.mel_processing import spectrogram_torch from TTS_infer_pack.text_segmentation_method import splits from TTS_infer_pack.TextPreprocessor import TextPreprocessor i18n = I18nAuto()

lckj2009 commented 2 months ago

(GPT-SoVITS) E:\bak>git clone https://github.com/RVC-Boss/GPT-SoVITS.git Cloning into 'GPT-SoVITS'... error: RPC failed; curl 28 Recv failure: Connection was reset fatal: expected flush after ref listing

fastinference 分支clone一直失败

wx971025 commented 2 months ago

(GPT-SoVITS) E:\bak>git clone https://github.com/RVC-Boss/GPT-SoVITS.git Cloning into 'GPT-SoVITS'... error: RPC failed; curl 28 Recv failure: Connection was reset fatal: expected flush after ref listing

fastinference 分支clone一直失败

首先 clone特定分支要加-b参数,其次 你可以直接download一个项目的zip 解压使用

XXXXRT666 commented 2 months ago

TTS.py 的一部分引用

import之后让他print一下看看__path__

lckj2009 commented 2 months ago

测试代码: from feature_extractor.cnhubert import CNHubert

print(CNHubert. path )

运行结果:

已连接到 pydev 调试器(内部版本号 222.4554.11)Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2022.2.5\plugins\python\helpers\pydev\pydevd.py", line 1496, in exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm 2022.2.5\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:\GPT-SoVITS-fast_inference\ceshi.py", line 3, in print(CNHubert.path) AttributeError: type object 'CNHubert' has no attribute 'path'. Did you mean: 'hash'? python-BaseException

XXXXRT666 commented 2 months ago

记错了,是__file__

lckj2009 commented 2 months ago

已连接到 pydev 调试器(内部版本号 222.4554.11)Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2022.2.5\plugins\python\helpers\pydev\pydevd.py", line 1496, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm 2022.2.5\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:\GPT-SoVITS-fastinference\ceshi.py", line 3, in print(CNHubert.file) AttributeError: type object 'CNHubert' has no attribute ' _ file '. Did you mean: ' le _'?

XXXXRT666 commented 2 months ago

去看看cnhubert.__file__

cnhubert和CNHubert是两个东西,而且需要知道的是报错前一刻他import的是哪个模块,而不是一个测试,直接在报错前from feature_extractor import cnhubert看看 cnhubert.__file__

Separatee commented 2 months ago

看了你启动失败的问题 尝试使用这个Windows版本(不要滥用下载链接): 0306fix

还有你克隆的方式不对,既然你当初git clone没有加参数,那么git默认把所有分支和commit都克隆了,请阅读git基本教程了解git的使用原理。请使用

git branch _fast_inference
git pull -f

切换到_fast_inference分支。 如果还是不行 尝试:

git remote remove origin && git remote add origin https://github.xn--z0s.top/rvc-boss/gpt-sovits

使用我的github镜像网站进行git pull -f

lckj2009 commented 2 months ago

去看看cnhubert.__file__

cnhubert和CNHubert是两个东西,而且需要知道的是报错前一刻他import的是哪个模块,而不是一个测试,直接在报错前from feature_extractor import cnhubert看看 cnhubert.__file__

cuowu

feature_extractor.cnhubert 里面只有 CNHubert,没有 cnhubert

lckj2009 commented 2 months ago

看了你启动失败的问题 尝试使用这个Windows版本(不要滥用下载链接): 0306fix

还有你克隆的方式不对,既然你当初git clone没有加参数,那么git默认把所有分支和commit都克隆了,请阅读git基本教程了解git的使用原理。请使用

git branch _fast_inference
git pull -f

切换到_fast_inference分支。 如果还是不行 尝试:

git remote remove origin && git remote add origin https://github.xn--z0s.top/rvc-boss/gpt-sovits

使用我的github镜像网站进行git pull -f

连接下载不了,网速0。我尝试 git branch _fast_inference 看看

Separatee commented 2 months ago

看了你启动失败的问题 尝试使用这个Windows版本(不要滥用下载链接): 0306fix 还有你克隆的方式不对,既然你当初git clone没有加参数,那么git默认把所有分支和commit都克隆了,请阅读git基本教程了解git的使用原理。请使用

git branch _fast_inference
git pull -f

切换到_fast_inference分支。 如果还是不行 尝试:

git remote remove origin && git remote add origin https://github.xn--z0s.top/rvc-boss/gpt-sovits

使用我的github镜像网站进行git pull -f

连接下载不了,网速0。我尝试 git branch _fast_inference 看看

使用 git remote -v查看一下当前的远程服务器地址是否有误,实际上你只需要把前缀域名改一下,从github.com转为github.xn--z0s.top 还有你还可以试一下我最开始说的0306fix版本的下载链接(蓝色字体)

Separatee commented 2 months ago

看了你启动失败的问题 尝试使用这个Windows版本(不要滥用下载链接): 0306fix 还有你克隆的方式不对,既然你当初git clone没有加参数,那么git默认把所有分支和commit都克隆了,请阅读git基本教程了解git的使用原理。请使用

git branch _fast_inference
git pull -f

切换到_fast_inference分支。 如果还是不行 尝试:

git remote remove origin && git remote add origin https://github.xn--z0s.top/rvc-boss/gpt-sovits

使用我的github镜像网站进行git pull -f

连接下载不了,网速0。我尝试 git branch _fast_inference 看看

抱歉 我的说法有误,你应该在地址末尾加上.git 是

git remote add origin https://github.xn--z0s.top/rvc-boss/gpt-sovits.git

而不是

git remote add origin https://github.xn--z0s.top/rvc-boss/gpt-sovits
lckj2009 commented 2 months ago

0306fix版本的下载链接

0306fix版本的下载链接,网速0。

lckj2009 commented 2 months ago

33

Separatee commented 2 months ago

0306fix版本的下载链接

0306fix版本的下载链接,网速0。

检查一下你是不是开魔法了 这是阿里云北京的CDN节点

Separatee commented 2 months ago

33

在你原来的文件夹里用这个命令

lckj2009 commented 2 months ago

0306fix版本的下载链接

0306fix版本的下载链接,网速0。

检查一下你是不是开魔法了 这是阿里云北京的CDN节点

没有,迅雷下不了。360浏览器也是

XXXXRT666 commented 2 months ago

去看看cnhubert.__file__

cnhubert和CNHubert是两个东西,而且需要知道的是报错前一刻他import的是哪个模块,而不是一个测试,直接在报错前from feature_extractor import cnhubert看看 cnhubert.__file__

feature_extractor.cnhubert 里面只有 CNHubert,没有 cnhubert

我说的就是cuhubert这个文件,就在你的TTS.py对应报错位置前加上,或者是你自己检查sys.path,两个分支共用环境可能导致import错误

from feature_extractor import cnhubert
print(cnhubert.__file__)

shell执行 python -c "import sys;print(sys.path)"

Separatee commented 2 months ago

0306fix版本的下载链接

0306fix版本的下载链接,网速0。

检查一下你是不是开魔法了 这是阿里云北京的CDN节点

没有,迅雷下不了。360浏览器也是

…恕我直言,谁家下载用迅雷,换个Edge浏览器试试。

lckj2009 commented 2 months ago

去看看cnhubert.__file__

cnhubert和CNHubert是两个东西,而且需要知道的是报错前一刻他import的是哪个模块,而不是一个测试,直接在报错前from feature_extractor import cnhubert看看 cnhubert.__file__

feature_extractor.cnhubert 里面只有 CNHubert,没有 cnhubert

我说的就是cuhubert这个文件,就在你的TTS.py对应报错位置前加上,或者是你自己检查sys.path,两个分支共用环境可能导致import错误

from feature_extractor import cnhubert
print(cnhubert.__file__)

shell执行 python -c "import sys;print(sys.path)"

E:\GPT-SoVITS\GPT_SoVITS\feature_extractor\cnhubert.py 准确的找到了文件地址。

XXXXRT666 commented 2 months ago

E:\GPT-SoVITS\GPT_SoVITS\feature_extractor\cnhubert.py 准确的找到了文件地址。

看上下文的话,你调用的TTS.py在GPT-SoVITS-fast_infernence_里面

lckj2009 commented 2 months ago

0306fix版本的下载链接

0306fix版本的下载链接,网速0。

检查一下你是不是开魔法了 这是阿里云北京的CDN节点

没有,迅雷下不了。360浏览器也是

…恕我直言,谁家下载用迅雷,换个Edge浏览器试试。

1

XXXXRT666 commented 2 months ago

看上下文的话,你调用的TTS.py在GPT-SoVITS-fast_infernence_里面

你是不是本地还有一个Main分支,和fast inference分支属于同时存在而不是git切换的状态

lckj2009 commented 2 months ago

看上下文的话,你调用的TTS.py在GPT-SoVITS-fast_infernence_里面

你是不是本地还有一个Main分支,和fast inference分支属于同时存在而不是git切换的状态

是这样的,刚才,我在 E:\GPT-SoVITS-fastinference 文件夹里新建了一个ceshi.py。代码只有: from feature_extractor import cnhubert print(cnhubert.file) 这2行,运行时打印了:E:\GPT-SoVITS\GPT_SoVITS\feature_extractor\cnhubert.py E:\GPT-SoVITS和E:\GPT-SoVITS-fastinference 是2个文件夹。我估计是git版本把他们联系在一起的原因。

XXXXRT666 commented 2 months ago

跟git没关系,建议分开建环境,或者去site-packages底下把users.pth清空

lckj2009 commented 2 months ago

我还没测试在这种情况下,api_v2.py 能否运行。那么我可以测试一下?

命令就是 python api_v2.py ?无需其他参数?

XXXXRT666 commented 2 months ago

users.pth只是为了更改sys.path的内容

Separatee commented 2 months ago

我还没测试在这种情况下,api_v2.py 能否运行。那么我可以测试一下?

命令就是 python api_v2.py ?无需其他参数?

你可以回炉重造 在你的E盘根目录新建一个文件夹 仓库主页的Readme有0306fix的压缩包 下载下来然后把你的_fast_inference内部所有文件拖到解压后的文件夹内(覆盖并确认) 它可能会提示缺少wordsegments包那就在以当前目录打开CMD,输入.\runtime\python -m pip install wordsegments

Separatee commented 2 months ago

@lckj2009 我的域名是纯ipv6,无法访问,下载速度为0的情况应该是你的路由不支持IPV6。但问题不大。

lckj2009 commented 2 months ago

@lckj2009 我的域名是纯ipv6,无法访问,下载速度为0的情况应该是你的路由不支持IPV6。但问题不大。

我用同事的电脑下载成功了