ChuanhuChatGPT
ChuanhuChatGPT copied to clipboard
[本地部署] 輸出code時`JSONDecodeError`
以下是我讓他輸出code時, 但未到tkoen數但仍直接出現error, 是因為他預計輸出已經會超出4096 token數嗎? 有下面的錯誤訊息
使用流式传输 实时回答模式 输入token计数: 1503 1it [00:00, 983.89it/s] Traceback (most recent call last): File "C:\Users\wmcha.conda\envs\pythonProject\lib\site-packages\gradio\routes.py", line 384, in run_predict output = await app.get_blocks().process_api( File "C:\Users\wmcha.conda\envs\pythonProject\lib\site-packages\gradio\blocks.py", line 1032, in process_api result = await self.call_function( File "C:\Users\wmcha.conda\envs\pythonProject\lib\site-packages\gradio\blocks.py", line 858, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\wmcha.conda\envs\pythonProject\lib\site-packages\anyio\to_thread.py", line 28, in run_sync return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable, File "C:\Users\wmcha.conda\envs\pythonProject\lib\site-packages\anyio_backends_asyncio.py", line 818, in run_sync_in_worker_thread return await future File "C:\Users\wmcha.conda\envs\pythonProject\lib\site-packages\anyio_backends_asyncio.py", line 754, in run result = context.run(func, *args) File "C:\Users\wmcha.conda\envs\pythonProject\lib\site-packages\gradio\utils.py", line 448, in async_iteration return next(iterator) File "D:\Users\wmcha\PycharmProjects\pythonProject\ChuanhuChatGPT-main\utils.py", line 211, in predict for chatbot, history, status_text, token_count in iter: File "D:\Users\wmcha\PycharmProjects\pythonProject\ChuanhuChatGPT-main\utils.py", line 163, in stream_predict chunk = json.loads(chunk[6:]) File "C:\Users\wmcha.conda\envs\pythonProject\lib\json_init_.py", line 346, in loads return _default_decoder.decode(s) File "C:\Users\wmcha.conda\envs\pythonProject\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\wmcha.conda\envs\pythonProject\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Looks similar... Also check:
- #94
我也遇到了这个问题,进行了比较长的对话时,就会引发JSONDecodeError
issue 长时间无进展。如还有问题,请尝试更新脚本。