Method 0: Trial and error
Question-answering seems very easy. Is that true? Let’s find out.
Open QA.ipynb
, the Google Colab notebook we will be using in this chapter. We will run the notebook cell by cell.
Run the first cell to install Hugging Face’s transformers, the framework we will be implementing in this chapter:
!pip install -q transformers
Note: Hugging Face transformers continually evolve, updating libraries and modules to adapt to the market. If the default version doesn’t work, you might have to pin one with !pip install transformers==[version that runs with the other functions in the notebook]
.
We will now import Hugging Face’s pipeline, which contains many ready-to-use transformer resources. They provide high-level abstraction functions for the Hugging Face library resources to perform a wide range of tasks. We can access those NLP tasks through a simple API. The program was created on Google Colab. It recommended...