lenML / ChatTTS-Forge

🍦 ChatTTS-Forge is a project developed around TTS generation model, implementing an API Server and a Gradio-based WebUI.
https://huggingface.co/spaces/lenML/ChatTTS-Forge
GNU Affero General Public License v3.0
584 stars 71 forks source link

今日更新后报错'ValueError: high is out of bounds for int32' #11

Closed alex9441 closed 2 months ago

alex9441 commented 2 months ago

今天更新后报错,日志如下 (Chattts-ui) PS C:\0_AI_0\ChatTTS-Forge\10> python webui.py --half device use cuda Traceback (most recent call last): File "C:\0_AI_0\ChatTTS-Forge\10\webui.py", line 19, in from modules.synthesize_audio import synthesize_audio File "C:\0_AI_0\ChatTTS-Forge\10\modules\synthesize_audio.py", line 4, in from modules.SynthesizeSegments import SynthesizeSegments, combine_audio_segments File "C:\0_AI_0\ChatTTS-Forge\10\modules\SynthesizeSegments.py", line 57, in class SynthesizeSegments: File "C:\0_AI_0\ChatTTS-Forge\10\modules\SynthesizeSegments.py", line 58, in SynthesizeSegments batch_default_spk_seed = int(np.random.randint(0, 2**32 - 1)) File "numpy\random\mtrand.pyx", line 780, in numpy.random.mtrand.RandomState.randint File "numpy\random\_bounded_integers.pyx", line 1423, in numpy.random._bounded_integers._rand_int32 ValueError: high is out of bounds for int32

问了Gemini,Gemini解释如下: "您在 ChatTTS-ui 项目中遇到的 ValueError: high is out of bounds for int32 错误,源于 C:\0_AI_0\ChatTTS-Forge\10\modules\SynthesizeSegments.py 文件中的第 58 行。该代码尝试使用 np.random.randint(0, 232 - 1) 生成一个随机整数 (batch_default_spk_seed)。然而,32 位整数 (int32) 的最大可表示值为 2,147,483,647。代码试图生成一个高达 232 - 1 (即 4,294,967,295) 的数字,超出了 int32 的限制。"

我暂时修改代码如下: batch_default_spk_seed = int(np.random.randint(0, 2**32 - 1, dtype=np.int64))

程序顺利运行.

报告一下,不提交了.

祝码运昌隆!

alex9441 commented 2 months ago

还有个奇异现象,每次新启动,第一次生成后会报错 C:\Users……conda\envs\Chattts-ui\lib\site-packages\torch\nn\modules\conv.py:306: UserWarning: Plan failed with a cudnnException: CUDNN_BACKEND_EXECUTION_PLAN_DESCRIPTOR: cudnnFinalize Descriptor Failed cudnn_status: CUDNN_STATUS_NOT_SUPPORTED (Triggered internally at ..\aten\src\ATen\native\cudnn\Conv_v8.cpp:919.)  return F.conv1d(input, weight, bias, self.stride,

第二次生成后这条就消失了.而且观察生成速度和GPU占用都没问题.

zengjixiang commented 2 months ago

我也發現這個 Bug , 直接修改 modules\SynthesizeSegments.py 第 57 行 和 58 行即可 我猜應該是 2**31 - 1

(我是用某 AI 提供的解法) batch_default_spk_seed = int(np.random.randint(0, np.iinfo(np.int32).max)) batch_default_infer_seed = int(np.random.randint(0, np.iinfo(np.int32).max))

zhzLuke96 commented 2 months ago

fixed af06646877f56ea458a8b316dca4160d546bb4b5