使用 AI 进行布尔问答预测
项目描述
布尔问题
使用此 python pytorch 模型获得正确/错误问题的准确答案预测。该模型将段落和问题作为输入,并返回“真”或“假”作为预测答案。使用的模型是在BoolQ数据集上进一步训练的RoBERTa。
安装
使用 python 包安装程序 pip 安装它
pip install boolean_question
或者安装最新的 master 分支
pip install git+https://github.com/Saadmairaj/boolean-question
用法
用法简单直接,导入BoolQ类模型并将参数传递给BoolQ.predict(passage: str, question: str)方法以预测布尔答案“True”或“False”
import pprint
from boolean_question import BoolQ
bq = BoolQ()
passage = """
A red dwarf is the smallest and coolest kind of star on the main sequence.
Red dwarfs are by far the most common type of star in the Milky Way, at
least in the neighborhood of the Sun, but because of their low luminosity,
individual red dwarfs cannot be easily observed."""
question = "Coolest star in the Milky way is a Red dwarf"
# Predict the answer from the passage and the question
ans = bq.predict(passage, question)
print(ans)
# After prediction extra details of the prediction can be seen with the below command
pprint.pprint(bq.prediction_details())
查看输出
True
{'answer': True,
'confidence': None,
'false confidence': 0.01,
'passage': '\n'
'A red dwarf is the smallest and coolest kind of star on the main '
'sequence. Red dwarfs are by far the most common type of star in \n'
'the Milky Way, at least in the neighborhood of the Sun, but '
'because of their low luminosity, individual red dwarfs cannot '
'be \n'
'easily observed.',
'question': 'Coolest star in the Milky way is a Red dwarf',
'true confidence': 0.99}
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
boolean_question-0.0.3.tar.gz
(9.3 kB
查看哈希)
内置分布
boolean_question-0.0.3-py3-none-any.whl
(11.3 kB
查看哈希)
关
boolean_question -0.0.3.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 667b2d289c7bb4726a5040f6d12305b18b36e0c05d7b462edf94ce6f63a89c5c |
|
| MD5 | a8157d23d6555ad647d5857d34838e6b |
|
| 布莱克2-256 | dfc68bb430b9cffb29743e1a1a735af8b9636a3e5549b65dec8ec593886938c5 |
关
boolean_question -0.0.3-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | d9a561ce891fe054167b0442c389b49e99578d64e60655673f38030adf37cfa9 |
|
| MD5 | 463a22a147b53571ab9518e7083c3687 |
|
| 布莱克2-256 | 10ece488a47d6b7597087e36277945912f250727036a9cc0a8a63d9dbb85324b |