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

ernie_pointwise_matching.py文本匹配demo #868

Open
dickobe opened this issue Sep 1, 2020 · 11 comments
Open

ernie_pointwise_matching.py文本匹配demo #868

dickobe opened this issue Sep 1, 2020 · 11 comments
Assignees
Labels
nlp Issues of NLP model

Comments

@dickobe
Copy link

dickobe commented Sep 1, 2020

为什么demo在预测的时候使用gpu时脚本会报错,将use_gpu改成false才可以
image

@Steffy-zxf
Copy link
Contributor

你好!请问paddle版本是多少?

@Steffy-zxf Steffy-zxf self-assigned this Sep 2, 2020
@Steffy-zxf Steffy-zxf added the nlp Issues of NLP model label Sep 2, 2020
@xiaotaiyangsun
Copy link

你好!请问paddle版本是多少?

您好我这里也是同样的问题 ,训练和测试都是用的paddlehub1.8.2。
use_gpu为false结果显示正确
use_gpu为True,报如下错误
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/executor.py:1093: UserWarning: There are no operators in the program to be executed. If you pass Program manually, please use fluid.program_guard to ensure the current Program is being used.
warnings.warn(error_info)
Segmentation fault (core dumped)

@Steffy-zxf
Copy link
Contributor

Steffy-zxf commented Sep 2, 2020

@dickobe @xiaotaiyangsun Padde版本是多少呢?可以按照如下代码查看paddle版本

import paddle
paddle.__version__

@xiaotaiyangsun
Copy link

import paddle
paddle.__version__

1.8.0

@Steffy-zxf
Copy link
Contributor

@xiaotaiyangsun @dickobe 使用GPU预测,建议将matching_task.predict接口参数accelerate_mode置为False。

@xiaotaiyangsun
Copy link

@xiaotaiyangsun @dickobe 使用GPU预测,建议将matching_task.predict接口参数accelerate_mode置为False。

多谢,可gpu预测

@dickobe
Copy link
Author

dickobe commented Sep 2, 2020

@xiaotaiyangsun @dickobe 使用GPU预测,建议将matching_task.predict接口参数accelerate_mode置为False。

问下accelerate_mode是起什么作用的呢,为什么改为False后可以使用gpu?

@Steffy-zxf
Copy link
Contributor

@dickobe accelerate_mode是使用Paddle 高阶预测API Analysis Predictor进行预测。

@dickobe
Copy link
Author

dickobe commented Sep 2, 2020

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

@Steffy-zxf
Copy link
Contributor

问下预测结果能输出匹配的概率得分吗?而不仅仅是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)

@dickobe
Copy link
Author

dickobe commented Dec 2, 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

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

3 participants