在win10命令行中出现Internal Server Error 在服务器中显示如下: ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 429, in run_asgi result = await app( # type: ignore[func-returns-value] File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call return await self.app(scope, receive, send) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/fastapi/applications.py", line 276, in call await super().call(scope, receive, send) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in call raise exc File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in call await self.app(scope, receive, _send) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call raise e File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app raw_response = await run_endpoint_function( File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/fastapi/routing.py", line 163, in run_endpoint_function return await dependant.call(**values) File "/home/bs2301/work/chatglm_6B/ChatGLM-6B/api.py", line 25, in create_item json_post_raw = await request.json() File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/site-packages/starlette/requests.py", line 244, in json self._json = json.loads(body) File "/home/bs2301/miniconda3/envs/chatglm/lib/python3.10/json/init.py", line 341, in loads s = s.decode(detect_encoding(s), 'surrogatepass') UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 9: invalid continuation byte
Steps To Reproduce我先在centos7服务器中部署并运行了api.py,然后在win10命令行中输入:curl -H "Content-Type: application/json" -d "{"prompt": "你好", "history": []}" http://服务器的IP:8000
Environment- OS:Windows10,Centos7
- Python:3.8
- Transformers:
- PyTorch:
- CUDA Support:True