Gouryella / ChatTTS-webui

A Web UI developed based on ChatTTS, implemented using Nuxt 3 and Ant Design.
https://chattts.201lab.top
65 stars 14 forks source link

UnboundLocalError: local variable 'Normalizer' referenced before assignment #3

Closed Osub closed 3 months ago

Osub commented 3 months ago

docker 下执行报错

ERROR:    Exception in ASGI application
2024-06-02 16:28:28 Traceback (most recent call last):
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi
2024-06-02 16:28:28     result = await app(  # type: ignore[func-returns-value]
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
2024-06-02 16:28:28     return await self.app(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
2024-06-02 16:28:28     await super().__call__(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
2024-06-02 16:28:28     await self.middleware_stack(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
2024-06-02 16:28:28     raise exc
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
2024-06-02 16:28:28     await self.app(scope, receive, _send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/middleware/cors.py", line 93, in __call__
2024-06-02 16:28:28     await self.simple_response(scope, receive, send, request_headers=headers)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/middleware/cors.py", line 148, in simple_response
2024-06-02 16:28:28 INFO:     192.168.65.1:34585 - "POST /generate HTTP/1.1" 500 Internal Server Error
2024-06-02 16:28:28     await self.app(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
2024-06-02 16:28:28     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-06-02 16:28:28     raise exc
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-06-02 16:28:28     await app(scope, receive, sender)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__
2024-06-02 16:28:28     await self.middleware_stack(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
2024-06-02 16:28:28     await route.handle(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
2024-06-02 16:28:28     await self.app(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
2024-06-02 16:28:28     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-06-02 16:28:28     raise exc
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-06-02 16:28:28     await app(scope, receive, sender)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
2024-06-02 16:28:28     response = await func(request)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
2024-06-02 16:28:28     raw_response = await run_endpoint_function(
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
2024-06-02 16:28:28     return await dependant.call(**values)
2024-06-02 16:28:28   File "/app/ChatTTS-webui/api/server.py", line 66, in generate_text
2024-06-02 16:28:28     wavs = await asyncio.to_thread(chat.infer, text, use_decoder=True, params_infer_code=params_infer_code)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/asyncio/threads.py", line 25, in to_thread
2024-06-02 16:28:28     return await loop.run_in_executor(None, func_call)
2024-06-02 16:28:28   File "/opt/conda/lib/python3.10/concurrent/futures/thread.py", line 58, in run
2024-06-02 16:28:28     result = self.fn(*self.args, **self.kwargs)
2024-06-02 16:28:28   File "/app/ChatTTS-webui/api/ChatTTS/ChatTTS/core.py", line 146, in infer
2024-06-02 16:28:28     self.init_normalizer(_lang)
2024-06-02 16:28:28   File "/app/ChatTTS-webui/api/ChatTTS/ChatTTS/core.py", line 199, in init_normalizer
2024-06-02 16:28:28     self.normalizer[lang] = partial(Normalizer(input_case='cased', lang=lang).normalize, verbose=False, punct_post_process=True)
2024-06-02 16:28:28 UnboundLocalError: local variable 'Normalizer' referenced before assignment
Gouryella commented 3 months ago

更新了新的方法,重新尝试即可