
A brief introduction to the course, and how to get the most out of it.
An overview of everything we'll be covering in this course.
Meet transformer-based NLP in Python and explore practical applications like semantic search and vector-based recommendations, with additional resources and related courses.
How to setup a local Python environment that aligns to the environment used throughout the course.
Learn how to setup a persistent Python environment in Google Colab.
How to setup CUDA for CUDA enabled GPUs.
Explore the rise of neural networks, from deep learning to data-hungry models, and weigh adaptability and accuracy against brittleness and interpretability in natural language processing.
Explore recurrent neural networks and their recurrence for language, with time steps and output state preserving word order, then confront vanishing and exploding gradients in training.
Explore multi-head attention by applying parallel heads to generate diverse word representations, then concatenate and pass through a linear layer to produce attention-encoded tensors from position encoded embeddings.
Explain how positional encoding augments word embeddings to preserve token order in transformers, using sine and cosine waves and multi-head self-attention.
Explore how transformer heads customize bert for masked language modeling, classification, and question answering, using mask tokens, linear mappings to vocab or label spaces, softmax, and argmax.
Here we'll start with our first NLP preprocessing technique, how we can use stopwords.
In the first part of exploration of tokens in NLP, we'll look at word, character, punctuation, part-of-word tokens and more.
In the second part of tokens in NLP, we'll look at model-specific special tokens.
We take a look and the Porter and Lancaster stemmers.
Here we take a look at reducing words to their lemma roots.
Here we will introduce Unicode Normalization and the two forms of equivalence, canonical and compatibility.
Here we take a look at the two different directions in Unicode Normalization, composition, and decomposition.
We'll move onto applying Unicode Normalization in Python with both NFD and NFC forms.
In the final Unicode Normalization session, we'll learn about and implement NFKD and NFKC forms.
Explore four attention mechanisms—encoder-decoder attention, self-attention, bidirectional attention, and multi-head attention—and learn how they work and where they’re used in transformer models.
Explore how the dot product computes alignment in encoder-decoder attention by comparing word vectors, visualized via heatmaps and 3d plots, with cosine similarity discussed as an alternative.
Explore dot-product attention with query, key, and value tensors from embeddings and linear layers for the encoder and decoder, using softmax to produce the final attention.
Explore multi-head attention in bidirectional self-attention within an encoder, using three heads, key/value/query tensors, and a linear projection to scaled dot-product attention.
Build your first transformer model with the flair library, loading the distilbert-based English sentiment model, tokenize text, process it, and extract sentiment labels with scores.
Learn to tokenize text for BERT using encode_plus, set a 512-token max length with truncation and padding, add special tokens, and produce input ids and attention masks.
Pass the input dictionary keys, including input ids, token type ids, and attention masks, to the model as keyword arguments, then apply softmax and use argmax to determine predicted sentiment.
Build an end-to-end NLP project using TensorFlow and transformers, covering data preprocessing with Kaggle data, tokenization, an input pipeline, and model training and predictions for sentiment or language classification.
Preprocesses Kaggle text data by reading and inspecting, optionally deduplicating, tokenizing with the BERT tokenizer to create input IDs and attention masks, and saving numpy arrays and one-hot labels.
Build a TensorFlow input pipeline by loading numpy arrays, creating a dataset with from_tensor_slices, and mapping to a dictionary of input IDs, attention mask, and labels for training.
Shuffle and batch the dataset with batch size 16, drop leftovers, split 90/10 into train and validation sets with take and skip, then save with tf.data.experimental.save.
Initialize a Bert base cased model with TF auto model, feed input ids and attention masks, add a classifier head for sentiment, train for three epochs, and save the model.
In this session we'll work through an example of using windows to calculate sentiment for longer pieces of text.
Discover how spaCy, the defacto standard for named entity recognition and part of speech tagging in Python, involves loading models and visualizing entities with the display module.
Pulls reddit posts via the Reader API, authenticates, requests up to 100 posts, and builds a pandas dataframe with subreddit, name, created utc, title, self text, and score.
Extract organization entities from reddit investing data using spaCy and pandas, build a function to process text and deduplicate results, and populate an organizations column for analysis.
Extract organization mentions from a dataframe, flatten nested lists, and count frequencies with collections.Counter to identify the top ten most frequently mentioned organizations.
Apply sentiment analysis to Reddit investing data with a flair distilbert model and spacy to extract organizations, then build a pandas dataframe of per-organization sentiment scores and rank them.
Master named entity recognition with RoBERTa in spaCy transformers, install spaCy transformers, load the transformer model, and compare RoBERTa-based ner to large spaCy models for accuracy.
An introduction to the two modes of Q&A, open domain (OD) and reading comprehension (RC).
An introduction to the three key model types we will be using in Q&A, retrievers, readers, and generators.
We introduce the SQuAD Q&A dataset.
How we process the SQuAD data to be more friendly for our use-case.
We take a look at refactoring our SQuAD processing data using pattern matching syntax introduced in Python 3.10.
We put together our first Q&A model.
We introduce the ROUGE metrics.
Learn how to implement ROUGE scores using Python.
We take a look at applying ROUGE performance metrics to our first Q&A model.
We work through the intuition and mathematics behind ROUGE-N.
We work through the intuition and mathematics behind ROUGE-L.
Transformer models are the de-facto standard in modern NLP. They have proven themselves as the most expressive, powerful models for language by a large margin, beating all major language-based benchmarks time and time again.
In this course, we cover everything you need to get started with building cutting-edge performance NLP applications using transformer models like Google AI's BERT, or Facebook AI's DPR.
We cover several key NLP frameworks including:
HuggingFace's Transformers
TensorFlow 2
PyTorch
spaCy
NLTK
Flair
And learn how to apply transformers to some of the most popular NLP use-cases:
Language classification/sentiment analysis
Named entity recognition (NER)
Question and Answering
Similarity/comparative learning
Throughout each of these use-cases we work through a variety of examples to ensure that what, how, and why transformers are so important. Alongside these sections we also work through two full-size NLP projects, one for sentiment analysis of financial Reddit data, and another covering a fully-fledged open domain question-answering application.
All of this is supported by several other sections that encourage us to learn how to better design, implement, and measure the performance of our models, such as:
History of NLP and where transformers come from
Common preprocessing techniques for NLP
The theory behind transformers
How to fine-tune transformers
We cover all this and more, I look forward to seeing you in the course!