The Question Answering module within AdaptNLP
class
QACallback
[source]
QACallback
(xmodel_instances
,features
) ::Callback
Basic Question Answering Data Callback
Parameters:
xmodel_instances
: <class 'inspect._empty'>
features
: <class 'inspect._empty'>
class
QAResult
[source]
QAResult
(examples
:List
[SquadExample
],top_predictions
:Union
[str
,OrderedDict
],all_nbest_json
:List
[OrderedDict
],n_best_size
:int
)
A result class designed for Question Answering models
Parameters:
examples
: typing.List[transformers.data.processors.squad.SquadExample]
top_predictions
: typing.Union[str, collections.OrderedDict]
all_nbest_json
: typing.List[collections.OrderedDict]
n_best_size
: <class 'int'>
class
TransformersQuestionAnswering
[source]
TransformersQuestionAnswering
(tokenizer
:PreTrainedTokenizer
,model
:PreTrainedModel
) ::AdaptiveModel
Adaptive Model for Transformers Question Answering Model
Parameters
Parameters:
tokenizer
: <class 'transformers.tokenization_utils.PreTrainedTokenizer'>
model
: <class 'transformers.modeling_utils.PreTrainedModel'>
class
EasyQuestionAnswering
[source]
EasyQuestionAnswering
()
Question Answering Module
Usage:
>>> qa = adaptnlp.EasyQuestionAnswering()
>>> qa.predict_qa(query='What is life?', context='Life is NLP.', n_best_size=5, mini_batch_size=1)