Link Search Menu Expand Document

Question Answering

Initialize a HappyQuestionAnswering() object to perform question answering.

This model answers a question given a body of that’s text relevant to the questions.

The outputted answer is always a text-span with the provided information.

Initialization Arguments:

  1. model_type (string): specify the model name in all caps, such as “ROBERTA” or “ALBERT”
  2. model_name(string): below is a URL that contains potential models. MODELS

We recommend using “HappyQuestionAnswering(“ALBERT”, “mfeb/albert-xxlarge-v2-squad2”)” for the best performance

Example 3.0:

    from happytransformer import HappyQuestionAnswering
    # --------------------------------------#
    happy_qa_distilbert = HappyQuestionAnswering("DISTILBERT", "distilbert-base-cased-distilled-squad")  # default
    happy_qa_albert = HappyQuestionAnswering("ALBERT", "mfeb/albert-xxlarge-v2-squad2")
    # good model when using with limited hardware 
    happy_qa_bert = HappyQuestionAnswering("BERT", "mrm8488/bert-tiny-5-finetuned-squadv2")
    happy_qa_roberta = HappyQuestionAnswering("ROBERTA", "deepset/roberta-base-squad2")

Table of contents