The goal of Question Answering is to find the answer to a question given a question and an accompanying context. The predicted answer will be either a span of text from the context or an empty string (indicating the question cannot be answered from the context).
The process of performing Question Answering in Simple Transformers does not deviate from the standard pattern.
- Initialize a
- Train the model with
- Evaluate the model with
- Make predictions on (unlabelled) data with
Supported Model Types
New model types are regularly added to the library. Question Answering tasks currently supports the model types given below.
|Model||Model code for
Tip: The model code is used to specify the
model_type in a Simple Transformers model.
Lazy Loading Data
The system memory required to keep a large dataset in memory can be prohibitively large. In such cases, the data can be lazy loaded from disk to minimize memory consumption.
To enable lazy loading, you must set the
lazy_loading flag to
1 2 model_args = QuestionAnsweringArgs() model_args.lazy_loading = True
Note: This will typically be slower as the feature conversion is done on the fly. However, the tradeoff between speed and memory consumption should be reasonable.
Tip: See Lazy Loading Data Formats for information on the data formats.
Tip: See Configuring a QuestionAnsweringArgs model for information on configuring the model to read the lazy loading data file correctly.
Tip: You can find a minimal example script in