PaddleNLP
PaddleNLP copied to clipboard
运行UIE的例子,为啥得到的结果是错误的
代码如下: from paddlenlp import Taskflow from pprint import pprint
schema = ['时间', '选手', '赛事名称'] # Define the schema for entity extraction ie = Taskflow('information_extraction', schema=schema) pprint(ie("2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷爱凌以188.25分获得金牌!")) # Better print results using pprint
输出的结果如下: :\mywork\project\NLPTest\venv\Scripts\python.exe D:\mywork\project\NLPTest\main.py D:\mywork\project\NLPTest\venv\lib\site-packages_distutils_hack_init_.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") [2023-12-03 21:13:22,814] [ INFO] - Downloading model_state.pdparams from https://bj.bcebos.com/paddlenlp/taskflow/information_extraction/uie_base_v1.1/model_state.pdparams 100%|██████████| 450M/450M [00:12<00:00, 39.0MB/s] [2023-12-03 21:13:36,515] [ INFO] - Downloading config.json from https://bj.bcebos.com/paddlenlp/taskflow/information_extraction/uie_base/config.json 100%|██████████| 610/610 [00:00<?, ?B/s] [2023-12-03 21:13:36,767] [ INFO] - Downloading vocab.txt from https://bj.bcebos.com/paddlenlp/taskflow/information_extraction/uie_base/vocab.txt 100%|██████████| 182k/182k [00:00<00:00, 852kB/s] [2023-12-03 21:13:37,280] [ INFO] - Downloading special_tokens_map.json from https://bj.bcebos.com/paddlenlp/taskflow/information_extraction/uie_base/special_tokens_map.json 100%|██████████| 112/112 [00:00<?, ?B/s] [2023-12-03 21:13:37,529] [ INFO] - Downloading tokenizer_config.json from https://bj.bcebos.com/paddlenlp/taskflow/information_extraction/uie_base/tokenizer_config.json 100%|██████████| 172/172 [00:00<?, ?B/s] [2023-12-03 21:13:37,747] [ INFO] - loading configuration file C:\Users\coudy.paddlenlp\taskflow\information_extraction\uie-base\config.json [2023-12-03 21:13:37,748] [ INFO] - Model config ErnieConfig { "architectures": [ "UIE" ], "attention_probs_dropout_prob": 0.1, "dtype": "float32", "enable_recompute": false, "fuse": false, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "initializer_range": 0.02, "intermediate_size": 3072, "layer_norm_eps": 1e-12, "max_position_embeddings": 2048, "model_type": "ernie", "num_attention_heads": 12, "num_hidden_layers": 12, "pad_token_id": 0, "paddlenlp_version": null, "pool_act": "tanh", "task_id": 0, "task_type_vocab_size": 3, "type_vocab_size": 4, "use_task_id": true, "vocab_size": 40000 }
[2023-12-03 21:14:00,362] [ INFO] - All model checkpoint weights were used when initializing UIE.
[2023-12-03 21:14:00,362] [ INFO] - All the weights of UIE were initialized from the model checkpoint at C:\Users\coudy.paddlenlp\taskflow\information_extraction\uie-base. If your task is similar to the task the model of the checkpoint was trained on, you can already use UIE for predictions without further training. [2023-12-03 21:14:00,394] [ INFO] - Converting to the inference model cost a little time. I1203 21:14:03.044967 11032 interpretercore.cc:237] New Executor is Running. [2023-12-03 21:14:05,333] [ INFO] - The inference model save in the path:C:\Users\coudy.paddlenlp\taskflow\information_extraction\uie-base\static\inference [2023-12-03 21:14:06,164] [ INFO] - We are using <class 'paddlenlp.transformers.ernie.tokenizer.ErnieTokenizer'> to load 'C:\Users\coudy.paddlenlp\taskflow\information_extraction\uie-base'. [{'赛事名称': [{'end': 4, 'probability': 0.3464906954924629, 'start': 1, 'text': '月8日'}, {'end': 0, 'probability': 0.3239983692435544, 'start': 0, 'text': ''}, {'end': 0, 'probability': 0.28662281814175117, 'start': 0, 'text': ''}, {'end': 0, 'probability': 0.2829913402307511, 'start': 0, 'text': ''}]}]
Process finished with exit code 0
paddlepadle和paddlenlp的版本降到2.4.1试试
UIE停止更新了,使用早期的2.5版本试试
This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。
This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。