Sentence Similarity With Transformers and PyTorch (Python)
Easy mode: https://youtu.be/Ey81KfQ3PQU
All we ever seem to talk about nowadays are BERT this, BERT that. I want to talk about something else, but BERT is just too good - so this video will be about BERT for sentence similarity.
A big part of NLP relies on similarity in highly-dimensional spaces. Typically an NLP solution will take some text, process it to create a big vector/array representing said text - then perform several transformations.
It's highly-dimensional magic.
Sentence similarity is one of the clearest examples of how powerful highly-dimensional magic can be.
The logic is this:
- Take a sentence, convert it into a vector.
- Take many other sentences, and convert them into vectors.
- Find sentences that have the smallest distance (Euclidean) or smallest angle (cosine similarity) between them - more on that here.
- We now have a measure of semantic similarity between sentences - easy!
At a high level, there's not much else to it. But of course, we want to understand what is happening in a little more detail and implement this in Python too.
🤖 70% Discount on the NLP With Transformers in Python course:
https://bit.ly/3DFvvY5
Medium article:
https://towardsdatascience.com/bert-for-measuring-text-similarity-eec91c6bf9e1
🎉 Sign-up For New Articles Every Week on Medium!
https://medium.com/@jamescalam/membership
📖 If membership is too expensive - here's a free link:
https://towardsdatascience.com/bert-for-measuring-text-similarity-eec91c6bf9e1?sk=c0f2990b4660210b447e52d55bd0f4e5
👾 Discord
https://discord.gg/c5QtDB9RAP
🕹️ Free AI-Powered Code Refactoring with Sourcery:
https://sourcery.ai/?utm_source=YouTub&utm_campaign=JBriggs&utm_medium=aff
00:00 Intro
00:16 BERT Base Network
1:11 Sentence Vectors and Similarity
1:47 The Data and Model
3:01 Two Approaches
3:16 Tokenizing Sentences
9:11 Creating last_hidden_state Tensor
11:08 Creating Sentence Vectors
17:53 Cosine Similarity
Видео Sentence Similarity With Transformers and PyTorch (Python) канала James Briggs
All we ever seem to talk about nowadays are BERT this, BERT that. I want to talk about something else, but BERT is just too good - so this video will be about BERT for sentence similarity.
A big part of NLP relies on similarity in highly-dimensional spaces. Typically an NLP solution will take some text, process it to create a big vector/array representing said text - then perform several transformations.
It's highly-dimensional magic.
Sentence similarity is one of the clearest examples of how powerful highly-dimensional magic can be.
The logic is this:
- Take a sentence, convert it into a vector.
- Take many other sentences, and convert them into vectors.
- Find sentences that have the smallest distance (Euclidean) or smallest angle (cosine similarity) between them - more on that here.
- We now have a measure of semantic similarity between sentences - easy!
At a high level, there's not much else to it. But of course, we want to understand what is happening in a little more detail and implement this in Python too.
🤖 70% Discount on the NLP With Transformers in Python course:
https://bit.ly/3DFvvY5
Medium article:
https://towardsdatascience.com/bert-for-measuring-text-similarity-eec91c6bf9e1
🎉 Sign-up For New Articles Every Week on Medium!
https://medium.com/@jamescalam/membership
📖 If membership is too expensive - here's a free link:
https://towardsdatascience.com/bert-for-measuring-text-similarity-eec91c6bf9e1?sk=c0f2990b4660210b447e52d55bd0f4e5
👾 Discord
https://discord.gg/c5QtDB9RAP
🕹️ Free AI-Powered Code Refactoring with Sourcery:
https://sourcery.ai/?utm_source=YouTub&utm_campaign=JBriggs&utm_medium=aff
00:00 Intro
00:16 BERT Base Network
1:11 Sentence Vectors and Similarity
1:47 The Data and Model
3:01 Two Approaches
3:16 Tokenizing Sentences
9:11 Creating last_hidden_state Tensor
11:08 Creating Sentence Vectors
17:53 Cosine Similarity
Видео Sentence Similarity With Transformers and PyTorch (Python) канала James Briggs
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
Intro to Sentence Embeddings with TransformersTransformers, explained: Understand the model behind GPT, BERT, and T5Faiss - Introduction to Similarity SearchGenerate Blog Posts with GPT2 & Hugging Face Transformers | AI Text Generation GPT2-LargeAll Types of BERT Tokenizers from 🤗 Transformers library.3 Vector-based Methods for Similarity Search (TF-IDF, BM25, SBERT)BERT Neural Network - EXPLAINED!Cosine similarity, cosine distance explained | Math, Statistics for data science, machine learningHow to Embed Sentences using Google's Universal Sentence EncoderSentence Transformers: Sentence-BERT - Sentence Embeddings using Siamese BERT-Networks arXiv #demoPyTorch or TensorFlow?BERT Model Architectures For Semantic SimilarityFine-tune High Performance Sentence Transformers (with Multiple Negatives Ranking)Text Preprocessing | Sentiment Analysis with BERT using huggingface, PyTorch and Python TutorialLimitation of cosine similarity w/ sentence transformers - deep learning python pytorch jupyterlab.Sentence Similarity With Sentence-Transformers in PythonNew GPU-Acceleration for PyTorch on M1 Macs! + using with BERTHugging Face Transformers: the basics. Practical coding guides SE1E1. NLP Models (BERT/RoBERTa)Pytorch Transformers from Scratch (Attention is all you need)BERTopic Explained