[−][src]Module rust_bert::pipelines::question_answering
Question Answering pipeline
Extractive question answering from a given question and context. By default, the dependencies for this model will be downloaded for a DistilBERT model finetuned on SQuAD (Stanford Question Answering Dataset). Customized DistilBERT models can be loaded by overwriting the resources in the configuration. The dependencies will be downloaded to the user's home directory, under ~/.cache/.rustbert/distilbert-qa
use rust_bert::pipelines::question_answering::{QuestionAnsweringModel, QaInput}; let qa_model = QuestionAnsweringModel::new(Default::default())?; let question = String::from("Where does Amy live ?"); let context = String::from("Amy lives in Amsterdam"); let answers = qa_model.predict(&vec!(QaInput { question, context }), 1, 32);
Output:
[ Answer { score: 0.9976, start: 13, end: 21, answer: "Amsterdam" } ]
Structs
Answer | Output for Question Answering |
QaInput | Input for Question Answering |
QuestionAnsweringConfig | Configuration for question answering |
QuestionAnsweringModel | QuestionAnsweringModel to perform extractive question answering |
Functions
squad_processor |