PaddlePaddle / PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
https://paddlenlp.readthedocs.io
Apache License 2.0
12.17k stars 2.95k forks source link

[Question]: UIE项目中使用simpleserver部署时报错 #4103

Closed lddcdut closed 1 year ago

lddcdut commented 1 year ago

请提出你的问题

运行client,出现错误

Traceback (most recent call last):
  File "D:\code\PaddleNLP-develop\model_zoo\uie\deploy\serving\simple_serving\client.py", line 28, in <module>
    datas = json.loads(r.text)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\ProgramData\Miniconda3\envs\sms\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)

打印了下错误结果是: <Response [502]> 代码没有修改过 用的示例代码

wawltor commented 1 year ago

麻烦提供一下PaddleNLP的版本

lddcdut commented 1 year ago

paddlenlp 2.4.4 另外我将client.py中的url = "http://0.0.0.0:8189/taskflow/uie"改为url = "http://127.0.0.1:8189/taskflow/uie"后,返回的状态码变成了500

wawltor commented 1 year ago

可以看一下server打印的错误日志是什么?

lddcdut commented 1 year ago

服务端的报错信息

INFO:     192.168.123.62:3371 - "POST /taskflow/uie HTTP/1.1" 500 Internal Server Error
[2022-12-14 10:38:25,556] [    INFO] - The predictor id: 0 is selected by running the taskflow.
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\routing.py", line 235, in app
    raw_response = await run_endpoint_function(
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "D:\code\PaddleNLP-develop\paddlenlp\server\http_router\router.py", line 104, in predict
    result = self._app._taskflow_manager.predict(inference_request.data, inference_request.parameters)
  File "D:\code\PaddleNLP-develop\paddlenlp\server\taskflow_manager.py", line 40, in predict
    return self._handler_func(self._task[task_index], data, parameters)
  File "D:\code\PaddleNLP-develop\paddlenlp\server\handlers\taskflow_handler.py", line 26, in process
    return predictor(data)
  File "D:\code\PaddleNLP-develop\paddlenlp\taskflow\taskflow.py", line 552, in __call__
    results = self.task_instance(inputs)
  File "D:\code\PaddleNLP-develop\paddlenlp\taskflow\task.py", line 428, in __call__
    inputs = self._preprocess(*args)
  File "D:\code\PaddleNLP-develop\paddlenlp\taskflow\information_extraction.py", line 468, in _preprocess
    inputs = self._check_input_text(inputs)
  File "D:\code\PaddleNLP-develop\paddlenlp\taskflow\information_extraction.py", line 501, in _check_input_text
    raise TypeError(
TypeError: Invalid inputs, the input text should be string. but type of <class 'list'> found!
wawltor commented 1 year ago

辛苦升级PaddleNLP到最新的develop版本,需要手动拉取一下最新develop版本安装

lddcdut commented 1 year ago

代码已经是develop版本了,PaddleNLP怎么安装develop版本?

wawltor commented 1 year ago

代码已经是develop版本了,PaddleNLP怎么安装develop版本?

python setup.py install

lddcdut commented 1 year ago

现在错误信息如下

[2022-12-15 12:43:02,081] [    INFO] - The predictor id: 0 is selected by running the taskflow.
INFO:     192.168.123.62:24451 - "POST /taskflow/uie HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\routing.py", line 235, in app
    raw_response = await run_endpoint_function(
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddlenlp-2.4.1.dev0-py3.10.egg\paddlenlp\server\http_router\router.py", line 104, in predict
    result = self._app._taskflow_manager.predict(inference_request.data, inference_request.parameters)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddlenlp-2.4.1.dev0-py3.10.egg\paddlenlp\server\taskflow_manager.py", line 40, in predict
    return self._handler_func(self._task[task_index], data, parameters)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddlenlp-2.4.1.dev0-py3.10.egg\paddlenlp\server\handlers\taskflow_handler.py", line 34, in process
    return predictor(text)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddlenlp-2.4.1.dev0-py3.10.egg\paddlenlp\taskflow\taskflow.py", line 556, in __call__
    results = self.task_instance(inputs)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddlenlp-2.4.1.dev0-py3.10.egg\paddlenlp\taskflow\task.py", line 429, in __call__
    outputs = self._run_model(inputs)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddlenlp-2.4.1.dev0-py3.10.egg\paddlenlp\taskflow\information_extraction.py", line 902, in _run_model
    results = self._multi_stage_predict(_inputs)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddlenlp-2.4.1.dev0-py3.10.egg\paddlenlp\taskflow\information_extraction.py", line 1000, in _multi_stage_predict
    result_list = self._single_stage_predict(examples)
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddlenlp-2.4.1.dev0-py3.10.egg\paddlenlp\taskflow\information_extraction.py", line 808, in _single_stage_predict
    self.input_handles[0].copy_from_cpu(input_ids.numpy())
  File "C:\ProgramData\Miniconda3\envs\sms\lib\site-packages\paddle\fluid\inference\wrapper.py", line 38, in tensor_copy_from_cpu
    self.copy_from_cpu_bind(data)
RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_7.dll) that Paddle depends on is not configured correctly. (error code is 126)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:305)

环境: paddlenlp 2.4.1.dev0 paddlepaddle-gpu 2.4.1

lddcdut commented 1 year ago

修改了下环境变量 可以正常运行了