Learn practical skills, build real-world projects, and advance your career

Assignment 3, Part 2: T5 SQuAD Model

Welcome to the part 2 of testing the models for this week's assignment. This time we will perform decoding using the T5 SQuAD model. In this notebook we'll perform Question Answering by providing a "Question", its "Context" and see how well we get the "Target" answer.

IMPORTANT

  • As you cannot save the changes you make to this colab, you have to make a copy of this notebook in your own drive and run that. You can do so by going to File -> Save a copy in Drive. Close this colab and open the copy which you have made in your own drive.

  • Go to this google drive folder named NLP C4 W3 Colabs & Data. In the folder, next to its name use the drop down menu to select "Add shortcut to Drive" -> "My Drive" and then press ADD SHORTCUT. This should add a shortcut to the folder NLP C4 W3 Colabs & Data within your own google drive. Please make sure this happens, as you'll be reading the data for this notebook from this folder.

  • Make sure your runtime is GPU (not CPU or TPU). And if it is an option, make sure you are using Python 3. You can select these settings by going to Runtime -> Change runtime type -> Select the above mentioned settings and then press SAVE

Note: Restarting the runtime maybe required.

Colab will tell you if the restarting is necessary -- you can do this from the:

Runtime > Restart Runtime

option in the dropdown.

Part 0: Downloading and loading dependencies

Uncomment the code cell below and run it to download some dependencies that you will need. You need to download them once every time you open the colab. You can ignore the kfac error.

!pip -q install trax==1.3.4
|████████████████████████████████| 368kB 3.4MB/s |████████████████████████████████| 2.6MB 16.4MB/s |████████████████████████████████| 1.5MB 35.4MB/s |████████████████████████████████| 163kB 34.9MB/s |████████████████████████████████| 307kB 41.4MB/s |████████████████████████████████| 5.3MB 38.0MB/s |████████████████████████████████| 655kB 46.5MB/s |████████████████████████████████| 194kB 50.3MB/s |████████████████████████████████| 368kB 48.1MB/s |████████████████████████████████| 358kB 52.5MB/s |████████████████████████████████| 983kB 50.9MB/s |████████████████████████████████| 81kB 10.1MB/s |████████████████████████████████| 71kB 10.3MB/s |████████████████████████████████| 1.1MB 49.6MB/s |████████████████████████████████| 1.1MB 52.3MB/s |████████████████████████████████| 3.5MB 50.0MB/s |████████████████████████████████| 235kB 55.8MB/s |████████████████████████████████| 51kB 8.0MB/s |████████████████████████████████| 3.0MB 48.5MB/s |████████████████████████████████| 890kB 47.3MB/s Building wheel for pypng (setup.py) ... done Building wheel for bz2file (setup.py) ... done Building wheel for sacremoses (setup.py) ... done ERROR: kfac 0.2.2 has requirement tensorflow-probability==0.8, but you'll have tensorflow-probability 0.7.0 which is incompatible.