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.19k stars 2.95k forks source link

[Question]: Taskflow("feature_extraction")功能是否下线?按照Paddle文档中的代码运行报错:RuntimeError #9545

Open Alonghui opened 1 day ago

Alonghui commented 1 day ago

请提出你的问题

Paddle文档中写明的Taskflow("feature_extraction")这个功能是否不能使用了?我在aistudio中运行该功能会出现报错。

代码

>>> from paddlenlp import Taskflow
>>> import paddle.nn.functional as F
>>> feature_extractor = Taskflow("feature_extraction")

出现如下报错:

RuntimeError Traceback (most recent call last) Cell In[17], line 3 1 from paddlenlp import Taskflow 2 import paddle.nn.functional as F ----> 3 feature_extractor = Taskflow("feature_extraction")

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlenlp/taskflow/taskflow.py:809, in Taskflow.init(self, task, model, mode, device_id, from_hf_hub, kwargs) 807 self.kwargs = kwargs 808 task_class = TASKS[self.task][tag][self.model]["task_class"] --> 809 self.task_instance = task_class( 810 model=self.model, task=self.task, priority_path=self.priority_path, from_hf_hub=from_hf_hub, self.kwargs 811 ) 812 task_list = TASKS.keys() 813 Taskflow.task_list = task_list

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlenlp/taskflow/multimodal_feature_extraction.py:229, in MultimodalFeatureExtractionTask.init(self, task, model, batch_size, is_static_model, max_length, return_tensors, **kwargs) 227 self._check_predictor_type() 228 if self.is_static_model: --> 229 self._get_inference_model() 230 else: 231 self._construct_model(model)

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlenlp/taskflow/multimodal_feature_extraction.py:427, in MultimodalFeatureExtractionTask._get_inference_model(self) 425 self._static_model_file = self.inference_model_path + ".pdmodel" 426 self._static_params_file = self.inference_model_path + ".pdiparams" --> 427 self._config = paddle.inference.Config(self._static_model_file, self._static_params_file) 428 self._prepare_static_mode() 430 self.predictor_map["text"] = self.predictor

RuntimeError: (NotFound) Cannot open file /home/aistudio/.paddlenlp/taskflow/feature_extraction/PaddlePaddle/ernie_vil-2.0-base-zh/static/get_text_features.pdmodel, please confirm whether the file is normal. [Hint: Expected paddle::inference::IsFileExists(progfile) == true, but received paddle::inference::IsFileExists(progfile):0 != true:1.] (at /paddle/paddle/fluid/inference/api/analysis_config.cc:111)

wawltor commented 1 day ago

提供下你的paddle版本?

Alonghui commented 19 hours ago

提供下你的paddle版本?

Python: 3.10.10 PaddlePaddle 3.0.0beta2 或 Python: 3.7.4 PaddlePaddle 2.4.0 这两个版本都试过 ‘零样本分类’和‘情感分析’这两个功能也试了,也不行 在aistudio中无法加载,会出现RuntimeError错误 image