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
11.8k stars 2.88k forks source link

[Question]: 情感分析基于Pipeline进行部署时 python rest_api/application.py 8891出现问题 #5966

Closed hypiuser closed 6 months ago

hypiuser commented 1 year ago

请提出你的问题

2.3.1启动restapi模型服务时报错:

C:\Users\ternico\Downloads\PaddleNLP-develop\pipelines>set CUDA_VISIBLE_DEVICES=0

C:\Users\ternico\Downloads\PaddleNLP-develop\pipelines>set PIPELINE_YAML_PATH=rest_api/pipeline/senta.yaml

C:\Users\ternico\Downloads\PaddleNLP-develop\pipelines>set QUERY_PIPELINE_NAME=senta_pipeline

C:\Users\ternico\Downloads\PaddleNLP-develop\pipelines>python rest_api/application.py 8891 E:\anaconda3\lib\site-packages\win32\lib\pywintypes.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp, sys, os E:\anaconda3\lib\site-packages\skimage\restoration\inpaint.py:6: DeprecationWarning: Please use laplace from the scipy.ndimage namespace, the scipy.ndimage.filters namespace is deprecated. from scipy.ndimage.filters import laplace E:\anaconda3\lib\site-packages\skimage\feature_orb_descriptor_positions.py:8: DeprecationWarning: loadtxt(): Parsing an integer via a float is deprecated. To avoid this warning, you can:

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "rest_api/application.py", line 29, in from rest_api.controller.router import router as api_router File ".\rest_api\controller\router.py", line 17, in from rest_api.controller import file_upload, search, feedback, document File ".\rest_api\controller\search.py", line 58, in PIPELINE = Pipeline.load_from_yaml(Path(PIPELINE_YAML_PATH), pipeline_name=QUERY_PIPELINE_NAME) File "E:\anaconda3\lib\site-packages\pipelines\pipelines\base.py", line 273, in load_from_yaml return cls.load_from_config( File "E:\anaconda3\lib\site-packages\pipelines\pipelines\base.py", line 830, in load_from_config component = cls._load_or_get_component( File "E:\anaconda3\lib\site-packages\pipelines\pipelines\base.py", line 879, in _load_or_get_component raise Exception(f"Failed loading pipeline component '{name}': {e}") Exception: Failed loading pipeline component 'PreProcessor': pipelines component with the name 'SentaProcessor' does not exist.

运行pip check时出现以下,不知道是否相关: C:\Users\ternico\Downloads\PaddleNLP-develop\pipelines>pip check conda-repo-cli 1.0.4 requires pathlib, which is not installed. anaconda-project 0.9.1 requires ruamel-yaml, which is not installed. tensorflow-intel 2.12.0 has requirement protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3, but you have protobuf 3.19.0. tensorboard 2.12.3 has requirement protobuf>=3.19.6, but you have protobuf 3.19.0. python-lsp-black 1.2.1 has requirement black>=22.3.0, but you have black 0.0. pymilvus 2.2.8 has requirement protobuf>=3.20.0, but you have protobuf 3.19.0. pylint 2.12.2 has requirement mccabe<0.7,>=0.6, but you have mccabe 0.7.0. moviepy 1.0.3 has requirement decorator<5.0,>=4.0.2, but you have decorator 5.1.1.

w5688414 commented 1 year ago

请升级Pipielines到最新的版本。

hypiuser commented 1 year ago

请升级Pipielines到最新的版本。

你好,重新安装pipelines新版本后变成了这样: (base) C:\Users\ternico\Downloads\PaddleNLP-develop\pipelines>python rest_api/application.py 8891 E:\anaconda3\lib\site-packages\win32\lib\pywintypes.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's d ocumentation for alternative uses import imp, sys, os E:\anaconda3\lib\site-packages\skimage\restoration\inpaint.py:6: DeprecationWarning: Please use laplace from the scipy.ndimage namespace, the sc ipy.ndimage.filters namespace is deprecated. from scipy.ndimage.filters import laplace E:\anaconda3\lib\site-packages\skimage\feature_orb_descriptor_positions.py:8: DeprecationWarning: loadtxt(): Parsing an integer via a float is depre cated. To avoid this warning, you can:

之后 C:\Users\ternico\Downloads\PaddleNLP-develop\pipelines>python ui/webapp_senta.py --serving_port 8891 sys:1: UserWarning: You have unused kwarg parameters in Row, please remove them: {'equal_height': True} sys:1: UserWarning: You have unused kwarg parameters in Column, please remove them: {'equal_height': True} Running on local URL: http://127.0.0.1:7860 打开网页还是有问题,有一个上传和提交的界面,但是实际提交无响应

提交时候弹出: During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\anaconda3\lib\site-packages\gradio\routes.py", line 414, in run_predict output = await app.get_blocks().process_api( File "E:\anaconda3\lib\site-packages\gradio\blocks.py", line 1323, in process_api result = await self.call_function( File "E:\anaconda3\lib\site-packages\gradio\blocks.py", line 1051, in call_function prediction = await anyio.to_thread.run_sync( File "E:\anaconda3\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 "E:\anaconda3\lib\site-packages\anyio_backends_asyncio.py", line 818, in run_sync_in_worker_thread return await future File "E:\anaconda3\lib\site-packages\anyio_backends_asyncio.py", line 754, in run result = context.run(func, args) File "ui/webapp_senta.py", line 48, in process_file r = requests.post(url, json={"meta": {"file_path": file_path, "save_path": save_path}}) File "E:\anaconda3\lib\site-packages\requests\api.py", line 119, in post return request('post', url, data=data, json=json, kwargs) File "E:\anaconda3\lib\site-packages\requests\api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "E:\anaconda3\lib\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "E:\anaconda3\lib\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, kwargs) File "E:\anaconda3\lib\site-packages\requests\adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=8891): Max retries exceeded with url: /senta_file (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002370F940640>: Failed to establish a new connection: [WinError 10049] 在其上下文中,该请求的地址无效。'))

ANemo-yj commented 1 year ago

我也出现这个问题 请问怎么解决 INFO - pipelines.utils.common_utils - Number of GPUs: 1 [2023-06-07 10:44:53,838] [ INFO] - We are using <class 'paddlenlp.transformers.ernie_gram.modeling.ErnieGramForQuestionAnswering'> to load 'ernie-gram-zh-finetuned-dureader-robust' . [2023-06-07 10:44:53,838] [ INFO] - Already cached C:\Users\54405.paddlenlp\models\ernie-gram-zh-finetuned-dureader-robust\model_state.pdparams [2023-06-07 10:44:54,954] [ INFO] - We are using <class 'paddlenlp.transformers.ernie_gram.tokenizer.ErnieGramTokenizer'> to load 'ernie-gram-zh-finetuned-dureader-robust'. [2023-06-07 10:44:54,954] [ INFO] - Already cached C:\Users\54405.paddlenlp\models\ernie-gram-zh-finetuned-dureader-robust\vocab.txt [2023-06-07 10:44:54,954] [ INFO] - tokenizer config file saved in C:\Users\54405.paddlenlp\models\ernie-gram-zh-finetuned-dureader-robust\tokenizer_config.json [2023-06-07 10:44:54,954] [ INFO] - Special tokens file saved in C:\Users\54405.paddlenlp\models\ernie-gram-zh-finetuned-dureader-robust\special_tokens_map.json INFO - pipelines.utils.logger - Logged parameters: {'processor': 'SquadProcessor', 'tokenizer': 'ErnieGramTokenizer', 'max_seq_len': '256', 'dev_split': '0'} WARNING - pipelines.pipelines.base - YAML version (1.1.0) does not match with pipelines version (0.0.0). Issues may occur during loading. To fix this warning, save again this pipeline with the current pipelines version using Pipeline.save_to_yaml(), or downgrade to pipelines version 0.0.0. WARNING - pipelines - Request pipeline ('query_qa_pairs: is null'). INFO: Started server process [644] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8891 (Press CTRL+C to quit) INFO: 127.0.0.1:62430 - "GET / HTTP/1.1" 404 Not Found