Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

> > 问下语义匹配预测结果能输出匹配的概率得分吗?而不仅仅是0和1 #1077

Open
dickobe opened this issue Dec 3, 2020 · 2 comments
Assignees
Labels
nlp Issues of NLP model

Comments

@dickobe
Copy link

dickobe commented Dec 3, 2020

问下预测结果能输出匹配的概率得分吗?而不仅仅是0和1

将predict接口参数return_result=False,按照如下代码进行后处理:

run_states = pointwise_matching_task.predict(
    data=text_pairs,
    max_seq_len=args.max_seq_len,
    label_list=dataset.get_labels(),
    return_result=False,
    accelerate_mode=False)

for batch_states in run_states:
    # 对应label概率值
    batch_results = batch_states.run_results
    print(batch_results)

@Steffy-zxf 你好 我按照上面的方式,输出只有0和1,帮忙看下
image
image

Originally posted by @dickobe in #868 (comment)

@haoyuying haoyuying added the nlp Issues of NLP model label Dec 3, 2020
@KPatr1ck
Copy link
Contributor

KPatr1ck commented Dec 4, 2020

此问题目前需要在paddlehub/finetune/task/matching_task.py文件中,在第750行进行修改后修复:

if return_result or not self._compatible_mode:
    return self._postprocessing(run_states)

修改为:

if return_result:
    return self._postprocessing(run_states)

1.8版本中的加入的兼容性代码影响了predidt结果处理的逻辑,之后2.0版本更新支持动态图版本的pointwise_matching_task,将修复这个问题。

@wa3926
Copy link

wa3926 commented Dec 14, 2020

遇到和你一样的问题了 貌似只有改源码了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nlp Issues of NLP model
Projects
None yet
Development

No branches or pull requests

5 participants