Fengshenbang-LM icon indicating copy to clipboard operation
Fengshenbang-LM copied to clipboard

is there any example for relation extraction (ubert)?

Open feng-1985 opened this issue 2 years ago • 1 comments

import argparse
from fengshen import UbertPiplines

total_parser = argparse.ArgumentParser("TASK NAME")
total_parser = UbertPiplines.piplines_args(total_parser)
args = total_parser.parse_args()
args.pretrained_model_path = 'IDEA-CCNL/Erlangshen-Ubert-110M-Chinese'  #预训练模型路径
test_data=[
    {
        "task_type": "抽取任务", 
        "subtask_type": "关系抽取", 
        "text": "姚明妻子叶莉罕见现身!39岁气质出众端庄,姚明却发福严重", 
        "choices": [ 
            {"entity_type": "夫妻关系"}
            ],
        "id": 0}
]

model = UbertPiplines(args)
result = model.predict(test_data)
for line in result:
    print(line)

feng-1985 avatar Aug 06 '22 01:08 feng-1985

hi!@bifeng ubert is developed for 2022AIWIN, and there is no relation extraction task in this competition. Therefore, we currently do not provide the decoding code for relation extraction. We are developing an upgraded version of ubert, which is specially developed for relation extraction tasks and will be open sourced in the near future

suolyer avatar Aug 08 '22 02:08 suolyer

Hi @suolyer !

Is relation extraction open sourced now?

Chunhao-Li avatar Mar 13 '23 10:03 Chunhao-Li