QwenLM / Qwen2-Audio

The official repo of Qwen2-Audio chat & pretrained large audio language model proposed by Alibaba Cloud.
1.11k stars 66 forks source link

Encoding Issue in Japanese Environment #31

Open ranran747 opened 1 month ago

ranran747 commented 1 month ago

When running the web_demo_audio.py script in a Japanese Windows environment, an encoding error occurs. The script fails to load files correctly due to a mismatch between the expected encoding (cp932) and the actual file encoding.

Running on local URL: http://127.0.0.1:8000

To create a public link, set share=True in launch(). ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 399, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 70, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 186, in call raise exc File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in call await self.app(scope, receive, _send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\gradio\route_utils.py", line 707, in call await self.app(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app raise exc File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 776, in app await route.handle(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 297, in handle await self.app(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app raise exc File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 278, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 193, in run_endpoint_function return await run_in_threadpool(dependant.call, values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\concurrency.py", line 42, in run_in_threadpool return await anyio.to_thread.run_sync(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 2177, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 859, in run result = context.run(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\gradio\routes.py", line 469, in custom_component_path Path(path).read_text().encode() ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\pathlib.py", line 1028, in read_text return f.read() ^^^^^^^^ UnicodeDecodeError: 'cp932' codec can't decode byte 0x97 in position 803728: illegal multibyte sequence ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 399, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 70, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 186, in call raise exc File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in call await self.app(scope, receive, _send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\gradio\route_utils.py", line 707, in call await self.app(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app raise exc File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 776, in app await route.handle(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 297, in handle await self.app(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app raise exc File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 278, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 193, in run_endpoint_function return await run_in_threadpool(dependant.call, values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\concurrency.py", line 42, in run_in_threadpool return await anyio.to_thread.run_sync(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 2177, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\anyio_backends_asyncio.py", line 859, in run result = context.run(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\site-packages\gradio\routes.py", line 469, in custom_component_path Path(path).read_text().encode() ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pulle\AppData\Local\Programs\Python\Python312\Lib\pathlib.py", line 1028, in read_text return f.read() ^^^^^^^^ UnicodeDecodeError: 'cp932' codec can't decode byte 0x97 in position 738210: illegal multibyte sequence

dkmin commented 1 month ago

+1