13 Transformers

 

This chapter covers

  • Implementing a full Transformer model with all the components
  • Implementing a spam classifier using a pretrained BERT model from TFHub
  • Implementing a question-answering model using Hugging Face’s Transformer library

13.1 Transformers in more detail

13.1.1 Revisiting the basic components of the Transformer

13.1.2 Embeddings in the Transformer

13.1.3 Residuals and normalization

13.2 Using pretrained BERT for spam classification

13.2.1 Understanding BERT

13.2.2 Classifying spam with BERT in TensorFlow

13.3 Question answering with Hugging Face’s Transformers

13.3.1 Understanding the data

13.3.2 Processing data

13.3.3 Defining the DistilBERT model

13.3.4 Training the model

13.3.5 Ask BERT a question

Summary

Answers to exercises