transformer_qa
TransformerQAPredictor#
class TransformerQAPredictor(Predictor):
| def __init__(
| self,
| model: Model,
| dataset_reader: DatasetReader
| ) -> None
Predictor for the allennlp_rc.models.TransformerQA
model, and any
other model that takes a question and passage as input.
predict#
class TransformerQAPredictor(Predictor):
| ...
| def predict(self, question: str, passage: str) -> JsonDict
Make a machine comprehension prediction on the supplied input. See https://rajpurkar.github.io/SQuAD-explorer/ for more information about the machine comprehension task.
Parametersquestion : str
A question about the content in the supplied paragraph. The question must be answerable by a
span in the paragraph.
passage : str
A paragraph of information relevant to the question.
ReturnsA dictionary that represents the prediction made by the system. The answer string will be under the
"best_span_str" key.
predict_json#
class TransformerQAPredictor(Predictor):
| ...
| def predict_json(self, inputs: JsonDict) -> JsonDict
predict_batch_json#
class TransformerQAPredictor(Predictor):
| ...
| @overrides
| def predict_batch_json(self, inputs: List[JsonDict]) -> List[JsonDict]
predict_batch_instance#
class TransformerQAPredictor(Predictor):
| ...
| @overrides
| def predict_batch_instance(
| self,
| instances: List[Instance]
| ) -> List[JsonDict]