RVC-Boss / GPT-SoVITS

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

用API接口推理时偶尔会出现IndexError: string index out of range中断 #1053

Open werran2 opened 4 months ago

werran2 commented 4 months ago

中断的频率不高但随机不固定

INFO: 127.0.0.1:2386 - "GET /?text=%E5%85%88%E5%B8%9D%E5%88%9B%E4%B8%9A%E6%9C%AA%E5%8D%8A%E8%80%8C%E4%B8%AD%E9%81%93%E5%B4%A9%E6%AE%82%EF%BC%8C%E4%BB%8A%E5%A4%A9%E4%B8%8B%E4%B8%89%E5%88%86%EF%BC%8C%E7%9B%8A%E5%B7%9E%E7%96%B2%E5%BC%8A%EF%BC%8C%E6%AD%A4%E8%AF%9A%E5%8D%B1%E6%80%A5%E5%AD%98%E4%BA%A1%E4%B9%8B%E7%A7%8B%E4%B9%9F&text_lang=%E4%B8%AD%E8%8B%B1%E6%B7%B7%E5%90%88&ref_audio_path=./1.wav&prompt_text=%E7%93%9C%E8%80%81%E5%A4%9A%E4%BA%86%EF%BC%8C%E5%95%8A%E5%AF%B9%E5%AF%B9%E5%AF%B9%EF%BC%8C%E6%88%91%E5%9C%A8%E7%9F%A5%E4%B9%8E%E4%B8%8A%E7%9C%8B%E5%88%B0%E5%A5%BD%E5%A4%9A%E5%8C%BB%E9%99%A2%E7%9A%84%E7%93%9C%EF%BC%8C%E9%83%BD%E9%9D%9E%E5%B8%B8%E5%A5%87%E8%91%A9&prompt_lang=%E4%B8%AD%E6%96%87&text_split_method=%E6%8C%89%E6%A0%87%E7%82%B9%E7%AC%A6%E5%8F%B7%E5%88%87&text=%0A%0A HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 408, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 69, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\middleware\errors.py", line 186, in call raise exc File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\middleware\errors.py", line 164, in call await self.app(scope, receive, _send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\middleware\cors.py", line 83, in call await self.app(scope, receive, send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app raise exc File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\routing.py", line 758, in call await self.middleware_stack(scope, receive, send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\routing.py", line 778, in app await route.handle(scope, receive, send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\routing.py", line 299, in handle await self.app(scope, receive, send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\routing.py", line 79, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app raise exc File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\starlette\routing.py", line 74, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\fastapi\routing.py", line 278, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\fastapi\routing.py", line 191, in run_endpoint_function return await dependant.call(**values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\api.py", line 526, in tts_endpoint return handle_new(text, text_lang, ref_audio_path, prompt_text, prompt_lang,text_split_method) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\api.py", line 475, in handle_new sampling_rate, audio_data = next(gen) ^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\GPT_SoVITS\inference_webui.py", line 214, in inference_api yield next(tts_pipeline.run(inputs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\runtime\Lib\site-packages\torch\utils_contextlib.py", line 35, in generator_context response = gen.send(None) ^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\GPT_SoVITS\TTS_infer_pack\TTS.py", line 675, in run data = self.text_preprocessor.preprocess(text, text_lang, text_split_method) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\GPT_SoVITS\TTS_infer_pack\TextPreprocessor.py", line 56, in preprocess texts = self.pre_seg_text(text, lang, text_split_method) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\GPT-SoVITS-0310-liuyue\GPT_SoVITS\TTS_infer_pack\TextPreprocessor.py", line 71, in pre_seg_text if (text[0] not in splits and len(get_first(text)) < 4):


IndexError: string index out of range
jmaple12 commented 4 months ago

这应该就是我提的那个pull request,#962

jmaple12 commented 4 months ago

这应该就是我提的那个pull request,#962

pre-seg-text少了一个对text非空的判断