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.98k stars 2.92k forks source link

[Bug]: ImportError: cannot import name 'Taskflow' from partially initialized module 'paddlenlp' #7230

Closed BIM4SmartHydropower closed 8 months ago

BIM4SmartHydropower commented 11 months ago

软件环境

- paddlepaddle:2.5.1
- paddlepaddle-gpu: 2.5.1
- paddlenlp: 2.6.1

重复问题

错误描述

无论是命令行还是脚本文件。
在下面的例子中,都会报错。
https://gitee.com/paddlepaddle/PaddleNLP/blob/develop/applications/information_extraction/text/README.md
而且,现有的issues中也没有可行的解决方案。

稳定复现步骤 & 代码

from pprint import pprint from paddlenlp import Taskflow

schema = {"武器名称": ["产国", "类型", "研发单位"]}

设定抽取目标和定制化模型权重路径

my_ie = Taskflow("information_extraction", schema=schema, task_path='./checkpoint/model_best') pprint(my_ie("威尔哥(Virgo)减速炸弹是由瑞典FFV军械公司专门为瑞典皇家空军的攻击机实施低空高速轰炸而研制,1956年开始研制,1963年进入服役,装备于A32“矛盾”、A35“龙”、和AJ134“雷”攻击机,主要用于攻击登陆艇、停放的飞机、高炮、野战火炮、轻型防护装甲车辆以及有生力量。")) [{'武器名称': [{'end': 14, 'probability': 0.9998632702221926, 'relations': {'产国': [{'end': 18, 'probability': 0.9998815094394331, 'start': 16, 'text': '瑞典'}], '研发单位': [{'end': 25, 'probability': 0.9995875123178521, 'start': 18, 'text': 'FFV军械公司'}], '类型': [{'end': 14, 'probability': 0.999877336059086, 'start': 12, 'text': '炸弹'}]}, 'start': 0, 'text': '威尔哥(Virgo)减速炸弹'}]}]

BIM4SmartHydropower commented 11 months ago

image

github-actions[bot] commented 9 months ago

This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。

github-actions[bot] commented 8 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。