-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
请提出你的问题
用最新的2.5.2 paddlenlp版本还是出现静态图、动态图结果不一致的问题:
执行evaluate:
python evaluate_zbq.py --model_path D:\projects\zbq\books\gene-252\0331\chk\model_best --test_path D:\projects\zbq\books\gene_networks\0330-test\test_abbrevtxt.txt --device gpu --batch_size 8 --max_seq_len 512 --debug --schema_lang en
test_abbrevtxt.txt文件内容:
{"content": "SFRP2 mAb was shown to induce antitumor and antiangiogenic effects in vitro and inhibit activation of β-catenin and nuclear factor of activated T-cells c3 (NFATc3) in endothelial and tumor cells.", "result_list": [{"text": "NFATc3", "start": 156, "end": 162}], "prompt": "nuclear factor of activated T-cells c3 is the abbreviation of"}
结果:
[2023-04-03 15:13:20,853] [ INFO] - Class Name: is the abbreviation of X
[2023-04-03 15:13:20,854] [ INFO] - Evaluation Precision: 1.00000 | Recall: 1.00000 | F1: 1.00000
taskflow结果:
脚本:
import paddlenlp
from paddlenlp import Taskflow
print(paddlenlp.version)
ner_labels = [
"Gene",
"Cancer",
"Signal Pathway",
"Gene Function"
]
relation_words = ["is the abbreviation of"]
schema_new = []
for item in ner_labels:
schema_new.append({item:relation_words})
task_path = r'D:\projects\zbq\books\gene-252\0331\chk\model_best'
ie_en = Taskflow('information_extraction', schema=schema_new, task_path=task_path)
ie_en('SFRP2 mAb was shown to induce antitumor and antiangiogenic effects in vitro and inhibit activation of β-catenin and nuclear factor of activated T-cells c3 (NFATc3) in endothelial and tumor cells.')
结果:
[{'Gene': [{'text': 'SFRP2',
'start': 0,
'end': 5,
'probability': 0.779808722711369},
{'text': 'β-catenin',
'start': 102,
'end': 111,
'probability': 0.9258959586963584},
{'text': 'NFATc3',
'start': 156,
'end': 162,
'probability': 0.40479903369438475}]}]