Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api_v2接口碰到英文就会报错,有大佬会吗 求助! #1925

Open
kkkwjr opened this issue Jan 7, 2025 · 1 comment
Open

api_v2接口碰到英文就会报错,有大佬会吗 求助! #1925

kkkwjr opened this issue Jan 7, 2025 · 1 comment

Comments

@kkkwjr
Copy link

kkkwjr commented Jan 7, 2025

Traceback (most recent call last):
File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TTS.py", line 834, in run
item = make_batch(item)
File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TTS.py", line 802, in make_batch
phones, bert_features, norm_text = self.text_preprocessor.segment_and_extract_feature_for_text(text, text_lang, self.configs.version)
File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py", line 117, in segment_and_extract_feature_for_text
return self.get_phones_and_bert(text, language, version)
File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py", line 177, in get_phones_and_bert
phones, word2ph, norm_text = self.clean_text_inf(textlist[i], lang, version)
File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py", line 208, in clean_text_inf
phones, word2ph, norm_text = clean_text(text, language, version)
File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/text/cleaner.py", line 36, in clean_text
language_module = import("text."+language_module_map[language],fromlist=[language_module_map[language]])
File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/text/english.py", line 360, in
_g2p = en_G2p()
File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/text/english.py", line 252, in init
super().init()
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/g2p_en/g2p.py", line 71, in init
self.cmu = cmudict.dict()
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/corpus/reader/cmudict.py", line 77, in dict
return dict(Index(self.entries()))
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/util.py", line 150, in init
for key, value in pairs:
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/corpus/reader/util.py", line 292, in iterate_from
self._open()
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/corpus/reader/util.py", line 209, in _open
self._stream = self._fileid.open(self._encoding)
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/data.py", line 324, in open
stream = open(self._path, "rb")
IsADirectoryError: [Errno 21] Is a directory: '/usr/share/nltk_data/corpora/cmudict/cmudict'
Loading Text2Semantic weights from GPT_SoVITS/pretrained_models/gsv-v2final-pretrained/s1bert25hz-5kh-longer-epoch=12-step=369668.ckpt
Loading VITS weights from GPT_SoVITS/pretrained_models/gsv-v2final-pretrained/s2G2333k.pth
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/responses.py", line 257, in call
await wrap(partial(self.listen_for_disconnect, receive))
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/responses.py", line 253, in wrap
await func()
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/responses.py", line 230, in listen_for_disconnect
message = await receive()
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 531, in receive
await self.message_event.wait()
File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/asyncio/locks.py", line 226, in wait
await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f086c253100

During handling of the above exception, another exception occurred:

  • Exception Group Traceback (most recent call last):
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/fastapi/applications.py", line 1054, in call
    | await super().call(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/applications.py", line 113, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/middleware/errors.py", line 187, in call
    | raise exc
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/middleware/errors.py", line 165, in call
    | await self.app(scope, receive, _send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 62, in call
    | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    | raise exc
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    | await app(scope, receive, sender)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/routing.py", line 715, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/routing.py", line 735, in app
    | await route.handle(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/routing.py", line 288, in handle
    | await self.app(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/routing.py", line 76, in app
    | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    | raise exc
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    | await app(scope, receive, sender)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/routing.py", line 74, in app
    | await response(scope, receive, send)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/responses.py", line 257, in call
    | await wrap(partial(self.listen_for_disconnect, receive))
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 815, in aexit
    | raise BaseExceptionGroup(
    | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/responses.py", line 253, in wrap
    | await func()
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/responses.py", line 242, in stream_response
    | async for chunk in self.body_iterator:
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/concurrency.py", line 62, in iterate_in_threadpool
    | yield await anyio.to_thread.run_sync(_next, as_iterator)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/anyio/to_thread.py", line 56, in run_sync
    | return await get_async_backend().run_sync_in_worker_thread(
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 2505, in run_sync_in_worker_thread
    | return await future
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1005, in run
    | result = context.run(func, *args)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/starlette/concurrency.py", line 51, in _next
    | return next(iterator)
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/api_v2.py", line 322, in streaming_generator
    | for sr, chunk in tts_generator:
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 56, in generator_context
    | response = gen.send(request)
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TTS.py", line 958, in run
    | raise e
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TTS.py", line 834, in run
    | item = make_batch(item)
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TTS.py", line 802, in make_batch
    | phones, bert_features, norm_text = self.text_preprocessor.segment_and_extract_feature_for_text(text, text_lang, self.configs.version)
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py", line 117, in segment_and_extract_feature_for_text
    | return self.get_phones_and_bert(text, language, version)
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py", line 177, in get_phones_and_bert
    | phones, word2ph, norm_text = self.clean_text_inf(textlist[i], lang, version)
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py", line 208, in clean_text_inf
    | phones, word2ph, norm_text = clean_text(text, language, version)
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/text/cleaner.py", line 36, in clean_text
    | language_module = import("text."+language_module_map[language],fromlist=[language_module_map[language]])
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/text/english.py", line 360, in
    | _g2p = en_G2p()
    | File "/workspace/kkkjr/Item/LiveTalking/TTS/GPT-SoVITS/GPT_SoVITS/text/english.py", line 252, in init
    | super().init()
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/g2p_en/g2p.py", line 71, in init
    | self.cmu = cmudict.dict()
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/corpus/reader/cmudict.py", line 77, in dict
    | return dict(Index(self.entries()))
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/util.py", line 150, in init
    | for key, value in pairs:
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/corpus/reader/util.py", line 292, in iterate_from
    | self._open()
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/corpus/reader/util.py", line 209, in _open
    | self._stream = self._fileid.open(self._encoding)
    | File "/home/wpg/anaconda3/envs/sovits/lib/python3.9/site-packages/nltk/data.py", line 324, in open
    | stream = open(self._path, "rb")
    | IsADirectoryError: [Errno 21] Is a directory: '/usr/share/nltk_data/corpora/cmudict/cmudict'
    +------------------------------------
@kkkwjr
Copy link
Author

kkkwjr commented Jan 7, 2025

已经解决了,检查了一遍发现是之前手动下载的nltk_data,然后里面的cmudict这个英文发音的数据包都是没有解压的,所以识别不出来。https://github.com/nltk/nltk_data/tree/gh-pages(把packages改名成nltk_data)
1.先下载nltk_data的数据包
2.放在usr/share下面解压
3.在/usr/share/nltk_data/corpora/ 下面的的cmudict给解压就好啦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant